You are here

public function FlysystemRoutesTest::setUp in Flysystem 8

Same name and namespace in other branches
  1. 3.x tests/src/Unit/Routing/FlysystemRoutesTest.php \Drupal\Tests\flysystem\Unit\Routing\FlysystemRoutesTest::setUp()
  2. 2.0.x tests/src/Unit/Routing/FlysystemRoutesTest.php \Drupal\Tests\flysystem\Unit\Routing\FlysystemRoutesTest::setUp()
  3. 3.0.x tests/src/Unit/Routing/FlysystemRoutesTest.php \Drupal\Tests\flysystem\Unit\Routing\FlysystemRoutesTest::setUp()

Overrides UnitTestCase::setUp

File

tests/src/Unit/Routing/FlysystemRoutesTest.php, line 38

Class

FlysystemRoutesTest
@coversDefaultClass \Drupal\flysystem\Routing\FlysystemRoutes @group flysystem

Namespace

Drupal\Tests\flysystem\Unit\Routing

Code

public function setUp() {
  $container = new ContainerBuilder();
  $stream_wrapper = $this
    ->prophesize(LocalStream::class);
  $stream_wrapper
    ->getDirectoryPath()
    ->willReturn('sites/default/files');
  $stream_wrapper_manager = $this
    ->prophesize(StreamWrapperManagerInterface::class);
  $stream_wrapper_manager
    ->getViaScheme('public')
    ->willReturn($stream_wrapper
    ->reveal());
  $this->moduleHandler = $this
    ->prophesize(ModuleHandlerInterface::class);
  $factory = $this
    ->prophesize(FlysystemFactory::class);
  $factory
    ->getSchemes()
    ->willReturn([
    'test',
  ]);
  $container
    ->set('flysystem_factory', $factory
    ->reveal());
  $container
    ->set('stream_wrapper_manager', $stream_wrapper_manager
    ->reveal());
  $container
    ->set('module_handler', $this->moduleHandler
    ->reveal());
  $this->router = FlysystemRoutes::create($container);
}