You are here

function ViewsArgumentDefaultTest::testArgumentDefaultFixed in Views (for Drupal 7) 7.3

Tests fixed default argument.

File

tests/views_argument_default.test, line 58
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.');
}