You are here

public function VueBlockTest::testBuild in Decoupled Blocks: Vue.js 8

Tests the build() method.

File

tests/src/Unit/Plugin/Block/VueBlockTest.php, line 104

Class

VueBlockTest
@coversDefaultClass \Drupal\pdb_vue\Plugin\Block\VueBlock @group pdb_vue

Namespace

Drupal\Tests\pdb_vue\Unit\Plugin\Block

Code

public function testBuild() {
  $expected = [
    '#allowed_tags' => [
      'vue-example-1',
    ],
    '#markup' => '<vue-example-1 test-field="test" :second_field="1" instance-id="uuid"></vue-example-1>',
    '#attached' => [
      'drupalSettings' => [
        'pdbVue' => [
          'developmentMode' => 1,
          'spaElement' => '#page-wrapper',
        ],
        'pdb' => [
          'configuration' => [
            'uuid' => [
              'testField' => 'test',
              'second_field' => 1,
            ],
          ],
        ],
      ],
      'library' => [
        'pdb_vue/vue.spa-init',
      ],
    ],
  ];
  $return = $this->plugin
    ->build();
  $this
    ->assertArrayEquals($expected, $return);
}