From 07cc2e1cbf4f5a3a3b9dcb51addb82f15706a7bd Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 27 Sep 2024 11:56:45 -0700 Subject: [PATCH] cleanup from code review --- Core/src/Testing/TestHelpers.php | 3 ++- Redis/tests/System/V1/CloudRedisClientTest.php | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Core/src/Testing/TestHelpers.php b/Core/src/Testing/TestHelpers.php index 275935725776..0faf64bb10f8 100644 --- a/Core/src/Testing/TestHelpers.php +++ b/Core/src/Testing/TestHelpers.php @@ -23,6 +23,7 @@ use Google\Cloud\Core\Testing\Snippet\Coverage\Coverage; use Google\Cloud\Core\Testing\Snippet\Coverage\Scanner; use Google\Cloud\Core\Testing\Snippet\Parser\Parser; +use Google\Cloud\Core\Testing\Snippet\Fixtures; use Google\Cloud\Core\Testing\System\SystemTestCase; /** @@ -106,7 +107,7 @@ public function call($fn, array $args = []) { return call_user_func_array([$this */ public static function snippetBootstrap() { - putenv('GOOGLE_APPLICATION_CREDENTIALS='. \Google\Cloud\Core\Testing\Snippet\Fixtures::KEYFILE_STUB_FIXTURE()); + putenv('GOOGLE_APPLICATION_CREDENTIALS='. Fixtures::KEYFILE_STUB_FIXTURE()); $parser = new Parser; $scanner = new Scanner($parser, self::projectRoot(), [ diff --git a/Redis/tests/System/V1/CloudRedisClientTest.php b/Redis/tests/System/V1/CloudRedisClientTest.php index 89ee50234c9a..2065ead61ac3 100644 --- a/Redis/tests/System/V1/CloudRedisClientTest.php +++ b/Redis/tests/System/V1/CloudRedisClientTest.php @@ -48,9 +48,11 @@ class CloudRedisClientTest extends TestCase */ public static function setUpTestFixtures() { - $keyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH'); + if (!$keyFilePath = getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH')) { + self::markTestSkipped('Set the GOOGLE_CLOUD_PHP_TESTS_KEY_PATH environment variable'); + } $keyFileData = json_decode(file_get_contents($keyFilePath), true); - $projectId = $keyFileData['project_id']; + $projectId = $keyFileData['project_id'] ?? ''; self::$client = new CloudRedisClient([ 'credentials' => $keyFilePath,