public function ConfigFormTest::setUp in Flysystem 8
Same name and namespace in other branches
- 3.x tests/src/Unit/Form/ConfigFormTest.php \Drupal\Tests\flysystem\Unit\Form\ConfigFormTest::setUp()
- 2.0.x tests/src/Unit/Form/ConfigFormTest.php \Drupal\Tests\flysystem\Unit\Form\ConfigFormTest::setUp()
- 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\FormCode
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);
}