You are here

function ArgumentDefaultTest::testArgumentDefaultFixed in Views (for Drupal 7) 8.3

Tests fixed default argument.

File

lib/Drupal/views/Tests/Plugin/ArgumentDefaultTest.php, line 114
Definition of Drupal\views\Tests\Plugin\ArgumentDefaultTest.

Class

ArgumentDefaultTest
Basic test for pluggable argument default.

Namespace

Drupal\views\Tests\Plugin

Code

function testArgumentDefaultFixed() {
  $view = $this
    ->getView();
  $view
    ->preExecute();
  $view
    ->initHandlers();
  $this
    ->assertEqual($view->argument['null']
    ->get_default_argument(), $this->random, 'Fixed argument should be used by default.');

  // Make sure that a normal argument provided is used
  $view = $this
    ->getView();
  $random_string = $this
    ->randomString();
  $view
    ->executeDisplay('default', array(
    $random_string,
  ));
  $this
    ->assertEqual($view->args[0], $random_string, 'Provided argument should be used.');
}