You are here

public function ExtensionStreamTest::testInvalidStreamUri in System stream wrapper 8

Tests invalid stream uris.

@dataProvider providerInvalidUris

Parameters

string $uri: The URI being tested.

File

tests/src/Kernel/File/ExtensionStreamTest.php, line 63

Class

ExtensionStreamTest
Tests system stream wrapper functions.

Namespace

Drupal\Tests\system_stream_wrapper\Kernel\File

Code

public function testInvalidStreamUri($uri) {

  // Set 'minimal' as installed profile for the purposes of this test.
  $this
    ->setInstallProfile('minimal');
  $this
    ->enableModules([
    'minimal',
  ]);
  $message = "\\InvalidArgumentException thrown on invalid uri {$uri}.";
  try {
    $this->streamWrappers['module']
      ->dirname($uri);
    $this
      ->fail($message);
  } catch (\InvalidArgumentException $e) {
    $this
      ->assertSame($e
      ->getMessage(), "Malformed uri parameter passed: {$uri}", $message);
  }
}