You are here

public function VueBlockDeriverTest::testGetDerivativeDefinitions in Decoupled Blocks: Vue.js 8

Tests the getDerivativeDefinitions() method.

File

tests/src/Unit/Plugin/Derivative/VueBlockDeriverTest.php, line 100

Class

VueBlockDeriverTest
@coversDefaultClass \Drupal\pdb_vue\Plugin\Derivative\VueBlockDeriver @group pdb_vue

Namespace

Drupal\Tests\pdb_vue\Unit\Plugin\Derivative

Code

public function testGetDerivativeDefinitions() {
  $base_plugin_definition = [
    'provider' => 'pdb_vue',
  ];

  // vue_example_1 should not appear due to debug mode being off.
  $expected = [
    'block_1' => [
      'info' => [
        'name' => 'Block 1',
        'machine_name' => 'block_1',
        'presentation' => 'vue',
      ],
      'provider' => 'pdb_vue',
      'admin_label' => 'Block 1',
      'cache' => [
        'max-age' => 0,
      ],
    ],
  ];
  $return = $this->deriver
    ->getDerivativeDefinitions($base_plugin_definition);
  $this
    ->assertArrayEquals($expected, $return);
}