function ModuleTest::testViewsPluginList
Same name in other branches
- 9 core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::testViewsPluginList()
- 10 core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::testViewsPluginList()
- 11.x core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::testViewsPluginList()
Tests the \Drupal\views\Views::pluginList() method.
File
-
core/
modules/ views/ tests/ src/ Kernel/ ModuleTest.php, line 228
Class
- ModuleTest
- Tests basic functions from the Views module.
Namespace
Drupal\Tests\views\KernelCode
public function testViewsPluginList() {
$plugin_list = Views::pluginList();
// Only plugins used by 'test_view' should be in the plugin list.
foreach ([
'display:default',
'pager:none',
] as $key) {
list($plugin_type, $plugin_id) = explode(':', $key);
$plugin_def = $this->container
->get("plugin.manager.views.{$plugin_type}")
->getDefinition($plugin_id);
$this->assertTrue(isset($plugin_list[$key]), new FormattableMarkup('The expected @key plugin list key was found.', [
'@key' => $key,
]));
$plugin_details = $plugin_list[$key];
$this->assertEqual($plugin_details['type'], $plugin_type, 'The expected plugin type was found.');
$this->assertEqual($plugin_details['title'], $plugin_def['title'], 'The expected plugin title was found.');
$this->assertEqual($plugin_details['provider'], $plugin_def['provider'], 'The expected plugin provider was found.');
$this->assertContains('test_view', $plugin_details['views'], 'The test_view View was found in the list of views using this plugin.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.