public function AreaViewTest::testViewArea in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/Handler/AreaViewTest.php \Drupal\views\Tests\Handler\AreaViewTest::testViewArea()
Tests the view area handler.
File
- core/
modules/ views/ src/ Tests/ Handler/ AreaViewTest.php, line 38 - Contains \Drupal\views\Tests\Handler\AreaViewTest.
Class
- AreaViewTest
- Tests the view area handler.
Namespace
Drupal\views\Tests\HandlerCode
public function testViewArea() {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = $this->container
->get('renderer');
$view = Views::getView('test_area_view');
// Tests \Drupal\views\Plugin\views\area\View::calculateDependencies().
$this
->assertIdentical([
'config' => [
'views.view.test_simple_argument',
],
], $view
->getDependencies());
$this
->executeView($view);
$output = $view
->render();
$output = $renderer
->renderRoot($output);
$this
->assertTrue(strpos($output, 'js-view-dom-id-' . $view->dom_id) !== FALSE, 'The test view is correctly embedded.');
$view
->destroy();
$view
->setArguments(array(
27,
));
$this
->executeView($view);
$output = $view
->render();
$output = $renderer
->renderRoot($output);
$this
->assertTrue(strpos($output, 'John') === FALSE, 'The test view is correctly embedded with inherited arguments.');
$this
->assertTrue(strpos($output, 'George') !== FALSE, 'The test view is correctly embedded with inherited arguments.');
$view
->destroy();
}