You are here

public function S3FileMapTest::testGetFileByUuid in Acquia Content Hub 8.2

@covers ::getFileByUuid

File

modules/acquia_contenthub_s3/tests/src/Kernel/S3FileMapTest.php, line 168

Class

S3FileMapTest
Tests the S3FileMap.

Namespace

Drupal\Tests\acquia_contenthub_s3\Kernel

Code

public function testGetFileByUuid() {
  $uuid = 'd2ded609-c7eb-4ca0-97cc-5bb0ddbbbf5a';
  $bucket = 'custom-bucket';
  $root = 'custom-root-folder';
  $origin = 'd2ded609-c7eb-4ca0-97cc-5bb0ddbbbf55';
  $this->s3FileMap
    ->record($uuid, $bucket, $root, $origin);
  $object = $this->s3FileMap
    ->getFileByUuid($uuid);
  $this
    ->assertInstanceOf('stdClass', $object, 'Returned data is of type stdClass.');
  $this
    ->assertEqual($object->file_uuid, $uuid, 'File uuid match.');
  $this
    ->assertEqual($object->bucket, $bucket, 'Bucket match.');
  $this
    ->assertEqual($object->root_folder, $root, 'Root folder match.');
  $this
    ->assertEqual($object->origin_uuid, $origin, 'Origin uuid match.');
  $object = $this->s3FileMap
    ->getFileByUuid('c0512f3c-f305-4dce-a114-6d47bcb051a4');
  $this
    ->assertNull($object, 'Non existent file, return value is NULL.');
}