Browse Source

fix(tests): Add messages to assertions to explain what failed

Signed-off-by: Joas Schilling <coding@schilljs.com>
tags/v29.0.0beta1
Joas Schilling 4 months ago
parent
commit
5850695284
No account linked to committer's email address
1 changed files with 8 additions and 8 deletions
  1. 8
    8
      tests/lib/Files/ObjectStore/S3Test.php

+ 8
- 8
tests/lib/Files/ObjectStore/S3Test.php View File

@@ -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');
}

Loading…
Cancel
Save