You are here

public function ModuleTest::testViewsEmbedView in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/ModuleTest.php \Drupal\views\Tests\ModuleTest::testViewsEmbedView()

Tests views.module: views_embed_view().

File

core/modules/views/src/Tests/ModuleTest.php, line 274
Contains \Drupal\views\Tests\ModuleTest.

Class

ModuleTest

Namespace

Drupal\views\Tests

Code

public function testViewsEmbedView() {
  $this
    ->enableModules(array(
    'user',
  ));
  $result = views_embed_view('test_argument');
  $this
    ->assertEqual(count($result['#view']->result), 5);
  $result = views_embed_view('test_argument', 'default', 1);
  $this
    ->assertEqual(count($result['#view']->result), 1);
  $result = views_embed_view('test_argument', 'default', '1,2');
  $this
    ->assertEqual(count($result['#view']->result), 2);
  $result = views_embed_view('test_argument', 'default', '1,2', 'John');
  $this
    ->assertEqual(count($result['#view']->result), 1);
  $result = views_embed_view('test_argument', 'default', '1,2', 'John,George');
  $this
    ->assertEqual(count($result['#view']->result), 2);
}