From 5dc4c6d7bfc0ab7451b210ace7480e9e9e6274eb Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Wed, 11 Dec 2024 12:45:05 -0500 Subject: [PATCH 1/4] Fix groups aliases property to be an array of strings, not Alias objects --- SilMock/Google/Service/Directory/Resource/Groups.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SilMock/Google/Service/Directory/Resource/Groups.php b/SilMock/Google/Service/Directory/Resource/Groups.php index b97b549..6bb2f6b 100644 --- a/SilMock/Google/Service/Directory/Resource/Groups.php +++ b/SilMock/Google/Service/Directory/Resource/Groups.php @@ -58,8 +58,10 @@ public function get(string $groupKey): ?GoogleDirectory_Group } if ($matchedGroup !== null) { $mockGroupsAliasesObject = new GroupsAliases($this->dbFile); - $aliases = $mockGroupsAliasesObject->listGroupsAliases($matchedGroup->getEmail()); - $matchedGroup->setAliases($aliases->getAliases()); + $aliasesObject = $mockGroupsAliasesObject->listGroupsAliases($matchedGroup->getEmail()); + $arrayOfAliasOjbects = $aliasesObject->getAliases(); + $aliases = array_map(function (GoogleDirectory_GroupAlias $alias) { return $alias->getAlias(); }, $arrayOfAliasOjbects); + $matchedGroup->setAliases($aliases); } return $matchedGroup; } From 5ea34ba877b5c5ef6db60511d23ca23dd3ce803c Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Wed, 11 Dec 2024 12:46:22 -0500 Subject: [PATCH 2/4] Update version --- composer.json | 2 +- composer.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 97c379e..e5c2b3d 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "silinternational/google-api-php-client-mock", - "version": "2.13.1", + "version": "2.13.2", "description": "Attempting to create an intelligent mock of the Google API PHP Client for unit and functional testing.", "type": "library", "keywords": [ diff --git a/composer.lock b/composer.lock index 9258af0..48042bb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "98589aa7e195a743dcf2387f4ae0d570", + "content-hash": "6a6776cd80056ba0e3e3e1e8ae7f6e7d", "packages": [ { "name": "firebase/php-jwt", From f75c0394c8c1d5d925a07602efd0d60e6b1adc91 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Wed, 11 Dec 2024 13:38:52 -0500 Subject: [PATCH 3/4] Fix typo in variable name --- SilMock/Google/Service/Directory/Resource/Groups.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SilMock/Google/Service/Directory/Resource/Groups.php b/SilMock/Google/Service/Directory/Resource/Groups.php index 6bb2f6b..51e8b5b 100644 --- a/SilMock/Google/Service/Directory/Resource/Groups.php +++ b/SilMock/Google/Service/Directory/Resource/Groups.php @@ -59,8 +59,8 @@ public function get(string $groupKey): ?GoogleDirectory_Group if ($matchedGroup !== null) { $mockGroupsAliasesObject = new GroupsAliases($this->dbFile); $aliasesObject = $mockGroupsAliasesObject->listGroupsAliases($matchedGroup->getEmail()); - $arrayOfAliasOjbects = $aliasesObject->getAliases(); - $aliases = array_map(function (GoogleDirectory_GroupAlias $alias) { return $alias->getAlias(); }, $arrayOfAliasOjbects); + $arrayOfAliasObjects = $aliasesObject->getAliases(); + $aliases = array_map(function (GoogleDirectory_GroupAlias $alias) { return $alias->getAlias(); }, $arrayOfAliasObjects); $matchedGroup->setAliases($aliases); } return $matchedGroup; From 8405ebac162af5140b7fdbfc7a06c8d5c64f41f6 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Wed, 11 Dec 2024 14:07:13 -0500 Subject: [PATCH 4/4] Tighten permissions to get SonarQube off my back --- SilMock/DataStore/Sqlite/SqliteUtils.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SilMock/DataStore/Sqlite/SqliteUtils.php b/SilMock/DataStore/Sqlite/SqliteUtils.php index 595018a..89c7b9f 100644 --- a/SilMock/DataStore/Sqlite/SqliteUtils.php +++ b/SilMock/DataStore/Sqlite/SqliteUtils.php @@ -241,14 +241,14 @@ public function recordData($dataType, $dataClass, $data) /** * If the database file does not exist, creates it with an empty string - * with 0644 permissions. + * with 0640 permissions. * @returns null */ public function createDbIfNotExists() { if (! file_exists($this->dbFile)) { file_put_contents($this->dbFile, ''); - chmod($this->dbFile, 0644); + chmod($this->dbFile, 0640); } }