Skip to content

Commit 34061e1

Browse files
author
Frank Natividad
committed
Update tests and library version
1 parent 6dde4e3 commit 34061e1

File tree

5 files changed

+17
-31
lines changed

5 files changed

+17
-31
lines changed

storage/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
3-
"google/cloud-storage": "^1.9.0",
3+
"google/cloud-storage": "^1.14.0",
44
"paragonie/random_compat": "^2.0",
55
"symfony/console": " ^3.0"
66
},

storage/src/activate_hmac_key.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function activate_hmac_key($options = ['projectId' => 'your-project-id'])
3939
$hmacKey = $storage->hmacKey($accessId, $options);
4040

4141
$hmacKey = $hmacKey->update('ACTIVE');
42+
print("The HMAC key is now active.");
4243
printf("HMAC key Metadata: %s" . PHP_EOL, print_r($hmacKey->info()));
4344
}
4445
# [END storage_activate_hmac_key]

storage/src/deactivate_hmac_key.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ function deactivate_hmac_key($options = ['projectId' => 'your-project-id'])
3939
$hmacKey = $storage->hmacKey($accessId, $options);
4040

4141
$hmacKey = $hmacKey->update('INACTIVE');
42+
43+
print("The HMAC key is now inactive.");
4244
printf("HMAC key Metadata: %s" . PHP_EOL, print_r($hmacKey->info()));
4345
}
4446
# [END storage_deactivate_hmac_key]

storage/src/list_hmac_keys.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @param string $options options for the new HMAC key.
3333
*
3434
*/
35-
function list_hmac_key($options = ['projectId' => 'your-project-id'])
35+
function list_hmac_keys($options = ['projectId' => 'your-project-id'])
3636
{
3737
$storage = new StorageClient();
3838
$hmacKeys = $storage->hmacKeys($options);

storage/test/HmacCommandTest.php

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,8 @@ public function testHmacKeyList()
7474
],
7575
['interactive' => false]
7676
);
77-
$outputString = <<<EOF
78-
List List list
79-
80-
EOF;
81-
$this->expectOutputString($outputString);
77+
$outputString = "/HMAC key Metadata:/";
78+
$this->expectOutputRegex($outputString);
8279
}
8380

8481
/** @depends testHmacKeyList */
@@ -91,11 +88,8 @@ public function testHmacKeyCreate()
9188
],
9289
['interactive' => false]
9390
);
94-
$outputString = <<<EOF
95-
Create Create Create
96-
97-
EOF;
98-
$this->expectOutputString($outputString);
91+
$outputString = "/The base64 encoded secret is:/";
92+
$this->expectOutputRegex($outputString);
9993
}
10094

10195
/** @depends testHmacKeyCreate */
@@ -109,11 +103,8 @@ public function testHmacKeyGet()
109103
],
110104
['interactive' => false]
111105
);
112-
$outputString = <<<EOF
113-
Create Create Create
114-
115-
EOF;
116-
$this->expectOutputString($outputString);
106+
$outputString = "/HMAC key Metadata:/";
107+
$this->expectOutputRegex($outputString);
117108
}
118109

119110
/** @depends testHmacKeyGet */
@@ -127,11 +118,8 @@ public function testHmacKeyDeactivate()
127118
],
128119
['interactive' => false]
129120
);
130-
$outputString = <<<EOF
131-
Create Create Create
132-
133-
EOF;
134-
$this->expectOutputString($outputString);
121+
$outputString = "/The HMAC key is now inactive./";
122+
$this->expectOutputRegex($outputString);
135123
}
136124

137125
/** @depends testHmacKeyDeactivate */
@@ -145,11 +133,9 @@ public function testHmacKeyActivate()
145133
],
146134
['interactive' => false]
147135
);
148-
$outputString = <<<EOF
149-
Create Create Create
136+
$outputString = "/The HMAC key is now active./";
150137

151-
EOF;
152-
$this->expectOutputString($outputString);
138+
$this->expectOutputRegex($outputString);
153139
}
154140

155141
/** @depends testHmacKeyActivate */
@@ -171,10 +157,7 @@ public function testHmacKeyDelete()
171157
],
172158
['interactive' => false]
173159
);
174-
$outputString = <<<EOF
175-
Create Create Create
176-
177-
EOF;
178-
$this->expectOutputString($outputString);
160+
$outputString = "/The key is deleted, though it may still appear in StorageClient.hmacKeys() results./";
161+
$this->expectOutputRegex($outputString);
179162
}
180163
}

0 commit comments

Comments
 (0)