You are here

public function ConfigFormTest::setUp in Flysystem 8

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

Overrides UnitTestCase::setUp

File

tests/src/Unit/Form/ConfigFormTest.php, line 40

Class

ConfigFormTest
@coversDefaultClass \Drupal\flysystem\Form\ConfigForm @group flysystem

Namespace

Drupal\Tests\flysystem\Unit\Form

Code

public function setUp() {
  parent::setUp();
  $this->factory = $this
    ->prophesize(FlysystemFactory::class);
  $this->factory
    ->getFilesystem('from_empty')
    ->willReturn(new Filesystem(new MemoryAdapter()));
  $this->factory
    ->getFilesystem('to_empty')
    ->willReturn(new Filesystem(new MemoryAdapter()));
  $this->factory
    ->getSchemes()
    ->willReturn([
    'from_empty',
    'to_empty',
  ]);
  $this->form = new ConfigForm($this->factory
    ->reveal());
  $this->form
    ->setStringTranslation($this
    ->getStringTranslationStub());
  $container = new ContainerBuilder();
  $container
    ->set('string_translation', $this
    ->getStringTranslationStub());
  $container
    ->set('flysystem_factory', $this->factory
    ->reveal());
  $logger = $this
    ->prophesize(LoggerChannelFactoryInterface::class);
  $logger
    ->get('flysystem')
    ->willReturn($this
    ->prophesize(LoggerInterface::class)
    ->reveal());
  $container
    ->set('logger.factory', $logger
    ->reveal());
  \Drupal::setContainer($container);
}