UserBatchActionTest.php in Drupal 10
File
core/modules/views/tests/src/Functional/UserBatchActionTest.php
View source
<?php
namespace Drupal\Tests\views\Functional;
use Drupal\Tests\BrowserTestBase;
class UserBatchActionTest extends BrowserTestBase {
protected static $modules = [
'block',
'user',
'user_batch_action_test',
'views',
];
protected $defaultTheme = 'stark';
public function testUserAction() {
$themes = [
'classy',
'olivero',
'claro',
];
$this->container
->get('theme_installer')
->install($themes);
$this
->drupalLogin($this->rootUser);
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');
}
}
}