function UserBatchActionTest::testUserAction

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Functional/UserBatchActionTest.php \Drupal\Tests\views\Functional\UserBatchActionTest::testUserAction()
  2. 8.9.x core/modules/views/tests/src/Functional/UserBatchActionTest.php \Drupal\Tests\views\Functional\UserBatchActionTest::testUserAction()
  3. 10 core/modules/views/tests/src/Functional/UserBatchActionTest.php \Drupal\Tests\views\Functional\UserBatchActionTest::testUserAction()

Tests user admin batch.

File

core/modules/views/tests/src/Functional/UserBatchActionTest.php, line 37

Class

UserBatchActionTest
Tests the views bulk form with batch action.

Namespace

Drupal\Tests\views\Functional

Code

public function testUserAction() : void {
    $themes = [
        'stark',
        'olivero',
        'claro',
    ];
    $this->container
        ->get('theme_installer')
        ->install($themes);
    $this->drupalLogin($this->createUser([
        'administer users',
    ]));
    foreach ($themes as $theme) {
        $this->config('system.theme')
            ->set('default', $theme)
            ->save();
        $this->drupalGet('admin/people');
        $edit = [
            'user_bulk_form[0]' => TRUE,
            'action' => 'user_batch_action_test_action',
        ];
        $this->submitForm($edit, 'Apply');
        $this->assertSession()
            ->pageTextContains('One item has been processed.');
        $this->assertSession()
            ->pageTextContains($theme . ' theme used');
    }
}

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