diff --git a/lib/Drupal/views/Tests/PluginInstanceTest.php b/lib/Drupal/views/Tests/PluginInstanceTest.php index b918772..548a58c 100644 --- a/lib/Drupal/views/Tests/PluginInstanceTest.php +++ b/lib/Drupal/views/Tests/PluginInstanceTest.php @@ -8,6 +8,10 @@ namespace Drupal\views\Tests; use ReflectionClass; +use Drupal\views\ViewExecutable; +use Drupal\views\Plugin\Type\PluginManager; +use Drupal\views\Plugin\Type\JoinManager; +use Drupal\views\Plugin\Type\WizardManager; /** * Checks general plugin data and instances for all plugin types. @@ -19,27 +23,7 @@ class PluginInstanceTest extends ViewTestBase { * * @var array */ - protected $pluginTypes = array( - 'access', - 'area', - 'argument', - 'argument_default', - 'argument_validator', - 'cache', - 'display_extender', - 'display', - 'exposed_form', - 'field', - 'filter', - 'join', - 'pager', - 'query', - 'relationship', - 'row', - 'sort', - 'style', - 'wizard', - ); + protected $pluginTypes; /** * An array of plugin definitions, keyed by plugin type. @@ -60,6 +44,7 @@ class PluginInstanceTest extends ViewTestBase { parent::setUp(); $this->definitions = views_get_plugin_definitions(); + $this->pluginTypes = ViewExecutable::getPluginTypes(); } /** @@ -86,7 +71,8 @@ class PluginInstanceTest extends ViewTestBase { * This will iterate through all plugins from _views_fetch_plugin_data(). */ public function testPluginInstances() { - $container = drupal_container(); + //Inject a rebuild container for testing. + $container = drupal_container(NULL, TRUE); foreach ($this->definitions as $type => $plugins) { // Get a plugin manager for this type. $manager = $container->get("plugin.manager.views.$type"); @@ -105,4 +91,25 @@ class PluginInstanceTest extends ViewTestBase { } } + /** + * Tests the views bundle after clearing all caches. + */ + public function testClearCache() { + drupal_flush_all_caches(); + $container = drupal_container(); + foreach ($this->pluginTypes as $type) { + // Get a plugin manager for this type. + $manager = $container->get("plugin.manager.views.$type"); + //See two special cases. join and wizard + if ($type == 'join') { + $this->assertTrue($manager instanceof JoinManager, $type); + } + elseif ($type == 'wizard') { + $this->assertTrue($manager instanceof WizardManager, $type); + } + else { + $this->assertTrue($manager instanceof PluginManager, $type); + } + } + } }