You are here

public function StreamWrapperTest::testTorrentPath in AmazonS3 7.2

Test that we can create torrent URLs.

@covers \Drupal\amazons3\StreamWrapper::getExternalUrl @covers \Drupal\amazons3\StreamWrapper::useTorrent @covers \Drupal\amazons3\StreamWrapper::getS3Url

File

tests/StreamWrapperTest.php, line 453

Class

StreamWrapperTest
Tests \Drupal\amazons3\StreamWrapper.

Namespace

Drupal\amazons3Test

Code

public function testTorrentPath() {
  $config = StreamWrapperConfiguration::fromConfig([
    'bucket' => 'bucket.example.com',
    'region' => 'region',
    'caching' => FALSE,
    'expiration' => 0,
    'torrentPaths' => new MatchablePaths(BasicPath::factory(array(
      'torrents/.*',
    ))),
  ]);
  $wrapper = new StreamWrapper($config);
  $wrapper
    ->setUri('s3://bucket.example.com/torrents/test');
  $this
    ->assertEquals('https://s3.amazonaws.com/bucket.example.com/torrents/test%3Ftorrent', $wrapper
    ->getExternalUrl());
}