You are here

public function BlockStyleBaseTest::testIncludeOnly in Block Style Plugins 8

Tests the includeOnly method.

@dataProvider includeOnlyProvider

See also

::includeOnly()

File

tests/src/Unit/Plugin/BlockStyleBaseTest.php, line 398

Class

BlockStyleBaseTest
@coversDefaultClass \Drupal\block_style_plugins\Plugin\BlockStyleBase @group block_style_plugins

Namespace

Drupal\Tests\block_style_plugins\Unit\Plugin

Code

public function testIncludeOnly($plugin, $bundle, $expected) {

  // Stub the blockPlugin.
  $this
    ->setProtectedProperty('blockPlugin', $this->blockPlugin
    ->reveal());
  if ($plugin) {
    $this
      ->setProtectedProperty('pluginDefinition', [
      'include' => [
        $plugin,
      ],
    ]);
  }
  if ($bundle) {
    $this
      ->setProtectedProperty('blockContentBundle', $bundle);
  }
  $return = $this->plugin
    ->includeOnly();
  $this
    ->assertEquals($expected, $return);
}