You are here

public function AssetManagerTest::testGetPluginInstallStatusesMissing in CKEditor Media Embed Plugin 8

Tests \Drupal\ckeditor_media_embed\AssetManager::getPluginsInstallStatuses(<version>).

File

tests/src/Unit/AssetManagerTest.php, line 45

Class

AssetManagerTest
Tests the asset manager.

Namespace

Drupal\Tests\ckeditor_media_embed\Unit

Code

public function testGetPluginInstallStatusesMissing() {
  $plugins = AssetManager::getPlugins();
  $plugin_count = count($plugins);
  $statuses = AssetManager::getPluginsInstallStatuses();
  $this
    ->assertCount($plugin_count, $statuses, 'There should be a status for each plugin.');
  $missing_plugins = array_filter($statuses, function ($is_installed) {
    return !$is_installed;
  });
  $this
    ->assertCount($plugin_count - 1, $missing_plugins, 'There should be N - 1 plugins installed.');
  $installed_plugins = array_filter($statuses);
  $this
    ->assertCount(1, $installed_plugins, 'There should only be one installed plugin.');
}