diff --git a/ci/run-integration-tests.ps1 b/ci/run-integration-tests.ps1 index a853e0f..d57d6f9 100644 --- a/ci/run-integration-tests.ps1 +++ b/ci/run-integration-tests.ps1 @@ -10,7 +10,7 @@ if (!$Keys.TestResourceKey) { return } -$env:RESOURCEKEY = $Keys.TestResourceKey +$env:resource_key = $Keys.TestResourceKey ./php/run-integration-tests.ps1 -RepoName $RepoName diff --git a/phpunit.xml b/phpunit.xml index a4a27d4..85e6fe7 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,6 @@ - + diff --git a/tests/CloudRequestTests.php b/tests/CloudRequestTests.php index 4aca2ea..1d6796a 100644 --- a/tests/CloudRequestTests.php +++ b/tests/CloudRequestTests.php @@ -1,24 +1,24 @@ $_ENV['RESOURCEKEY']]; + $params = ['resourceKey' => $this->getResourceKey()]; $this->assertNotSame( '!!YOUR_RESOURCE_KEY!!', @@ -73,7 +73,7 @@ public function testCloudRequestEngine() */ public function testCloudPostRequestWithSequenceEvidence() { - $params = ['resourceKey' => $_ENV['RESOURCEKEY']]; + $params = ['resourceKey' => $this->getResourceKey()]; $this->assertNotSame( '!!YOUR_RESOURCE_KEY!!', @@ -121,7 +121,7 @@ public function testCloudGetRequestWithSequenceEvidence() $httpClient = new HttpClient(); $params = [ - 'resourceKey' => $_ENV['RESOURCEKEY'], + 'resourceKey' => $this->getResourceKey(), 'httpClient' => $httpClient ]; @@ -202,7 +202,7 @@ public function testHttpDataSetInException() public function testPipelineSuppressesExceptionsWhenCloudServiceIsDown() { $params = [ - 'resourceKey' => $_ENV['RESOURCEKEY'], + 'resourceKey' => $this->getResourceKey(), 'httpClient' => $this->mockHttp() ]; @@ -246,7 +246,7 @@ public function testPipelineSuppressesExceptionsWhenCloudServiceIsDown() public function testPipelineDoesNotSuppressExceptionsWhenCloudServiceIsDown() { $params = [ - 'resourceKey' => $_ENV['RESOURCEKEY'], + 'resourceKey' => $this->getResourceKey(), 'httpClient' => $this->mockHttp() ]; @@ -277,4 +277,9 @@ public function testPipelineDoesNotSuppressExceptionsWhenCloudServiceIsDown() $this->expectException(CloudRequestException::class); $fd->process(); } + + private function getResourceKey() + { + return $_ENV[self::resourceKey] ?? null; + } }