You are here

public function FlysystemBridgeTest::setUp in Flysystem 8

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

Overrides UnitTestCase::setUp

File

tests/src/Unit/FlysystemBridgeTest.php, line 33

Class

FlysystemBridgeTest
@coversDefaultClass \Drupal\flysystem\FlysystemBridge @group flysystem

Namespace

Drupal\Tests\flysystem\Unit

Code

public function setUp() {
  parent::setUp();
  $this->bridge = new FlysystemBridge();
  $this->bridge
    ->setStringTranslation($this
    ->getStringTranslationStub());
  $this->bridge
    ->setUri('testscheme://file.txt');
  $factory = $this
    ->prophesize(FlysystemFactory::class);
  $factory
    ->getPlugin('testscheme')
    ->willReturn(new Missing());
  $this->filesystem = new Filesystem(new MissingAdapter());
  $factory
    ->getFilesystem('testscheme')
    ->willReturn($this->filesystem);
  $factory
    ->getSettings('testscheme')
    ->willReturn([
    'name' => '',
    'description' => '',
  ]);
  $container = new ContainerBuilder();
  $container
    ->set('flysystem_factory', $factory
    ->reveal());
  \Drupal::setContainer($container);
}