function ModuleTest::testViewsEmbedView
Same name in other branches
- 9 core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::testViewsEmbedView()
- 8.9.x core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::testViewsEmbedView()
- 11.x core/modules/views/tests/src/Kernel/ModuleTest.php \Drupal\Tests\views\Kernel\ModuleTest::testViewsEmbedView()
Tests views.module: views_embed_view().
File
-
core/
modules/ views/ tests/ src/ Kernel/ ModuleTest.php, line 249
Class
- ModuleTest
- Tests basic functions from the Views module.
Namespace
Drupal\Tests\views\KernelCode
public function testViewsEmbedView() : void {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::service('renderer');
$result = views_embed_view('test_argument');
$renderer->renderInIsolation($result);
$this->assertCount(5, $result['view_build']['#view']->result);
$result = views_embed_view('test_argument', 'default', 1);
$renderer->renderInIsolation($result);
$this->assertCount(1, $result['view_build']['#view']->result);
$result = views_embed_view('test_argument', 'default', '1,2');
$renderer->renderInIsolation($result);
$this->assertCount(2, $result['view_build']['#view']->result);
$result = views_embed_view('test_argument', 'default', '1,2', 'John');
$renderer->renderInIsolation($result);
$this->assertCount(1, $result['view_build']['#view']->result);
$result = views_embed_view('test_argument', 'default', '1,2', 'John,George');
$renderer->renderInIsolation($result);
$this->assertCount(2, $result['view_build']['#view']->result);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.