diff options
author | Joas Schilling <coding@schilljs.com> | 2024-01-26 20:38:43 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2024-01-26 20:46:14 +0100 |
commit | 58506952840049b69224ae119f89da0f25737a11 (patch) | |
tree | fd7c04cdf9e09e438602ba308e7a7413682e30c0 /tests/lib/Files | |
parent | d086b6c81d32c83a0bd480cc29819a4d5e1cc425 (diff) | |
download | nextcloud-server-58506952840049b69224ae119f89da0f25737a11.tar.gz nextcloud-server-58506952840049b69224ae119f89da0f25737a11.zip |
fix(tests): Add messages to assertions to explain what failed
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/Files')
-rw-r--r-- | tests/lib/Files/ObjectStore/S3Test.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/lib/Files/ObjectStore/S3Test.php b/tests/lib/Files/ObjectStore/S3Test.php index 33130a152a1..c8333ca1ea3 100644 --- a/tests/lib/Files/ObjectStore/S3Test.php +++ b/tests/lib/Files/ObjectStore/S3Test.php @@ -113,7 +113,7 @@ class S3Test extends ObjectStoreTest { 'Bucket' => $s3->getBucket(), 'Prefix' => $objectUrn, ]); - $this->assertArrayNotHasKey('Uploads', $uploads); + $this->assertArrayNotHasKey('Uploads', $uploads, 'Assert is not uploaded'); } public function testEmptyUpload() { @@ -125,11 +125,11 @@ class S3Test extends ObjectStoreTest { $s3->writeObject('emptystream', $emptyStream); $this->assertNoUpload('emptystream'); - $this->assertTrue($s3->objectExists('emptystream')); + $this->assertTrue($s3->objectExists('emptystream'), 'Object exists on S3'); $thrown = false; try { - self::assertFalse($s3->readObject('emptystream')); + self::assertFalse($s3->readObject('emptystream'), 'Reading empty stream object should return false'); } catch (\Exception $e) { // An exception is expected here since 0 byte files are wrapped // to be read from an empty memory stream in the ObjectStoreStorage @@ -164,20 +164,20 @@ class S3Test extends ObjectStoreTest { $s3->writeObject('testfilesizes', $sourceStream); $this->assertNoUpload('testfilesizes'); - self::assertTrue($s3->objectExists('testfilesizes')); + self::assertTrue($s3->objectExists('testfilesizes'), 'Object exists on S3'); $result = $s3->readObject('testfilesizes'); // compare first 100 bytes - self::assertEquals(str_repeat('A', 100), fread($result, 100)); + self::assertEquals(str_repeat('A', 100), fread($result, 100), 'Compare first 100 bytes'); - // compare 100 bytes + // compare last 100 bytes fseek($result, $size - 100); - self::assertEquals(str_repeat('A', 100), fread($result, 100)); + self::assertEquals(str_repeat('A', 100), fread($result, 100), 'Compare last 100 bytes'); // end of file reached fseek($result, $size); - self::assertTrue(feof($result)); + self::assertTrue(feof($result), 'End of file reached'); $this->assertNoUpload('testfilesizes'); } |