StreamWrapperManagerTest.php

Same filename and directory in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/StreamWrapper/StreamWrapperManagerTest.php
  2. 10 core/tests/Drupal/KernelTests/Core/StreamWrapper/StreamWrapperManagerTest.php
  3. 9 core/tests/Drupal/KernelTests/Core/StreamWrapper/StreamWrapperManagerTest.php
  4. 8.9.x core/tests/Drupal/KernelTests/Core/StreamWrapper/StreamWrapperManagerTest.php

Namespace

Drupal\KernelTests\Core\StreamWrapper

File

core/tests/Drupal/KernelTests/Core/StreamWrapper/StreamWrapperManagerTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\KernelTests\Core\StreamWrapper;

use Drupal\Core\StreamWrapper\StreamWrapperManager;
use Drupal\KernelTests\KernelTestBase;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;

/**
 * Tests Drupal\Core\StreamWrapper\StreamWrapperManager.
 */
class StreamWrapperManagerTest extends KernelTestBase {
  
  /**
   * The stream wrapper manager.
   *
   * @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface
   */
  protected $streamWrapperManager;
  
  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    $this->streamWrapperManager = \Drupal::service('stream_wrapper_manager');
  }
  
  /**
   * Tests uri scheme.
   *
   * @legacy-covers ::getScheme
   */
  public function testUriScheme($uri, $expected) : void {
    $this->assertSame($expected, StreamWrapperManager::getScheme($uri));
  }
  
  /**
   * Data provider.
   */
  public static function providerTestUriScheme() : array {
    $data = [];
    $data[] = [
      'public://filename',
      'public',
    ];
    $data[] = [
      'public://extra://',
      'public',
    ];
    $data[] = [
      'invalid',
      FALSE,
    ];
    return $data;
  }

}

Classes

Title Deprecated Summary
StreamWrapperManagerTest Tests Drupal\Core\StreamWrapper\StreamWrapperManager.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.