protected function VueFormTest::setUp in Decoupled Blocks: Vue.js 8
Create the setup for constants and configFactory stub.
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ Form/ VueFormTest.php, line 39
Class
- VueFormTest
- @coversDefaultClass \Drupal\pdb_vue\Form\VueForm @group pdb_vue
Namespace
Drupal\Tests\pdb_vue\Unit\FormCode
protected function setUp() {
parent::setUp();
// Stub the Config Factory.
$this->configFactory = $this
->getConfigFactoryStub([
'pdb_vue.settings' => [
'version' => 'vue2',
'development_mode' => 0,
'use_spa' => 0,
'spa_element' => '#element',
],
]);
// Mock the formState.
$this->formState = $this
->createMock(FormStateInterface::CLASS);
$this->form = new VueForm($this->configFactory);
// Create a translation stub for the t() method.
$translator = $this
->getStringTranslationStub();
$this->form
->setStringTranslation($translator);
}