Skip to content

Commit

Permalink
Restore overwritten credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed May 28, 2024
1 parent 441aadc commit 481c07f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/Integration/ServiceAccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ final class ServiceAccountTest extends IntegrationTestCase
* @var non-empty-string
*/
private static string $credentialsPath;
private static ?string $originalCredentials;

public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();

self::$originalCredentials = Util::getenv('GOOGLE_APPLICATION_CREDENTIALS');

self::$credentialsPath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'test_credentials.json';
file_put_contents(self::$credentialsPath, json_encode(self::$serviceAccount));
Util::putenv('GOOGLE_APPLICATION_CREDENTIALS', self::$credentialsPath);
Expand All @@ -34,6 +37,7 @@ public static function setUpBeforeClass(): void
public static function tearDownAfterClass(): void
{
unlink(self::$credentialsPath);
Util::putenv('GOOGLE_APPLICATION_CREDENTIALS', self::$originalCredentials);
}

#[Test]
Expand Down

0 comments on commit 481c07f

Please sign in to comment.