function ArgumentDefaultTest::testArgumentDefaultNoOptions

Same name in other branches
  1. 9 core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php \Drupal\Tests\views\Functional\Plugin\ArgumentDefaultTest::testArgumentDefaultNoOptions()
  2. 8.9.x core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php \Drupal\Tests\views\Functional\Plugin\ArgumentDefaultTest::testArgumentDefaultNoOptions()
  3. 11.x core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php \Drupal\Tests\views\Functional\Plugin\ArgumentDefaultTest::testArgumentDefaultNoOptions()

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

File

core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php, line 97

Class

ArgumentDefaultTest
Tests pluggable argument_default for views.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

public function testArgumentDefaultNoOptions() : void {
    $admin_user = $this->drupalCreateUser([
        '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 = [
        'options[default_argument_type]' => $argument_type,
    ];
    $this->drupalGet('admin/structure/views/nojs/handler/test_argument_default_current_user/default/argument/uid');
    $this->submitForm($edit, 'Apply');
    // Note, the undefined index error has two spaces after it.
    $this->assertSession()
        ->pageTextNotContains("Notice: Undefined index:  {$argument_type} in views_handler_argument->validateOptionsForm()");
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.