class UserRoleTest
Same name and namespace in other branches
- 11.x core/modules/user/tests/src/Kernel/Views/UserRoleTest.php \Drupal\Tests\user\Kernel\Views\UserRoleTest
Tests rendering when the role is numeric.
@group user
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait implements \Drupal\KernelTests\KernelTestBase
- class \Drupal\Tests\user\Kernel\Views\UserRoleTest implements \Drupal\Tests\views\Kernel\ViewsKernelTestBase
- class \Drupal\Tests\views\Kernel\ViewsKernelTestBase uses \Drupal\views\Tests\ViewResultAssertionTrait implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of UserRoleTest
File
-
core/
modules/ user/ tests/ src/ Kernel/ Views/ UserRoleTest.php, line 15
Namespace
Drupal\Tests\user\Kernel\ViewsView source
class UserRoleTest extends ViewsKernelTestBase {
/**
* Tests numeric role.
*/
public function testNumericRole() {
$this->installEntitySchema('user');
$this->installSchema('user', [
'users_data',
]);
Role::create([
'id' => 123,
'label' => 'Numeric',
])->save();
$user = User::create([
'uid' => 2,
'name' => 'foo',
'roles' => 123,
]);
$user->save();
$view = Views::getView('user_admin_people');
$this->executeView($view);
$view->render('user_admin_people');
$output = $view->field['roles_target_id']
->render($view->result[0]);
$this->assertEquals(2, $output);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.