diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8251dda2f..632f81276 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ permissions: contents: read jobs: test: - runs-on: ubuntu-latest + runs-on: [ubuntu-latest, windows-latest] strategy: matrix: php: [ "8.0", "8.1", "8.2", "8.3" ] diff --git a/tests/Credentials/GCECredentialsTest.php b/tests/Credentials/GCECredentialsTest.php index 1aea158ce..34cac3aaa 100644 --- a/tests/Credentials/GCECredentialsTest.php +++ b/tests/Credentials/GCECredentialsTest.php @@ -134,6 +134,27 @@ public function testOnWindowsGceWithResidencyWithNoCom() $this->assertFalse($method->invoke(null, 'thisShouldBeFalse')); } + public function testOnWindowsGceWithResidency() + { + if (!class_exists(\COM::class)) { + throw $this->markTestSkipped('This test only works while running on windiwos with GCE and the COM class enabled'); + } + + $method = (new \ReflectionClass(GCECredentials::class)) + ->getMethod('detectResidencyWindows'); + $method->setAccessible(true); + + $keyPathProperty = (new \ReflectionClass(GCECredentials::class)) + ->getProperty('REGISTRY_KEY_PATH'); + $keyPathProperty->setAccessible(true); + + $keyName = (new \ReflectionClass(GCECredentials::class)) + ->getProperty('REGISTRY_KEY_NAME'); + $keyName->setAccessible(true); + + $this->assertTrue($method->invoke(null, $keyPathProperty->getValue() . $keyName->getValue())); + } + public function testOnGCEIsFalseOnOkStatusWithoutExpectedHeader() { $httpHandler = getHandler([