Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions Core/tests/Unit/ClientTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,7 @@ public function testConfigureAuthenticationWithKeyFilePath()

public function testIgnoreKeyFileWhenUsingCredentialsFetcher()
{
$keyFilePath = Fixtures::SERVICE_ACCOUNT_FIXTURE();
$key = json_decode(file_get_contents($keyFilePath), true);
$key['private_key'] = 'xxx';

$key = Fixtures::SERVICE_ACCOUNT_FIXTURE();
$credentials = new ServiceAccountCredentials([], $key);

$conf = $this->impl->call('configureAuthentication', [[
Expand All @@ -183,10 +180,7 @@ public function testIgnoreKeyFileWhenUsingCredentialsFetcher()

public function testGetProjectIdFromCredentialsFetcher()
{
$keyFilePath = Fixtures::SERVICE_ACCOUNT_FIXTURE();
$key = json_decode(file_get_contents($keyFilePath), true);
$key['private_key'] = 'xxx';

$key = Fixtures::SERVICE_ACCOUNT_FIXTURE();
$credentials = new ServiceAccountCredentials([], $key);

$this->impl->call('configureAuthentication', [[
Expand Down
15 changes: 13 additions & 2 deletions Core/tests/Unit/Fixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,20 @@ public static function JSON_KEY_FIXTURE()
return __DIR__ . '/fixtures/json-key-fixture.json';
}

public static function SERVICE_ACCOUNT_FIXTURE()
public static function SERVICE_ACCOUNT_FIXTURE(): array
{
return __DIR__ . '/fixtures/service-account-fixture.json';
return [
'type' => 'service_account',
'project_id' => 'example-project-12345',
'private_key_id' => 'xyz',
'client_email' => 'test-service-account@example-project-12345.iam.gserviceaccount.com',
'client_id' => '123456789012345678901',
'private_key' => 'xyz',
'auth_uri' => 'https://accounts.google.com/o/oauth2/auth',
'token_uri' => 'https://oauth2.googleapis.com/token',
'auth_provider_x509_cert_url' => 'https://www.googleapis.com/oauth2/v1/certs',
'client_x509_cert_url' => 'https://www.googleapis.com/robot/v1/metadata/x509/test-service-account%40example-project-12345.iam.gserviceaccount.com'
];
}

public static function SERVICE_FIXTURE()
Expand Down
11 changes: 0 additions & 11 deletions Core/tests/Unit/fixtures/service-account-fixture.json

This file was deleted.