public function S3FileMapperTest::testMapS3File in Acquia Content Hub 8.2
@covers ::mapS3File
File
- modules/
acquia_contenthub_s3/ tests/ src/ Kernel/ S3FileMapperTest.php, line 48
Class
- S3FileMapperTest
- Tests the S3FileMapper.
Namespace
Drupal\Tests\acquia_contenthub_s3\KernelCode
public function testMapS3File() {
$file = $this
->createFileEntity('test.png', 's3');
$cdf = $this
->prophesize(CDFObject::class);
$cdf
->getAttribute(Argument::is('ach_s3_bucket'))
->willReturn($this
->createCdfAttribute('test-bucket'));
$cdf
->getAttribute(Argument::is('ach_s3_source'))
->willReturn($this
->createCdfAttribute('test-root'));
$cdf
->getOrigin()
->willReturn(\Drupal::service('uuid')
->generate());
$mapper = $this
->constructFileMapper();
$mapper
->mapS3File($cdf
->reveal(), $file);
$s3_file = $this->container
->get('acquia_contenthub_s3.file_map')
->getFileByUuid($file
->uuid());
$this
->assertEqual($s3_file->bucket, 'test-bucket');
$this
->assertEqual($s3_file->root_folder, 'test-root');
}