public function S3Test::testCreateUsingNonAwsConfigurationWithBucket in Flysystem - S3 2.0.x
Same name and namespace in other branches
- 8 tests/src/Unit/Flysystem/S3Test.php \NoDrupal\Tests\flysystem_s3\Unit\Flysystem\S3Test::testCreateUsingNonAwsConfigurationWithBucket()
File
- tests/
src/ Unit/ Flysystem/ S3Test.php, line 109
Class
- S3Test
- @coversDefaultClass \Drupal\flysystem_s3\Flysystem\S3 @covers \Drupal\flysystem_s3\Flysystem\S3 @group flysystem_s3
Namespace
NoDrupal\Tests\flysystem_s3\Unit\FlysystemCode
public function testCreateUsingNonAwsConfigurationWithBucket() {
$container = new ContainerBuilder();
$container
->set('request_stack', new RequestStack());
$container
->get('request_stack')
->push(Request::create('http://example.com/'));
$configuration = [
'key' => 'foo',
'secret' => 'bar',
'cname' => 'storage.example.com',
'cname_is_bucket' => FALSE,
'bucket' => 'my-bucket',
'endpoint' => 'https://api.somewhere.tld',
];
$plugin = S3::create($container, $configuration, '', '');
$this
->assertSame('http://storage.example.com/my-bucket/foo%201.html', $plugin
->getExternalUrl('s3://foo 1.html'));
$this
->assertSame('https://api.somewhere.tld', (string) $plugin
->getAdapter()
->getClient()
->getEndpoint());
}