You are here

public function S3FileMapTest::testRemove in Acquia Content Hub 8.2

@covers ::remove

File

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

Class

S3FileMapTest
Tests the S3FileMap.

Namespace

Drupal\Tests\acquia_contenthub_s3\Kernel

Code

public function testRemove() {
  $data = [
    'd2ded609-c7eb-4ca0-97cc-5bb0ddbbbf5a',
    'custom-bucket',
    'custom-root-folder',
    'd2ded609-c7eb-4ca0-97cc-5bb0ddbbbf55',
  ];
  $this->s3FileMap
    ->record(...$data);
  $data2 = [
    'b553c81e-cc33-4f07-bce7-e4478332fe26',
    'custom-bucket',
    'custom-root-folder',
    'b553c81e-cc33-4f07-bce7-e4478332fe27',
  ];
  $this->s3FileMap
    ->record(...$data2);
  $this->s3FileMap
    ->remove('d2ded609-c7eb-4ca0-97cc-5bb0ddbbbf5a');
  $records = $this
    ->fetchAllData();
  $this
    ->assertCount(1, $records, 'Data was successfully deleted.');
  $this
    ->assertEqual($data2, array_values(current($records)), 'Non targeted data preserved');
}