public function PluginInstanceTest::testPluginData

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

File

drupal/core/modules/views/lib/Drupal/views/Tests/PluginInstanceTest.php, line 66
Definition of Drupal\views\Tests\PluginInstanceTest.

Class

PluginInstanceTest
Checks general plugin data and instances for all plugin types.

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.');
}