3 namespace Drupal\Tests\views\Kernel\Handler;
5 use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
6 use Drupal\views\Views;
9 * Tests the view area handler.
12 * @see \Drupal\views\Plugin\views\area\View
14 class AreaViewTest extends ViewsKernelTestBase {
21 public static $modules = ['user'];
24 * Views used by this test.
28 public static $testViews = ['test_simple_argument', 'test_area_view'];
31 * Tests the view area handler.
33 public function testViewArea() {
34 /** @var \Drupal\Core\Render\RendererInterface $renderer */
35 $renderer = $this->container->get('renderer');
36 $view = Views::getView('test_area_view');
38 // Tests \Drupal\views\Plugin\views\area\View::calculateDependencies().
39 $this->assertIdentical(['config' => ['views.view.test_simple_argument'], 'module' => ['views_test_data']], $view->getDependencies());
41 $this->executeView($view);
42 $output = $view->render();
43 $output = $renderer->renderRoot($output);
44 $this->assertTrue(strpos($output, 'js-view-dom-id-' . $view->dom_id) !== FALSE, 'The test view is correctly embedded.');
47 $view->setArguments([27]);
48 $this->executeView($view);
49 $output = $view->render();
50 $output = $renderer->renderRoot($output);
51 $this->assertTrue(strpos($output, 'John') === FALSE, 'The test view is correctly embedded with inherited arguments.');
52 $this->assertTrue(strpos($output, 'George') !== FALSE, 'The test view is correctly embedded with inherited arguments.');