class ConfigDraggableListBuilderTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/config/tests/src/Functional/ConfigDraggableListBuilderTest.php \Drupal\Tests\config\Functional\ConfigDraggableListBuilderTest
- 9 core/modules/config/tests/src/Functional/ConfigDraggableListBuilderTest.php \Drupal\Tests\config\Functional\ConfigDraggableListBuilderTest
Tests draggable list builder.
@group config
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\config\Functional\ConfigDraggableListBuilderTest
Expanded class hierarchy of ConfigDraggableListBuilderTest
File
- core/
modules/ config/ tests/ src/ Functional/ ConfigDraggableListBuilderTest.php, line 14
Namespace
Drupal\Tests\config\FunctionalView source
class ConfigDraggableListBuilderTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'config_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests draggable lists.
*/
public function testDraggableList() {
$this
->drupalLogin($this
->drupalCreateUser([
'administer permissions',
]));
// Create more than 50 roles.
for ($i = 0; $i < 51; $i++) {
$role = Role::create([
'id' => 'role_' . $i,
'label' => "Role {$i}",
]);
$role
->save();
}
// Navigate to Roles page
$this
->drupalGet('admin/people/roles');
// Test for the page title.
$this
->assertSession()
->titleEquals('Roles | Drupal');
// Count the number of rows in table.
$rows = $this
->xpath('//form[@class="user-admin-roles-form"]/table/tbody/tr');
$this
->assertGreaterThan(50, count($rows));
for ($i = 0; $i < 51; $i++) {
$this
->assertSession()
->pageTextContains("Role {$i}");
}
$role = Role::load('role_0');
$role_name = 'Role <b>0</b>';
$role
->set('label', $role_name)
->save();
$this
->drupalGet('admin/people/roles');
$this
->assertSession()
->responseContains('<td>' . Html::escape($role_name));
}
}