@@ -71,8 +71,8 @@ public function testPrintDefaultBucketAcl()
71
71
$ defaultAcl = self ::$ tempBucket ->defaultAcl ()->get ();
72
72
foreach ($ defaultAcl as $ item ) {
73
73
$ this ->assertStringContainsString (
74
- sprintf ('%s: %s ' . PHP_EOL , $ item ['entity ' ], $ item ['role ' ]),
75
- $ output ,
74
+ sprintf ('%s: %s ' . PHP_EOL , $ item ['entity ' ], $ item ['role ' ]),
75
+ $ output ,
76
76
);
77
77
}
78
78
}
@@ -475,8 +475,30 @@ public function testUploadWithKmsKey()
475
475
$ objectName ,
476
476
$ this ->keyName ()
477
477
));
478
+
479
+ return $ objectName ;
478
480
}
479
481
482
+ /** @depends testUploadWithKmsKey */
483
+ public function testObjectGetKmsKey (string $ objectName )
484
+ {
485
+ $ kmsEncryptedBucketName = self ::$ bucketName . '-kms-encrypted ' ;
486
+ $ bucket = self ::$ storage ->bucket ($ kmsEncryptedBucketName );
487
+ $ objectInfo = $ bucket ->object ($ objectName )->info ();
488
+
489
+ $ output = $ this ->runFunctionSnippet ('object_get_kms_key ' , [
490
+ $ kmsEncryptedBucketName ,
491
+ $ objectName ,
492
+ ]);
493
+
494
+ $ this ->assertEquals (
495
+ sprintf (
496
+ 'The KMS key of the object is %s ' . PHP_EOL ,
497
+ $ objectInfo ['kmsKeyName ' ],
498
+ ),
499
+ $ output ,
500
+ );
501
+ }
480
502
public function testBucketVersioning ()
481
503
{
482
504
$ output = self ::runFunctionSnippet ('enable_versioning ' , [
@@ -510,8 +532,8 @@ public function testBucketWebsiteConfiguration()
510
532
]);
511
533
512
534
$ this ->assertEquals (
513
- sprintf ('Bucket website configuration not set ' . PHP_EOL ),
514
- $ output ,
535
+ sprintf ('Bucket website configuration not set ' . PHP_EOL ),
536
+ $ output ,
515
537
);
516
538
517
539
$ output = self ::runFunctionSnippet ('define_bucket_website_configuration ' , [
@@ -521,13 +543,13 @@ public function testBucketWebsiteConfiguration()
521
543
]);
522
544
523
545
$ this ->assertEquals (
524
- sprintf (
525
- 'Static website bucket %s is set up to use %s as the index page and %s as the 404 page. ' ,
526
- $ bucket ->name (),
527
- $ obj ->name (),
528
- $ obj ->name (),
529
- ),
530
- $ output
546
+ sprintf (
547
+ 'Static website bucket %s is set up to use %s as the index page and %s as the 404 page. ' ,
548
+ $ bucket ->name (),
549
+ $ obj ->name (),
550
+ $ obj ->name (),
551
+ ),
552
+ $ output
531
553
);
532
554
533
555
$ info = $ bucket ->reload ();
@@ -537,12 +559,12 @@ public function testBucketWebsiteConfiguration()
537
559
]);
538
560
539
561
$ this ->assertEquals (
540
- sprintf (
541
- 'Index page: %s ' . PHP_EOL . '404 page: %s ' . PHP_EOL ,
542
- $ info ['website ' ]['mainPageSuffix ' ],
543
- $ info ['website ' ]['notFoundPage ' ],
544
- ),
545
- $ output ,
562
+ sprintf (
563
+ 'Index page: %s ' . PHP_EOL . '404 page: %s ' . PHP_EOL ,
564
+ $ info ['website ' ]['mainPageSuffix ' ],
565
+ $ info ['website ' ]['notFoundPage ' ],
566
+ ),
567
+ $ output ,
546
568
);
547
569
548
570
$ obj ->delete ();
0 commit comments