public function StreamWrapperTest::testCustomDomain in AmazonS3 7.2
@covers \Drupal\amazons3\StreamWrapper::getExternalUrl @covers \Drupal\amazons3\StreamWrapper::injectCname @covers \Drupal\amazons3\StreamWrapper::getS3Url
File
- tests/
StreamWrapperTest.php, line 499
Class
Namespace
Drupal\amazons3TestCode
public function testCustomDomain() {
$config = StreamWrapperConfiguration::fromConfig([
'bucket' => 'bucket.example.com',
'region' => 'region',
'domain' => 'static.example.com',
'caching' => FALSE,
'expiration' => 0,
]);
$wrapper = new StreamWrapper($config);
$wrapper
->setUri('s3://bucket.example.com/image.jpg');
$url = Url::factory($wrapper
->getExternalUrl());
$this
->assertEquals('static.example.com', $url
->getHost());
}