You are here

public function StreamWrapperTest::testNoCustomDomain in AmazonS3 7.2

@covers \Drupal\amazons3\StreamWrapper::getExternalUrl @covers \Drupal\amazons3\StreamWrapper::injectCname

File

tests/StreamWrapperTest.php, line 517

Class

StreamWrapperTest
Tests \Drupal\amazons3\StreamWrapper.

Namespace

Drupal\amazons3Test

Code

public function testNoCustomDomain() {
  $config = StreamWrapperConfiguration::fromConfig([
    'bucket' => 'bucket.example.com',
    'region' => 'region',
    'caching' => FALSE,
  ]);
  $wrapper = new StreamWrapper($config);
  $wrapper
    ->setUri('s3://bucket.example.com/image.jpg');
  $url = Url::factory($wrapper
    ->getExternalUrl());
  $this
    ->assertEquals('s3.amazonaws.com', $url
    ->getHost());
}