Skip to content

Commit fde1987

Browse files
committed
Fixing test Suite
1 parent 2ef3f8d commit fde1987

2 files changed

Lines changed: 48 additions & 21 deletions

File tree

Storage/tests/System/ManageBucketsTest.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ public function testCreateBucketWithLifecycleDeleteRule(array $rule, $isError =
177177
$lifecycle->addDeleteRule($rule);
178178

179179
$bucket = self::createBucket(
180-
self::$client, uniqid(self::TESTING_PREFIX), [
180+
self::$client,
181+
uniqid(self::TESTING_PREFIX),
182+
[
181183
'lifecycle' => $lifecycle
182184
]
183185
);
@@ -204,7 +206,9 @@ public function testCreateBucketWithLifecycleAbortIncompleteMultipartUploadRule(
204206
$lifecycle->addAbortIncompleteMultipartUploadRule($rule);
205207

206208
$bucket = self::createBucket(
207-
self::$client, uniqid(self::TESTING_PREFIX), [
209+
self::$client,
210+
uniqid(self::TESTING_PREFIX),
211+
[
208212
'lifecycle' => $lifecycle
209213
]
210214
);
@@ -374,7 +378,8 @@ public function testIam()
374378
$policy = $iam->reload();
375379

376380
$newBinding = array_filter(
377-
$policy['bindings'], function ($binding) use ($role) {
381+
$policy['bindings'],
382+
function ($binding) use ($role) {
378383
return ($binding['role'] === $role);
379384
}
380385
);
@@ -435,7 +440,9 @@ public function testBucketLocationType($storageClass, $location, $expectedLocati
435440
{
436441
$bucketName = uniqid(self::TESTING_PREFIX);
437442
$bucket = self::createBucket(
438-
self::$client, $bucketName, [
443+
self::$client,
444+
$bucketName,
445+
[
439446
'storageClass' => $storageClass,
440447
'location' => $location,
441448
'retentionPolicy' => [
@@ -459,7 +466,8 @@ public function testBucketLocationType($storageClass, $location, $expectedLocati
459466
$buckets = iterator_to_array(self::$client->buckets());
460467
$listBucketBucket = current(
461468
array_filter(
462-
$buckets, function ($bucket) use ($bucketName) {
469+
$buckets,
470+
function ($bucket) use ($bucketName) {
463471
return $bucket->name() === $bucketName;
464472
}
465473
)
@@ -668,7 +676,7 @@ public function testDeleteBucketIpFilter(Bucket $bucket)
668676
$ipFilterConfig = [
669677
'mode' => 'Disabled',
670678
'publicNetworkSource' => [
671-
'allowedIpCidrRanges' => []
679+
'allowedIpCidrRanges' => []
672680
],
673681
'allowAllServiceAgentAccess' => true
674682
];

Storage/tests/Unit/BucketTest.php

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ public function testUploadResumableFinalChunkHashes()
206206
function ($request) {
207207
return $request->getMethod() === 'POST';
208208
}
209-
), Argument::any()
209+
),
210+
Argument::any()
210211
)->willReturn(new \GuzzleHttp\Psr7\Response(200, ['Location' => $resumeUri]));
211212

212213
// Intermediate chunk (PUT) - Should NOT have X-Goog-Hash
@@ -217,7 +218,8 @@ function ($request) {
217218
&& $request->getHeaderLine('Content-Range') === 'bytes 0-5/12'
218219
&& !$request->hasHeader('X-Goog-Hash');
219220
}
220-
), Argument::any()
221+
),
222+
Argument::any()
221223
)->willReturn(new \GuzzleHttp\Psr7\Response(308, ['Range' => 'bytes=0-5']));
222224

223225
// FINAL chunk (PUT) - MUST HAVE X-Goog-Hash
@@ -228,7 +230,8 @@ function ($request) use ($hash) {
228230
&& $request->getHeaderLine('Content-Range') === 'bytes 6-11/12'
229231
&& $request->getHeaderLine('X-Goog-Hash') === $hash;
230232
}
231-
), Argument::any()
233+
),
234+
Argument::any()
232235
)->willReturn(
233236
new \GuzzleHttp\Psr7\Response(200, [], '{"name":"' . $name . '","generation":"1"}')
234237
);
@@ -252,7 +255,8 @@ function ($request) use ($hash) {
252255

253256
$bucket = $this->getBucket();
254257
$object = $bucket->upload(
255-
$data, [
258+
$data,
259+
[
256260
'name' => $name,
257261
'resumable' => true,
258262
'chunkSize' => 6,
@@ -275,7 +279,8 @@ public function testInstantiateObjectWithOptions()
275279
$bucket = $this->getBucket();
276280

277281
$object = $bucket->object(
278-
'peter-venkman.jpg', [
282+
'peter-venkman.jpg',
283+
[
279284
'generation' => '5',
280285
'encryptionKey' => 'abc',
281286
'encryptionKeySHA256' => '123'
@@ -316,7 +321,8 @@ public function testGetsObjectsWithToken()
316321
'generation' => 'abc'
317322
]
318323
]
319-
], [
324+
],
325+
[
320326
'items' => [
321327
[
322328
'name' => 'file2.txt',
@@ -450,7 +456,9 @@ public function testComposesObjects(
450456
$bucket = $this->getBucket();
451457

452458
$object = $bucket->compose(
453-
$objects, $destinationObject, [
459+
$objects,
460+
$destinationObject,
461+
[
454462
'predefinedAcl' => $acl,
455463
'metadata' => $metadata
456464
]
@@ -484,7 +492,9 @@ public function testComposeWithDeleteSourceObjects()
484492
$bucket = $this->getBucket();
485493

486494
$object = $bucket->compose(
487-
['file1.txt', 'file2.txt'], $destinationObject, [
495+
['file1.txt', 'file2.txt'],
496+
$destinationObject,
497+
[
488498
'predefinedAcl' => $acl,
489499
'deleteSourceObjects' => true
490500
]
@@ -516,7 +526,9 @@ public function testComposeWithDeleteSourceObjectsFalse()
516526
$bucket = $this->getBucket();
517527

518528
$object = $bucket->compose(
519-
['file1.txt', 'file2.txt'], $destinationObject, [
529+
['file1.txt', 'file2.txt'],
530+
$destinationObject,
531+
[
520532
'predefinedAcl' => $acl,
521533
'deleteSourceObjects' => false
522534
]
@@ -548,7 +560,9 @@ public function testComposeWithDeleteSourceObjectsNull()
548560
$bucket = $this->getBucket();
549561

550562
$object = $bucket->compose(
551-
['file1.txt', 'file2.txt'], $destinationObject, [
563+
['file1.txt', 'file2.txt'],
564+
$destinationObject,
565+
[
552566
'predefinedAcl' => $acl,
553567
'deleteSourceObjects' => null
554568
]
@@ -619,7 +633,8 @@ public function testUpdateAutoclassConfig($terminalStorageClass)
619633
],
620634
];
621635
$expectedInfo = array_merge_recursive(
622-
$autoclassConfig, ['autoclass' => [
636+
$autoclassConfig,
637+
['autoclass' => [
623638
'toggleTime' => '2022-09-18T01:01:01.045123456Z',
624639
'terminalStorageClassUpdateTime' => '2022-09-18T01:01:01.045123456Z'
625640
]]
@@ -983,7 +998,8 @@ public function testCreateObjectWithValidContexts()
983998
$this->connection->insertObject(Argument::any())
984999
->willReturn($this->resumableUploader->reveal());
9851000
$object = $this->getBucket()->upload(
986-
'upload', [
1001+
'upload',
1002+
[
9871003
'name' => 'data.txt',
9881004
'contexts' => $contexts
9891005
]
@@ -1094,7 +1110,8 @@ public function testCopyObjectWithMetadataOverrides()
10941110
->willReturn($destinationObject->reveal());
10951111

10961112
$response = $sourceObject->reveal()->copy(
1097-
self::BUCKET_NAME, [
1113+
self::BUCKET_NAME,
1114+
[
10981115
'name' => $destFileName,
10991116
'metadata' => $metadata
11001117
]
@@ -1409,10 +1426,12 @@ private function getBucketForSigning(
14091426
$this->connection->projectId()->willReturn(self::PROJECT_ID);
14101427

14111428
return TestHelpers::stub(
1412-
Bucket::class, [
1429+
Bucket::class,
1430+
[
14131431
$this->connection->reveal(),
14141432
self::BUCKET_NAME,
1415-
], ['connection']
1433+
],
1434+
['connection']
14161435
);
14171436
}
14181437
}

0 commit comments

Comments
 (0)