public function RoleAccessCheckTest::roleAccessProvider in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Route/RoleAccessCheckTest.php \Drupal\Tests\Core\Route\RoleAccessCheckTest::roleAccessProvider()
Provides data for the role access test.
See also
\Drupal\Tests\Core\Route\RouterRoleTest::testRoleAccess
File
- core/
tests/ Drupal/ Tests/ Core/ Route/ RoleAccessCheckTest.php, line 93 - Contains \Drupal\Tests\Core\Route\RoleAccessCheckTest.
Class
- RoleAccessCheckTest
- @coversDefaultClass \Drupal\user\Access\RoleAccessCheck @group Access @group Route
Namespace
Drupal\Tests\Core\RouteCode
public function roleAccessProvider() {
// Setup two different roles used in the test.
$rid_1 = 'role_test_1';
$rid_2 = 'role_test_2';
// Setup one user with the first role, one with the second, one with both
// and one final without any of these two roles.
$account_1 = new UserSession(array(
'uid' => 1,
'roles' => array(
$rid_1,
),
));
$account_2 = new UserSession(array(
'uid' => 2,
'roles' => array(
$rid_2,
),
));
$account_12 = new UserSession(array(
'uid' => 3,
'roles' => array(
$rid_1,
$rid_2,
),
));
$account_none = new UserSession(array(
'uid' => 1,
'roles' => array(),
));
// Setup expected values; specify which paths can be accessed by which user.
return array(
array(
'role_test_1',
array(
$account_1,
$account_12,
),
array(
$account_2,
$account_none,
),
),
array(
'role_test_2',
array(
$account_2,
$account_12,
),
array(
$account_1,
$account_none,
),
),
array(
'role_test_3',
array(
$account_12,
),
array(
$account_1,
$account_2,
$account_none,
),
),
array(
'role_test_4',
array(
$account_12,
),
array(
$account_1,
$account_2,
$account_none,
),
),
array(
'role_test_5',
array(
$account_1,
$account_2,
$account_12,
),
array(),
),
array(
'role_test_6',
array(
$account_1,
$account_2,
$account_12,
),
array(),
),
);
}