You are here

function ArgumentDefaultTest::testArgumentDefaultNoOptions in Zircon Profile 8

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

Tests the use of a default argument plugin that provides no options.

File

core/modules/views/src/Tests/Plugin/ArgumentDefaultTest.php, line 83
Contains \Drupal\views\Tests\Plugin\ArgumentDefaultTest.

Class

ArgumentDefaultTest
Tests pluggable argument_default for views.

Namespace

Drupal\views\Tests\Plugin

Code

function testArgumentDefaultNoOptions() {
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer views',
    'administer site configuration',
  ));
  $this
    ->drupalLogin($admin_user);

  // The current_user plugin has no options form, and should pass validation.
  $argument_type = 'current_user';
  $edit = array(
    'options[default_argument_type]' => $argument_type,
  );
  $this
    ->drupalPostForm('admin/structure/views/nojs/handler/test_argument_default_current_user/default/argument/uid', $edit, t('Apply'));

  // Note, the undefined index error has two spaces after it.
  $error = array(
    '%type' => 'Notice',
    '@message' => 'Undefined index:  ' . $argument_type,
    '%function' => 'views_handler_argument->validateOptionsForm()',
  );
  $message = t('%type: @message in %function', $error);
  $this
    ->assertNoRaw($message, format_string('Did not find error message: @message.', array(
    '@message' => $message,
  )));
}