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

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

File

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

Class

ViewsArgumentDefaultTest
Basic test for pluggable argument default.

Code

function testArgumentDefaultNoOptions() {
  module_enable(array('views_ui', 'views_test'));
  $admin_user = $this->backdropCreateUser(array('administer views', 'administer site configuration'));
  $this->backdropLogin($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->backdropPost('admin/structure/views/nojs/config-item/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->options_validate()',
  );
  $message = t('%type: !message in %function', $error);
  $this->assertNoRaw($message, t('Did not find error message: !message.', array('!message' => $message)));
}