public function DisplayTest::testInvalidDisplayPlugins in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Plugin/DisplayTest.php \Drupal\views\Tests\Plugin\DisplayTest::testInvalidDisplayPlugins()
Tests invalid display plugins.
File
- core/
modules/ views/ src/ Tests/ Plugin/ DisplayTest.php, line 266 - Contains \Drupal\views\Tests\Plugin\DisplayTest.
Class
- DisplayTest
- Tests the basic display plugin.
Namespace
Drupal\views\Tests\PluginCode
public function testInvalidDisplayPlugins() {
$this
->drupalGet('test_display_invalid');
$this
->assertResponse(200);
// Change the page plugin id to an invalid one. Bypass the entity system
// so no menu rebuild was executed (so the path is still available).
$config = $this
->config('views.view.test_display_invalid');
$config
->set('display.page_1.display_plugin', 'invalid');
$config
->save();
$this
->drupalGet('test_display_invalid');
$this
->assertResponse(200);
$this
->assertText('The "invalid" plugin does not exist.');
// Rebuild the router, and ensure that the path is not accessible anymore.
views_invalidate_cache();
\Drupal::service('router.builder')
->rebuildIfNeeded();
$this
->drupalGet('test_display_invalid');
$this
->assertResponse(404);
// Change the display plugin ID back to the correct ID.
$config = $this
->config('views.view.test_display_invalid');
$config
->set('display.page_1.display_plugin', 'page');
$config
->save();
// Place the block display.
$block = $this
->drupalPlaceBlock('views_block:test_display_invalid-block_1', array(), array(
'title' => 'Invalid display',
));
$this
->drupalGet('<front>');
$this
->assertResponse(200);
$this
->assertBlockAppears($block);
// Change the block plugin ID to an invalid one.
$config = $this
->config('views.view.test_display_invalid');
$config
->set('display.block_1.display_plugin', 'invalid');
$config
->save();
// Test the page is still displayed, the block not present, and has the
// plugin warning message.
$this
->drupalGet('<front>');
$this
->assertResponse(200);
$this
->assertText('The "invalid" plugin does not exist.');
$this
->assertNoBlockAppears($block);
}