function ViewsModerationStateFilterTest::assertPluginStates

Same name and namespace in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::assertPluginStates()
  2. 8.9.x core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::assertPluginStates()
  3. 10 core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Kernel\ViewsModerationStateFilterTest::assertPluginStates()

Assert the plugin states.

@internal

Parameters

string[] $states: The states which should appear in the filter.

1 call to ViewsModerationStateFilterTest::assertPluginStates()
ViewsModerationStateFilterTest::testStateFilterStatesList in core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php
Tests the list of states in the filter plugin.

File

core/modules/content_moderation/tests/src/Kernel/ViewsModerationStateFilterTest.php, line 364

Class

ViewsModerationStateFilterTest
Tests the views 'moderation_state_filter' filter plugin.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function assertPluginStates(array $states) : void {
    $plugin = Views::pluginManager('filter')->createInstance('moderation_state_filter', []);
    $view = Views::getView('test_content_moderation_state_filter_base_table');
    $plugin->init($view, $view->getDisplay());
    $this->assertEquals($states, $plugin->getValueOptions());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.