You are here

public function ViewsFilterPluginIdSingleValueBaseFieldTest::testIntegration in Plugin 8.2

Tests the integration.

File

tests/src/Functional/ViewsFilterPluginIdSingleValueBaseFieldTest.php, line 27

Class

ViewsFilterPluginIdSingleValueBaseFieldTest
Tests the single-value base field integration of the "plugin_id" Views filter.

Namespace

Drupal\Tests\plugin\Functional

Code

public function testIntegration() {
  $entity = \Drupal::entityTypeManager()
    ->getStorage('plugin_test_svpbf')
    ->create();
  $entity
    ->save();

  // The filter class itself is tested using unit tests. Here we just assert
  // that a view using this filter does not break.

  /** @var \Drupal\views\ViewEntityInterface $view */
  $view = \Drupal::entityTypeManager()
    ->getStorage('view')
    ->load('plugin_test_svpbf');
  $view
    ->getExecutable()
    ->execute();
  $this
    ->assertCount(1, $view
    ->getExecutable()->result);
}