You are here

public function StreamWrapperTest::testSaveAsExcluded in AmazonS3 7.2

@covers \Drupal\amazons3\StreamWrapper::getExternalUrl

File

tests/StreamWrapperTest.php, line 392

Class

StreamWrapperTest
Tests \Drupal\amazons3\StreamWrapper.

Namespace

Drupal\amazons3Test

Code

public function testSaveAsExcluded() {
  $config = StreamWrapperConfiguration::fromConfig([
    'bucket' => 'bucket.example.com',
    'region' => 'region',
    'caching' => FALSE,
    'expiration' => 0,
    'saveAsPaths' => new MatchablePaths(BasicPath::factory(array(
      'force-download/*',
    ))),
  ]);
  $wrapper = new StreamWrapper($config);
  $wrapper
    ->setUri('s3://bucket.example.com/test.jpg');
  $this
    ->assertEquals('https://s3.amazonaws.com/bucket.example.com/test.jpg', $wrapper
    ->getExternalUrl());
}