You are here

public function PdbBlockTest::testBuild in Decoupled Blocks 8

Tests the build() method.

File

tests/src/Unit/Plugin/Block/PdbBlockTest.php, line 123

Class

PdbBlockTest
@coversDefaultClass \Drupal\pdb\Plugin\Block\PdbBlock @group pdb

Namespace

Drupal\Tests\pdb\Unit\Plugin\Block

Code

public function testBuild() {
  $expected = [
    '#attached' => [
      'drupalSettings' => [
        'pdb' => [
          'settings test',
          'webcomponents' => [],
          'configuration' => [
            'uuid' => [
              'testField' => 'test',
              'second_field' => 1,
              'formatted_field' => [
                'value' => '<p>Formatted text</p>',
              ],
            ],
          ],
          'contexts' => [
            'context_key' => 'context_value',
          ],
        ],
      ],
      'pdb/example-1/footer',
      'page_attachment',
    ],
  ];
  $return = $this->plugin
    ->build();
  $this
    ->assertEquals($expected, $return);
}