diff --git a/SilMock/Google/Service/Directory.php b/SilMock/Google/Service/Directory.php index 3955ffe..90b7bd5 100644 --- a/SilMock/Google/Service/Directory.php +++ b/SilMock/Google/Service/Directory.php @@ -5,6 +5,7 @@ use Google\Client; use SilMock\Google\Http\Batch; use SilMock\Google\Service\Directory\Asps; +use SilMock\Google\Service\Directory\Resource\Domains; use SilMock\Google\Service\Directory\Resource\Groups; use SilMock\Google\Service\Directory\Resource\GroupsAliases; use SilMock\Google\Service\Directory\Resource\Members; @@ -18,6 +19,7 @@ class Directory { public $asps; + public Domains $domains; public Members $members; public Groups $groups; public GroupsAliases $groups_aliases; @@ -38,6 +40,7 @@ class Directory public function __construct($client, ?string $dbFile = null) { $this->asps = new Asps($dbFile); + $this->domains = new Domains($dbFile); $this->members = new Members($dbFile); $this->groups = new Groups($dbFile); $this->groups_aliases = new GroupsAliases($dbFile); diff --git a/SilMock/Google/Service/Directory/Resource/Domains.php b/SilMock/Google/Service/Directory/Resource/Domains.php new file mode 100644 index 0000000..2ad2a95 --- /dev/null +++ b/SilMock/Google/Service/Directory/Resource/Domains.php @@ -0,0 +1,32 @@ +setDomainName($domainName); + $domains[] = $domain; + } + $domains2 = new GoogleDirectory_Domains2(); + $domains2->setDomains($domains); + return $domains2; + } +} diff --git a/SilMock/tests/Google/Service/Directory/Resource/DomainsTest.php b/SilMock/tests/Google/Service/Directory/Resource/DomainsTest.php new file mode 100644 index 0000000..712b210 --- /dev/null +++ b/SilMock/tests/Google/Service/Directory/Resource/DomainsTest.php @@ -0,0 +1,28 @@ +listDomains('any_customer'); + $arrayOfDomainsObjects = $domainNameListObject->getDomains(); + $domainNameList = []; + foreach ($arrayOfDomainsObjects as $domainObject) { + $domainNameList[$domainObject->getDomainName()] = $domainObject->getDomainName(); + } + // This should match the values in docker-compose.yml when testing locally + // This should match the values in run-tests.sh when testing is triggered by GitHub actions + // This is the keyed array version of the list. + $expected = [ + 'groups.example.org' => 'groups.example.org', + 'example.org' => 'example.org', + ]; + self::assertEquals($expected, $domainNameList, 'Domain name list does not match expected values'); + } +} diff --git a/composer.json b/composer.json index e5c2b3d..af937bb 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "silinternational/google-api-php-client-mock", - "version": "2.13.2", + "version": "2.14.0", "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 48042bb..2b1d99f 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": "6a6776cd80056ba0e3e3e1e8ae7f6e7d", + "content-hash": "1e021a94f9075dbd119cd1e3e5d7889a", "packages": [ { "name": "firebase/php-jwt", diff --git a/docker-compose.yml b/docker-compose.yml index d993523..2b4617b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,9 @@ services: volumes: - ./:/data working_dir: /data + environment: + # This should match the value in run-tests.sh + - DOMAIN_NAMES=groups.example.org,example.org command: ["true"] networks: diff --git a/run-tests.sh b/run-tests.sh index b822352..62f7ac9 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -2,4 +2,5 @@ cd /data/SilMock/tests -./phpunit +# This should match the value in docker-compose.yml +DOMAIN_NAMES=groups.example.org,example.org ./phpunit