public function ModuleTest::testViewsPreview in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/src/Tests/ModuleTest.php \Drupal\views\Tests\ModuleTest::testViewsPreview()
Tests the \Drupal\views\ViewsExecutable::preview() method.
File
- core/
modules/ views/ src/ Tests/ ModuleTest.php, line 296 - Contains \Drupal\views\Tests\ModuleTest.
Class
Namespace
Drupal\views\TestsCode
public function testViewsPreview() {
$this
->enableModules(array(
'user',
));
$view = Views::getView('test_argument');
$result = $view
->preview('default');
$this
->assertEqual(count($result['#view']->result), 5);
$view = Views::getView('test_argument');
$result = $view
->preview('default', array(
'0' => 1,
));
$this
->assertEqual(count($result['#view']->result), 1);
$view = Views::getView('test_argument');
$result = $view
->preview('default', array(
'3' => 1,
));
$this
->assertEqual(count($result['#view']->result), 1);
$view = Views::getView('test_argument');
$result = $view
->preview('default', array(
'0' => '1,2',
));
$this
->assertEqual(count($result['#view']->result), 2);
$view = Views::getView('test_argument');
$result = $view
->preview('default', array(
'3' => '1,2',
));
$this
->assertEqual(count($result['#view']->result), 2);
$view = Views::getView('test_argument');
$result = $view
->preview('default', array(
'0' => '1,2',
'1' => 'John',
));
$this
->assertEqual(count($result['#view']->result), 1);
$view = Views::getView('test_argument');
$result = $view
->preview('default', array(
'3' => '1,2',
'4' => 'John',
));
$this
->assertEqual(count($result['#view']->result), 1);
$view = Views::getView('test_argument');
$result = $view
->preview('default', array(
'0' => '1,2',
'1' => 'John,George',
));
$this
->assertEqual(count($result['#view']->result), 2);
$view = Views::getView('test_argument');
$result = $view
->preview('default', array(
'3' => '1,2',
'4' => 'John,George',
));
$this
->assertEqual(count($result['#view']->result), 2);
}