You are here

public function S3Test::testCreateUsingNonAwsConfiguration in Flysystem - S3 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Unit/Flysystem/S3Test.php \NoDrupal\Tests\flysystem_s3\Unit\Flysystem\S3Test::testCreateUsingNonAwsConfiguration()

File

tests/src/Unit/Flysystem/S3Test.php, line 91

Class

S3Test
@coversDefaultClass \Drupal\flysystem_s3\Flysystem\S3 @covers \Drupal\flysystem_s3\Flysystem\S3 @group flysystem_s3

Namespace

NoDrupal\Tests\flysystem_s3\Unit\Flysystem

Code

public function testCreateUsingNonAwsConfiguration() {
  $container = new ContainerBuilder();
  $container
    ->set('request_stack', new RequestStack());
  $container
    ->get('request_stack')
    ->push(Request::create('https://example.com/'));
  $configuration = [
    'key' => 'fee',
    'secret' => 'fo',
    'region' => 'eu-west-1',
    'cname' => 'something.somewhere.tld',
    'endpoint' => 'https://api.somewhere.tld',
  ];
  $plugin = S3::create($container, $configuration, '', '');
  $this
    ->assertSame('https://something.somewhere.tld/foo%201.html', $plugin
    ->getExternalUrl('s3://foo 1.html'));
  $this
    ->assertSame('https://api.somewhere.tld', (string) $plugin
    ->getAdapter()
    ->getClient()
    ->getEndpoint());
}