You are here

public function S3FileMapTest::testRecordUpdate in Acquia Content Hub 8.2

@covers ::record

File

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

Class

S3FileMapTest
Tests the S3FileMap.

Namespace

Drupal\Tests\acquia_contenthub_s3\Kernel

Code

public function testRecordUpdate() {
  $data = [
    'd2ded609-c7eb-4ca0-97cc-5bb0ddbbbf5a',
    'custom-bucket',
    'custom-root-folder',
    'd2ded609-c7eb-4ca0-97cc-5bb0ddbbbf55',
  ];
  $this->s3FileMap
    ->record(...$data);
  $updated = [
    'd2ded609-c7eb-4ca0-97cc-5bb0ddbbbf5a',
    'other-bucket',
    'other-root',
    '88e438dd-e7a3-4c08-b7a1-6158c404d30b',
  ];
  $this->s3FileMap
    ->record(...$updated);
  $records = $this
    ->fetchAllData();
  $this
    ->assertCount(1, $records, 'No new entry was added.');
  $this
    ->assertEqual($updated, array_values(current($records)), 'Data was successfully updated.');
}