You are here

public function PluginInstanceTest::testPluginData in Zircon Profile 8

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

Confirms that there is plugin data for all views plugin types.

File

core/modules/views/src/Tests/PluginInstanceTest.php, line 62
Contains \Drupal\views\Tests\PluginInstanceTest.

Class

PluginInstanceTest
Tests that an instance of all views plugins can be created.

Namespace

Drupal\views\Tests

Code

public function testPluginData() {

  // Check that we have an array of data.
  $this
    ->assertTrue(is_array($this->definitions), 'Plugin data is an array.');

  // Check all plugin types.
  foreach ($this->pluginTypes as $type) {
    $this
      ->assertTrue(array_key_exists($type, $this->definitions), format_string('Key for plugin type @type found.', array(
      '@type' => $type,
    )));
    $this
      ->assertTrue(is_array($this->definitions[$type]) && !empty($this->definitions[$type]), format_string('Plugin type @type has an array of plugins.', array(
      '@type' => $type,
    )));
  }

  // Tests that the plugin list has not missed any types.
  $diff = array_diff(array_keys($this->definitions), $this->pluginTypes);
  $this
    ->assertTrue(empty($diff), 'All plugins were found and matched.');
}