public function S3Test::test in Flysystem - S3 8
Same name and namespace in other branches
- 2.0.x tests/src/Unit/Flysystem/S3Test.php \NoDrupal\Tests\flysystem_s3\Unit\Flysystem\S3Test::test()
File
- tests/
src/ Unit/ Flysystem/ S3Test.php, line 26
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 test() {
$configuration = [
'bucket' => 'example-bucket',
'prefix' => 'test prefix',
'cname' => 'example.com',
];
$client = new S3Client([
'version' => 'latest',
'region' => 'beep',
'credentials' => new Credentials('fsdf', 'sfsdf'),
]);
$plugin = new S3($client, new Config($configuration));
$this
->assertInstanceOf(AdapterInterface::class, $plugin
->getAdapter());
$this
->assertSame('http://example.com/test%20prefix/foo%201.html', $plugin
->getExternalUrl('s3://foo 1.html'));
$configuration['prefix'] = '';
$plugin = new S3($client, new Config($configuration));
$this
->assertSame('http://example.com/foo%201.html', $plugin
->getExternalUrl('s3://foo 1.html'));
}