protected function VueBlockDeriverTest::setUp in Decoupled Blocks: Vue.js 8
Create the setup for constants and configFactory stub.
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ Plugin/ Derivative/ VueBlockDeriverTest.php, line 40
Class
- VueBlockDeriverTest
- @coversDefaultClass \Drupal\pdb_vue\Plugin\Derivative\VueBlockDeriver @group pdb_vue
Namespace
Drupal\Tests\pdb_vue\Unit\Plugin\DerivativeCode
protected function setUp() {
parent::setUp();
// Stub the Config Factory.
$this->configFactory = $this
->getConfigFactoryStub([
'pdb_vue.settings' => [
'development_mode' => 0,
],
]);
// Mock the UUID service.
$this->componentDiscovery = $this
->prophesize(ComponentDiscoveryInterface::CLASS);
$this->componentDiscovery
->getComponents()
->willReturn([
'block_1' => (object) [
'type' => 'pdb',
'info' => [
'name' => 'Block 1',
'machine_name' => 'block_1',
'presentation' => 'vue',
],
],
'vue_example_1' => (object) [
'type' => 'pdb',
'info' => [
'name' => 'Vue Example 1',
'type' => 'vue-example-1',
'presentation' => 'vue',
],
],
]);
$this->deriver = new VueBlockDeriver($this->componentDiscovery
->reveal(), $this->configFactory);
}