You are here

public function ModuleTest::testViewsPluginList in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/ModuleTest.php \Drupal\views\Tests\ModuleTest::testViewsPluginList()

Tests the \Drupal\views\Views::pluginList() method.

File

core/modules/views/src/Tests/ModuleTest.php, line 254
Contains \Drupal\views\Tests\ModuleTest.

Class

ModuleTest

Namespace

Drupal\views\Tests

Code

public function testViewsPluginList() {
  $plugin_list = Views::pluginList();

  // Only plugins used by 'test_view' should be in the plugin list.
  foreach (array(
    '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]), SafeMarkup::format('The expected @key plugin list key was found.', array(
      '@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
      ->assertTrue(in_array('test_view', $plugin_details['views']), 'The test_view View was found in the list of views using this plugin.');
  }
}