diff --git a/tests/Backend/CommonPart1/BucketsTest.php b/tests/Backend/CommonPart1/BucketsTest.php index 2daeea2f9..7ecdd8698 100644 --- a/tests/Backend/CommonPart1/BucketsTest.php +++ b/tests/Backend/CommonPart1/BucketsTest.php @@ -606,6 +606,8 @@ public function testBucketOwner(string $devBranchType, string $userRole): void $this->assertSame("Owner of Bucket in.c-{$bucketName} not found", $e->getMessage()); } + $this->assertNull($bucket['lastShareChangeDate']); + try { $this->_testClient->updateBucketOwner($bucketId, new BucketOwnerUpdateOptions(id: 99999999)); $this->fail('Should fail.'); @@ -640,6 +642,51 @@ public function testBucketOwner(string $devBranchType, string $userRole): void $bucket = $this->_testClient->getBucket($bucketId); $this->assertEquals($ownerId, $bucket['owner']['id']); $this->assertEquals($ownerName, $bucket['owner']['name']); + $this->assertNotNull($bucket['lastShareChangeDate']); + } + + /** + * @dataProvider provideComponentsClientTypeBasedOnSuite + */ + public function testBucketDescriptionMetadata() + { + $this->initEvents($this->_testClient); + + $bucketName = 'bucketMetadataDescriptionTesting'; + $metadataProvider = 'user'; + $descriptionKey = 'KBC.description'; + + $this->dropBucketIfExists($this->_testClient, "in.c-{$bucketName}", true); + $bucketId = $this->_testClient->createBucket($bucketName, self::STAGE_IN); + + $bucket = $this->_testClient->getBucket($bucketId); + $this->assertNull($bucket['lastShareChangeDate']); + + $metadataClient = new Metadata($this->_testClient); + + $bucketMetadata = $metadataClient->listBucketMetadata($bucketId); + $this->assertEmpty($bucketMetadata); + + $metadataClient->postBucketMetadata($bucketId, $metadataProvider, [[ 'key' => $descriptionKey, 'value' => 'Testing bucket description']]); + + $eventAssertCallback = function ($events) use ($bucketId) { + $this->assertCount(1, $events); + + $this->assertSame('bucket', $events[0]['objectType']); + $this->assertSame($bucketId, $events[0]['objectId']); + }; + + $query = new EventsQueryBuilder(); + $query->setEvent('storage.bucketMetadataSet') + ->setTokenId($this->tokenId) + ->setObjectId($bucketId); + $this->assertEventWithRetries($this->_testClient, $eventAssertCallback, $query); + + $bucketMetadata = $metadataClient->listBucketMetadata($bucketId); + $this->assertNotEmpty($bucketMetadata); + + $bucket = $this->_testClient->getBucket($bucketId); + $this->assertNotNull($bucket['lastShareChangeDate']); } public function provideComponentsClientTypeBasedOnSuite(): array