You are here

function StreamWrapperTest::testGetValidStreamScheme in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/File/StreamWrapperTest.php \Drupal\system\Tests\File\StreamWrapperTest::testGetValidStreamScheme()

Test the scheme functions.

File

core/modules/system/src/Tests/File/StreamWrapperTest.php, line 147
Contains \Drupal\system\Tests\File\StreamWrapperTest.

Class

StreamWrapperTest
Tests stream wrapper functions.

Namespace

Drupal\system\Tests\File

Code

function testGetValidStreamScheme() {
  $this
    ->assertEqual('foo', file_uri_scheme('foo://pork//chops'), 'Got the correct scheme from foo://asdf');
  $this
    ->assertEqual('data', file_uri_scheme('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='), 'Got the correct scheme from a data URI.');
  $this
    ->assertFalse(file_uri_scheme('foo/bar.txt'), 'foo/bar.txt is not a valid stream.');
  $this
    ->assertTrue(file_stream_wrapper_valid_scheme(file_uri_scheme('public://asdf')), 'Got a valid stream scheme from public://asdf');
  $this
    ->assertFalse(file_stream_wrapper_valid_scheme(file_uri_scheme('foo://asdf')), 'Did not get a valid stream scheme from foo://asdf');
}