You are here

public function StreamWrapperTest::testSaveAsAll in AmazonS3 7.2

@covers \Drupal\amazons3\StreamWrapper::getExternalUrl @covers \Drupal\amazons3\StreamWrapper::getContentDispositionAttachment @covers \Drupal\amazons3\StreamWrapper::forceDownload @covers \Drupal\amazons3\StreamWrapper::getS3Url

File

tests/StreamWrapperTest.php, line 412

Class

StreamWrapperTest
Tests \Drupal\amazons3\StreamWrapper.

Namespace

Drupal\amazons3Test

Code

public function testSaveAsAll() {
  $config = StreamWrapperConfiguration::fromConfig([
    'bucket' => 'bucket.example.com',
    'region' => 'region',
    'caching' => FALSE,
    'expiration' => 0,
    'saveAsPaths' => new MatchablePaths(BasicPath::factory(array(
      '*',
    ))),
  ]);
  $wrapper = new StreamWrapper($config);
  $wrapper
    ->setUri('s3://bucket.example.com/test.jpg');
  $this
    ->assertRegExp('!.*response-content-disposition=attachment%3B%20filename%3D%22test\\.jpg.*!', $wrapper
    ->getExternalUrl());
}