function AccessTest::testStaticAccessPlugin in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Plugin/AccessTest.php \Drupal\views\Tests\Plugin\AccessTest::testStaticAccessPlugin()
Tests static access check.
See also
\Drupal\views_test\Plugin\views\access\StaticTest
File
- core/
modules/ views/ src/ Tests/ Plugin/ AccessTest.php, line 86 - Contains \Drupal\views\Tests\Plugin\AccessTest.
Class
- AccessTest
- Tests pluggable access for views.
Namespace
Drupal\views\Tests\PluginCode
function testStaticAccessPlugin() {
$view = Views::getView('test_access_static');
$view
->setDisplay();
$access_plugin = $view->display_handler
->getPlugin('access');
$this
->assertFalse($access_plugin
->access($this->normalUser));
$this
->drupalGet('test_access_static');
$this
->assertResponse(403);
$display =& $view->storage
->getDisplay('default');
$display['display_options']['access']['options']['access'] = TRUE;
$access_plugin->options['access'] = TRUE;
$view
->save();
// Saving a view will cause the router to be rebuilt when the kernel
// termination event fires. Simulate that here.
$this->container
->get('router.builder')
->rebuildIfNeeded();
$this
->assertTrue($access_plugin
->access($this->normalUser));
$this
->drupalGet('test_access_static');
$this
->assertResponse(200);
}