Skip to content

Commit

Permalink
Add testing for windows residency
Browse files Browse the repository at this point in the history
  • Loading branch information
Hectorhammett committed May 29, 2024
1 parent c0ca065 commit 6d706d2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/Credentials/GCECredentialsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down

0 comments on commit 6d706d2

Please sign in to comment.