Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix broken system test #2688

Merged
merged 1 commit into from
Feb 11, 2020
Merged
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
24 changes: 7 additions & 17 deletions Storage/tests/System/IamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,26 @@

namespace Google\Cloud\Storage\Tests\System;

use Google\Cloud\Storage\StorageClient;
use Google\Cloud\Core\Testing\System\SystemTestCase;

/**
* @group storage
* @group storage-iam
*/
class IamTest extends SystemTestCase
class IamTest extends StorageTestCase
{
private $bucket;
const TESTING_PREFIX = 'gcloud_testing_';
private $b;

public function setUp()
{
$config = [
'keyFilePath' => getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH'),
'transport' => 'rest'
];

$client = new StorageClient($config);
$this->$bucket = self::createBucket($client, uniqid(self::TESTING_PREFIX));
$this->$bucket->update($this->bucketConfig());
$this->b = self::createBucket(self::$client, uniqid(self::TESTING_PREFIX));
$this->b->update($this->bucketConfig());
}

public function testGetPolicy()
{
$keyfile = json_decode(file_get_contents(getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH')), true);
$projectId = $keyfile['project_id'];

$iam = $this->$bucket->iam();
$iam = $this->b->iam();
$policy = $iam->policy();

$this->assertTrue(isset($policy['etag']));
Expand Down Expand Up @@ -74,7 +64,7 @@ public function testSetPolicy()
$keyfile = json_decode(file_get_contents(getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH')), true);
$projectId = $keyfile['project_id'];

$iam = $this->$bucket->iam();
$iam = $this->b->iam();
$policy = $iam->policy();
$newBinding = [
'role' => 'roles/storage.legacyBucketReader',
Expand All @@ -99,7 +89,7 @@ public function testGetModifySetConditionalPolicy()
$keyfile = json_decode(file_get_contents(getenv('GOOGLE_CLOUD_PHP_TESTS_KEY_PATH')), true);
$email = $keyfile['client_email'];

$iam = $this->$bucket->iam();
$iam = $this->b->iam();
$policy = $iam->policy();
$policy['version'] = 3;

Expand Down