1.20.x views_argument_default.test ViewsArgumentDefaultTest::testArgumentDefaultFixed()

Tests fixed default argument.

File

modules/views/tests/views_argument_default.test, line 48
Definition of ViewsArgumentDefaultTest.

Class

ViewsArgumentDefaultTest
Basic test for pluggable argument default.

Code

function testArgumentDefaultFixed() {
  $view = $this->view_argument_default_fixed();

  $view->set_display('default');
  $view->pre_execute();
  $view->init_handlers();

  $this->assertEqual($view->argument['null']->get_default_argument(), $this->random, 'Fixed argument should be used by default.');

  $view->destroy();

  // Make sure that a normal argument provided is used
  $view = $this->view_argument_default_fixed();

  $view->set_display('default');
  $random_string = $this->randomString();
  $view->execute_display('default', array($random_string));

  $this->assertEqual($view->args[0], $random_string, 'Provided argument should be used.');
}