/**
  * @covers \Drupal\amazons3\StreamWrapper::getExternalUrl
  * @covers \Drupal\amazons3\StreamWrapper::usePresigned
  * @covers \Drupal\amazons3\StreamWrapper::getS3Url
  */
 public function testPresignedPath()
 {
     $config = StreamWrapperConfiguration::fromConfig(['bucket' => 'bucket.example.com', 'caching' => FALSE, 'expiration' => 0, 'presignedPaths' => new MatchablePaths(PresignedPath::factory(array('presigned/.*' => 30)))]);
     $wrapper = new StreamWrapper($config);
     $wrapper->setUri('s3://bucket.example.com/presigned/test');
     $url = Url::factory($wrapper->getExternalUrl());
     $this->assertNotNull($url->getQuery()->get('AWSAccessKeyId'));
     $this->assertNotNull($url->getQuery()->get('Signature'));
     $this->assertGreaterThanOrEqual(time(), $url->getQuery()->get('Expires'));
     // We allow a bit of fuzziness in the expiry to cover a different call to
     // time() in getExternalUrl().
     $this->assertLessThanOrEqual(time() + 32, $url->getQuery()->get('Expires'));
 }
 /**
  * Test getters and setters on PresignedPaths.
  *
  * @covers Drupal\amazons3\Matchable\PresignedPath::__construct
  * @covers Drupal\amazons3\Matchable\PresignedPath::getPath
  * @covers Drupal\amazons3\Matchable\PresignedPath::getTimeout
  */
 public function testGetters()
 {
     $p = new PresignedPath('images/.*', 30);
     $this->assertEquals('images/.*', $p->getPath());
     $this->assertEquals(30, $p->getTimeout());
 }