/**
  * Tests derivative creation with several source on a local writable stream.
  *
  * @dataProvider providerTestCustomStreamWrappers
  *
  * @param string $source_scheme
  *   The source stream wrapper scheme.
  * @param string $expected_scheme
  *   The derivative expected stream wrapper scheme.
  */
 public function testCustomStreamWrappers($source_scheme, $expected_scheme)
 {
     $derivative_uri = $this->imageStyle->buildUri("{$source_scheme}://some/path/image.png");
     $derivative_scheme = $this->fileSystem->uriScheme($derivative_uri);
     // Check that the derivative scheme is the expected scheme.
     $this->assertSame($expected_scheme, $derivative_scheme);
     // Check that the derivative URI is the expected one.
     $expected_uri = "{$expected_scheme}://styles/{$this->imageStyle->id()}/{$source_scheme}/some/path/image.png";
     $this->assertSame($expected_uri, $derivative_uri);
 }
예제 #2
0
 /**
  * Determines if the given URI or path is considered local.
  *
  * A URI or path is considered local if it either has no scheme component,
  * or the scheme is implemented by a stream wrapper which extends
  * \Drupal\Core\StreamWrapper\LocalStream.
  *
  * @param string $uri
  *   The URI or path to test.
  *
  * @return bool
  */
 protected function isLocalUri($uri)
 {
     $scheme = $this->fileSystem->uriScheme($uri);
     // The vfs scheme is vfsStream, which is used in testing. vfsStream is a
     // simulated file system that exists only in memory, but should be treated
     // as a local resource.
     if ($scheme == 'vfs') {
         $scheme = FALSE;
     }
     return $scheme === FALSE || $this->streamWrapperManager->getViaScheme($scheme) instanceof LocalStream;
 }
예제 #3
0
 /**
  * Determines if the given URI or path is considered local.
  *
  * A URI or path is considered local if it either has no scheme component,
  * or the scheme is implemented by a stream wrapper which extends
  * \Drupal\Core\StreamWrapper\LocalStream.
  *
  * @param string $uri
  *   The URI or path to test.
  *
  * @return bool
  */
 protected function isLocalUri($uri)
 {
     $scheme = $this->fileSystem->uriScheme($uri);
     return $scheme === FALSE || $this->streamWrapperManager->getViaScheme($scheme) instanceof LocalStream;
 }