function ViewsFormAlterTest::testViewsFormAlter

Same name in other branches
  1. 9 core/modules/views/tests/src/Functional/ViewsFormAlterTest.php \Drupal\Tests\views\Functional\ViewsFormAlterTest::testViewsFormAlter()
  2. 11.x core/modules/views/tests/src/Functional/ViewsFormAlterTest.php \Drupal\Tests\views\Functional\ViewsFormAlterTest::testViewsFormAlter()

Tests hook_form_BASE_FORM_ID_alter for a ViewsForm.

File

core/modules/views/tests/src/Functional/ViewsFormAlterTest.php, line 27

Class

ViewsFormAlterTest
Tests hook_form_BASE_FORM_ID_alter for a ViewsForm.

Namespace

Drupal\Tests\views\Functional

Code

public function testViewsFormAlter() : void {
    $this->drupalLogin($this->createUser([
        'access media overview',
    ]));
    $this->drupalGet('admin/content/media');
    $count = $this->container
        ->get('state')
        ->get('hook_form_BASE_FORM_ID_alter_count');
    $this->assertEquals(1, $count, 'hook_form_BASE_FORM_ID_alter was invoked only once');
}

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