class ChainGroupPermissionCalculatorTest in Group 2.0.x
Same name and namespace in other branches
- 8 tests/src/Kernel/ChainGroupPermissionCalculatorTest.php \Drupal\Tests\group\Kernel\ChainGroupPermissionCalculatorTest
Tests the calculation of group permissions.
This also inherently tests the following calculators:
- \Drupal\group\Access\DefaultGroupPermissionCalculator
- \Drupal\group\Access\SynchronizedGroupPermissionCalculator
@todo Individually test the above calculators?
@coversDefaultClass \Drupal\group\Access\ChainGroupPermissionCalculator @group group
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, AssertLegacyTrait, ConfigTestTrait, ExtensionListTestTrait, PhpUnitCompatibilityTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\KernelTests\Core\Entity\EntityKernelTestBase uses UserCreationTrait
- class \Drupal\Tests\group\Kernel\GroupKernelTestBase
- class \Drupal\Tests\group\Kernel\ChainGroupPermissionCalculatorTest
- class \Drupal\Tests\group\Kernel\GroupKernelTestBase
- class \Drupal\KernelTests\Core\Entity\EntityKernelTestBase uses UserCreationTrait
Expanded class hierarchy of ChainGroupPermissionCalculatorTest
File
- tests/
src/ Kernel/ ChainGroupPermissionCalculatorTest.php, line 23
Namespace
Drupal\Tests\group\KernelView source
class ChainGroupPermissionCalculatorTest extends GroupKernelTestBase {
/**
* The group permissions hash generator service.
*
* @var \Drupal\group\Access\ChainGroupPermissionCalculatorInterface
*/
protected $permissionCalculator;
/**
* The group role synchronizer service.
*
* @var \Drupal\group\GroupRoleSynchronizer
*/
protected $roleSynchronizer;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->permissionCalculator = $this->container
->get('group_permission.chain_calculator');
$this->roleSynchronizer = $this->container
->get('group_role.synchronizer');
}
/**
* Tests the calculation of the anonymous permissions.
*
* @covers ::calculateAnonymousPermissions
*/
public function testCalculateAnonymousPermissions() {
// @todo Use a proper set-up instead of the one from GroupKernelTestBase?
$permissions = [
'default' => [],
'other' => [],
];
$cache_tags = [
'config:group.role.default-anonymous',
'config:group.role.other-anonymous',
'config:group_type_list',
'group_permissions',
];
sort($cache_tags);
$calculated_permissions = $this->permissionCalculator
->calculateAnonymousPermissions();
$converted = $this
->convertCalculatedPermissionsToArray($calculated_permissions);
$this
->assertEqualsCanonicalizing($permissions, $converted, 'Anonymous permissions are returned per group type.');
$this
->assertSame([], $calculated_permissions
->getCacheContexts(), 'Anonymous permissions have the right cache contexts.');
$this
->assertSame(-1, $calculated_permissions
->getCacheMaxAge(), 'Anonymous permissions have the right max cache age.');
$this
->assertEqualsCanonicalizing($cache_tags, $calculated_permissions
->getCacheTags(), 'Anonymous permissions have the right cache tags.');
$group_role = $this->entityTypeManager
->getStorage('group_role')
->load('default-anonymous');
$group_role
->grantPermission('view group')
->save();
$permissions['default'][] = 'view group';
$calculated_permissions = $this->permissionCalculator
->calculateAnonymousPermissions();
$converted = $this
->convertCalculatedPermissionsToArray($calculated_permissions);
$this
->assertEqualsCanonicalizing($permissions, $converted, 'Updated anonymous permissions are returned per group type.');
$this
->assertSame([], $calculated_permissions
->getCacheContexts(), 'Updated anonymous permissions have the right cache contexts.');
$this
->assertSame(-1, $calculated_permissions
->getCacheMaxAge(), 'Updated anonymous permissions have the right max cache age.');
$this
->assertEqualsCanonicalizing($cache_tags, $calculated_permissions
->getCacheTags(), 'Updated anonymous permissions have the right cache tags.');
$this
->createGroupType([
'id' => 'test',
]);
$permissions['test'] = [];
$cache_tags[] = 'config:group.role.test-anonymous';
sort($cache_tags);
$calculated_permissions = $this->permissionCalculator
->calculateAnonymousPermissions();
$converted = $this
->convertCalculatedPermissionsToArray($calculated_permissions);
$this
->assertEqualsCanonicalizing($permissions, $converted, 'Anonymous permissions are updated after introducing a new group type.');
$this
->assertSame([], $calculated_permissions
->getCacheContexts(), 'Anonymous permissions have the right cache contexts after introducing a new group type.');
$this
->assertSame(-1, $calculated_permissions
->getCacheMaxAge(), 'Anonymous permissions have the right max cache age after introducing a new group type.');
$this
->assertEqualsCanonicalizing($cache_tags, $calculated_permissions
->getCacheTags(), 'Anonymous permissions have the right cache tags after introducing a new group type.');
}
/**
* Tests the calculation of the outsider permissions.
*
* @covers ::calculateOutsiderPermissions
*/
public function testCalculateOutsiderPermissions() {
// @todo Use a proper set-up instead of the one from GroupKernelTestBase?
$account = $this
->createUser([
'roles' => [
'test',
],
]);
$group_role_id = $this->roleSynchronizer
->getGroupRoleId('default', 'test');
$permissions = [
'default' => [
'join group',
'view group',
],
'other' => [],
];
$cache_tags = [
'config:group.role.default-outsider',
'config:group.role.other-outsider',
'config:group.role.' . $group_role_id,
'config:group.role.' . $this->roleSynchronizer
->getGroupRoleId('other', 'test'),
'config:group_type_list',
'group_permissions',
];
sort($cache_tags);
$calculated_permissions = $this->permissionCalculator
->calculateOutsiderPermissions($account);
$converted = $this
->convertCalculatedPermissionsToArray($calculated_permissions);
$this
->assertEqualsCanonicalizing($permissions, $converted, 'Outsider permissions are returned per group type.');
$this
->assertSame(-1, $calculated_permissions
->getCacheMaxAge(), 'Outsider permissions have the right max cache age.');
$this
->assertEqualsCanonicalizing($cache_tags, $calculated_permissions
->getCacheTags(), 'Outsider permissions have the right cache tags.');
$group_role = $this->entityTypeManager
->getStorage('group_role')
->load('other-outsider');
$group_role
->grantPermission('view group')
->save();
$permissions['other'][] = 'view group';
$calculated_permissions = $this->permissionCalculator
->calculateOutsiderPermissions($account);
$converted = $this
->convertCalculatedPermissionsToArray($calculated_permissions);
$this
->assertEqualsCanonicalizing($permissions, $converted, 'Updated outsider permissions are returned per group type.');
$this
->assertSame(-1, $calculated_permissions
->getCacheMaxAge(), 'Updated outsider permissions have the right max cache age.');
$this
->assertEqualsCanonicalizing($cache_tags, $calculated_permissions
->getCacheTags(), 'Updated outsider permissions have the right cache tags.');
$group_role = $this->entityTypeManager
->getStorage('group_role')
->load($group_role_id);
$group_role
->grantPermission('edit group')
->save();
$permissions['default'][] = 'edit group';
$calculated_permissions = $this->permissionCalculator
->calculateOutsiderPermissions($account);
$converted = $this
->convertCalculatedPermissionsToArray($calculated_permissions);
$this
->assertEqualsCanonicalizing($permissions, $converted, 'Updated synchronized outsider permissions are returned per group type.');
$this
->assertSame(-1, $calculated_permissions
->getCacheMaxAge(), 'Updated synchronized outsider permissions have the right max cache age.');
$this
->assertEqualsCanonicalizing($cache_tags, $calculated_permissions
->getCacheTags(), 'Updated synchronized outsider permissions have the right cache tags.');
$this
->createGroupType([
'id' => 'test',
]);
$permissions['test'] = [];
$cache_tags[] = 'config:group.role.test-outsider';
$cache_tags[] = 'config:group.role.' . $this->roleSynchronizer
->getGroupRoleId('test', 'test');
sort($cache_tags);
$calculated_permissions = $this->permissionCalculator
->calculateOutsiderPermissions($account);
$converted = $this
->convertCalculatedPermissionsToArray($calculated_permissions);
$this
->assertEqualsCanonicalizing($permissions, $converted, 'Outsider permissions are updated after introducing a new group type.');
$this
->assertSame(-1, $calculated_permissions
->getCacheMaxAge(), 'Outsider permissions have the right max cache age after introducing a new group type.');
$this
->assertEqualsCanonicalizing($cache_tags, $calculated_permissions
->getCacheTags(), 'Outsider permissions have the right cache tags after introducing a new group type.');
}
/**
* Tests the calculation of the member permissions.
*
* @covers ::calculateMemberPermissions
*/
public function testCalculateMemberPermissions() {
// @todo Use a proper set-up instead of the one from GroupKernelTestBase?
$account = $this
->createUser();
$group = $this
->createGroup([
'type' => 'default',
]);
$permissions = [];
$cache_tags = [
'group_permissions',
'group_content_list:plugin:group_membership:entity:' . $account
->id(),
];
sort($cache_tags);
$calculated_permissions = $this->permissionCalculator
->calculateMemberPermissions($account);
$converted = $this
->convertCalculatedPermissionsToArray($calculated_permissions);
$this
->assertEqualsCanonicalizing($permissions, $converted, 'Member permissions are returned per group ID.');
$this
->assertSame(-1, $calculated_permissions
->getCacheMaxAge(), 'Member permissions have the right max cache age.');
$this
->assertEqualsCanonicalizing($cache_tags, $calculated_permissions
->getCacheTags(), 'Member permissions have the right cache tags.');
$group
->addMember($account);
$member = $group
->getMember($account);
$permissions[$group
->id()][] = 'view group';
$permissions[$group
->id()][] = 'leave group';
$cache_tags[] = 'config:group.role.default-member';
$cache_tags = array_unique(array_merge($member
->getCacheTags(), $cache_tags));
sort($cache_tags);
$calculated_permissions = $this->permissionCalculator
->calculateMemberPermissions($account);
$converted = $this
->convertCalculatedPermissionsToArray($calculated_permissions);
$this
->assertEqualsCanonicalizing($permissions, $converted, 'Member permissions are returned per group ID after joining a group.');
$this
->assertSame(-1, $calculated_permissions
->getCacheMaxAge(), 'Member permissions have the right max cache age after joining a group.');
$this
->assertEqualsCanonicalizing($cache_tags, $calculated_permissions
->getCacheTags(), 'Member permissions have the right cache tags after joining a group.');
// @todo This displays a desperate need for addRole() and removeRole().
$membership = $member
->getGroupContent();
$membership->group_roles[] = 'default-custom';
$membership
->save();
$permissions[$group
->id()][] = 'join group';
$cache_tags[] = 'config:group.role.default-custom';
sort($cache_tags);
$calculated_permissions = $this->permissionCalculator
->calculateMemberPermissions($account);
$converted = $this
->convertCalculatedPermissionsToArray($calculated_permissions);
$this
->assertEqualsCanonicalizing($permissions, $converted, 'Updated member permissions are returned per group ID.');
$this
->assertSame(-1, $calculated_permissions
->getCacheMaxAge(), 'Updated member permissions have the right max cache age.');
$this
->assertEqualsCanonicalizing($cache_tags, $calculated_permissions
->getCacheTags(), 'Updated member permissions have the right cache tags.');
}
/**
* Tests the calculation of the authenticated permissions.
*
* @covers ::calculateAuthenticatedPermissions
* @depends testCalculateOutsiderPermissions
* @depends testCalculateMemberPermissions
*/
public function testCalculateAuthenticatedPermissions() {
$account = $this
->createUser();
$group = $this
->createGroup([
'type' => 'default',
]);
$group
->addMember($account);
$calculated_permissions = new RefinableCalculatedGroupPermissions();
$calculated_permissions
->merge($this->permissionCalculator
->calculateOutsiderPermissions($account))
->merge($this->permissionCalculator
->calculateMemberPermissions($account));
$calculated_permissions = new CalculatedGroupPermissions($calculated_permissions);
$this
->assertEquals($calculated_permissions, $this->permissionCalculator
->calculateAuthenticatedPermissions($account), 'Authenticated permissions are returned as a merge of outsider and member permissions.');
}
/**
* Tests the calculation of an account's permissions.
*
* @covers ::calculatePermissions
* @depends testCalculateAnonymousPermissions
* @depends testCalculateAuthenticatedPermissions
*/
public function testCalculatePermissions() {
$account = new AnonymousUserSession();
$calculated_permissions = $this->permissionCalculator
->calculateAnonymousPermissions();
$this
->assertEquals($calculated_permissions, $this->permissionCalculator
->calculatePermissions($account), 'The calculated anonymous permissions are returned for an anonymous user.');
$account = $this
->createUser();
$group = $this
->createGroup([
'type' => 'default',
]);
$group
->addMember($account);
$calculated_permissions = new RefinableCalculatedGroupPermissions();
$calculated_permissions
->merge($this->permissionCalculator
->calculateOutsiderPermissions($account))
->merge($this->permissionCalculator
->calculateMemberPermissions($account));
$calculated_permissions = new CalculatedGroupPermissions($calculated_permissions);
$this
->assertEquals($calculated_permissions, $this->permissionCalculator
->calculatePermissions($account), 'Calculated permissions for a member are returned as a merge of outsider and member permissions.');
}
/**
* Tests whether anonymous users and 'pure' outsiders can get the same result.
*
* This is important for hash generation based on the calculated permissions.
* If both audiences can get a similar result, it means they can share a hash
* and therefore cache objects.
*
* @depends testCalculateAnonymousPermissions
* @depends testCalculateAuthenticatedPermissions
*/
public function testAnonymousAuthenticatedSameResult() {
// @todo Use a proper set-up instead of the one from GroupKernelTestBase?
$account = $this
->createUser();
$this
->assertNotEqualsCanonicalizing($this
->convertCalculatedPermissionsToArray($this->permissionCalculator
->calculateAnonymousPermissions()), $this
->convertCalculatedPermissionsToArray($this->permissionCalculator
->calculateAuthenticatedPermissions($account)), 'Calculated permissions for an anonymous and outsider user with different group permissions differ.');
// Update 'default' anonymous role to have same permissions as the
// 'default' outsider role.
$group_role = $this->entityTypeManager
->getStorage('group_role')
->load('default-anonymous');
$group_role
->grantPermissions([
'join group',
'view group',
])
->save();
$this
->assertEqualsCanonicalizing($this
->convertCalculatedPermissionsToArray($this->permissionCalculator
->calculateAnonymousPermissions()), $this
->convertCalculatedPermissionsToArray($this->permissionCalculator
->calculateAuthenticatedPermissions($account)), 'Calculated permissions for an anonymous and outsider user with the same group permissions are the same.');
}
/**
* Converts a calculated permissions object into an array.
*
* This is done to make comparison assertions easier. Make sure you use the
* canonicalize option of assertEquals.
*
* @param \Drupal\group\Access\CalculatedGroupPermissionsInterface $calculated_permissions
* The calculated permissions object to convert.
*
* @return string[]
* The permissions, keyed by scope identifier.
*/
protected function convertCalculatedPermissionsToArray(CalculatedGroupPermissionsInterface $calculated_permissions) {
$permissions = [];
foreach ($calculated_permissions
->getItems() as $item) {
$permissions[$item
->getIdentifier()] = $item
->getPermissions();
}
return $permissions;
}
/**
* Test members permissions with multiple users, groups and group roles.
*/
public function testCalculateMultipleMembersPermissions() {
$account1 = $this
->createUser();
$account2 = $this
->createUser();
$group1 = $this
->createGroup([
'type' => 'default',
]);
$group2 = $this
->createGroup([
'type' => 'default',
]);
// Expected values.
$permissions1 = [];
$permissions2 = [];
// Assert permissions for accounts when users are not group members.
$calculated_permissions1 = $this->permissionCalculator
->calculateMemberPermissions($account1);
$converted1 = $this
->convertCalculatedPermissionsToArray($calculated_permissions1);
$this
->assertEqualsCanonicalizing($permissions1, $converted1, 'Member permissions are returned per group ID.');
$calculated_permissions2 = $this->permissionCalculator
->calculateMemberPermissions($account2);
$converted2 = $this
->convertCalculatedPermissionsToArray($calculated_permissions2);
$this
->assertEqualsCanonicalizing($permissions2, $converted2, 'Member permissions are returned per group ID.');
// Add account1 to group1.
$group1
->addMember($account1);
$permissions1[$group1
->id()][] = 'view group';
$permissions1[$group1
->id()][] = 'leave group';
$calculated_permissions1 = $this->permissionCalculator
->calculateMemberPermissions($account1);
$converted1 = $this
->convertCalculatedPermissionsToArray($calculated_permissions1);
$this
->assertEqualsCanonicalizing($permissions1, $converted1, 'Member permissions are returned per group ID after joining a group.');
// Add account2 to group2 and apply an additional role.
$group2
->addMember($account2);
$member2 = $group2
->getMember($account2);
$membership2 = $member2
->getGroupContent();
$membership2->group_roles[] = 'default-custom';
$membership2
->save();
$permissions2[$group2
->id()][] = 'view group';
$permissions2[$group2
->id()][] = 'leave group';
$permissions2[$group2
->id()][] = 'join group';
// Permissions for account1 did not change.
$calculated_permissions1 = $this->permissionCalculator
->calculateMemberPermissions($account1);
$converted1 = $this
->convertCalculatedPermissionsToArray($calculated_permissions1);
$this
->assertEqualsCanonicalizing($permissions1, $converted1, 'Member permissions are returned per group ID after joining a group.');
// Assert permissions for account2.
$calculated_permissions2 = $this->permissionCalculator
->calculateMemberPermissions($account2);
$converted2 = $this
->convertCalculatedPermissionsToArray($calculated_permissions2);
$this
->assertEqualsCanonicalizing($permissions2, $converted2, 'Updated member permissions are returned per group ID.');
// Remove "default-custom" group role for account2.
$membership2->group_roles = [
'default-member',
];
$membership2
->save();
$permissions2 = [
$group2
->id() => [
'view group',
'leave group',
],
];
// Assert permissions have changed for account2.
$calculated_permissions2 = $this->permissionCalculator
->calculateMemberPermissions($account2);
$converted2 = $this
->convertCalculatedPermissionsToArray($calculated_permissions2);
$this
->assertEqualsCanonicalizing($permissions2, $converted2, 'Updated member permissions are returned per group ID.');
// Remove account2 from group2.
$group2
->removeMember($account2);
$permissions2 = [];
$calculated_permissions2 = $this->permissionCalculator
->calculateMemberPermissions($account2);
$converted2 = $this
->convertCalculatedPermissionsToArray($calculated_permissions2);
$this
->assertEqualsCanonicalizing($permissions2, $converted2, 'Updated member permissions are returned per group ID.');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AssertContentTrait:: |
protected | property | The current raw content. | |
AssertContentTrait:: |
protected | property | The drupalSettings value from the current raw $content. | |
AssertContentTrait:: |
protected | property | The XML structure parsed from the current raw $content. | 1 |
AssertContentTrait:: |
protected | property | The plain-text content of raw $content (text nodes). | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS found escaped on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given name or ID. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given ID and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given name and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists in the current page by the given XPath. | |
AssertContentTrait:: |
protected | function | Asserts that a checkbox field in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists in the current page with a given Xpath result. | |
AssertContentTrait:: |
protected | function | Passes if a link with the specified label is found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href (part) is found. | |
AssertContentTrait:: |
protected | function | Asserts that each HTML ID is used for just a single element. | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS NOT found escaped on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given name or ID. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given ID and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given name and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist or its value does not match, by XPath. | |
AssertContentTrait:: |
protected | function | Asserts that a checkbox field in the current page is not checked. | |
AssertContentTrait:: |
protected | function | Passes if a link with the specified label is not found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href (part) is not found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href is not found in the main region. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page does not exist. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is not checked. | |
AssertContentTrait:: |
protected | function | Triggers a pass if the perl regex pattern is not found in raw content. | |
AssertContentTrait:: |
protected | function | Passes if the raw text is NOT found on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Passes if the page (with HTML stripped) does not contains the text. | |
AssertContentTrait:: |
protected | function | Pass if the page title is not the given string. | |
AssertContentTrait:: |
protected | function | Passes if the text is found MORE THAN ONCE on the text version of the page. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page exists. | |
AssertContentTrait:: |
protected | function | Asserts that a select option with the visible text exists. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page exists. | |
AssertContentTrait:: |
protected | function | Triggers a pass if the Perl regex pattern is found in the raw content. | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS found on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Passes if the page (with HTML stripped) contains the text. | |
AssertContentTrait:: |
protected | function | Helper for assertText and assertNoText. | |
AssertContentTrait:: |
protected | function | Asserts that a Perl regex pattern is found in the plain-text content. | |
AssertContentTrait:: |
protected | function | Asserts themed output. | |
AssertContentTrait:: |
protected | function | Pass if the page title is the given string. | |
AssertContentTrait:: |
protected | function | Passes if the text is found ONLY ONCE on the text version of the page. | |
AssertContentTrait:: |
protected | function | Helper for assertUniqueText and assertNoUniqueText. | |
AssertContentTrait:: |
protected | function | Builds an XPath query. | |
AssertContentTrait:: |
protected | function | Helper: Constructs an XPath for the given set of attributes and value. | |
AssertContentTrait:: |
protected | function | Searches elements using a CSS selector in the raw content. | |
AssertContentTrait:: |
protected | function | Get all option elements, including nested options, in a select. | |
AssertContentTrait:: |
protected | function | Gets the value of drupalSettings for the currently-loaded page. | |
AssertContentTrait:: |
protected | function | Gets the current raw content. | |
AssertContentTrait:: |
protected | function | Get the selected value from a select field. | |
AssertContentTrait:: |
protected | function | Retrieves the plain-text content from the current raw content. | |
AssertContentTrait:: |
protected | function | Get the current URL from the cURL handler. | 1 |
AssertContentTrait:: |
protected | function | Parse content returned from curlExec using DOM and SimpleXML. | |
AssertContentTrait:: |
protected | function | Removes all white-space between HTML tags from the raw content. | |
AssertContentTrait:: |
protected | function | Sets the value of drupalSettings for the currently-loaded page. | |
AssertContentTrait:: |
protected | function | Sets the raw content (e.g. HTML). | |
AssertContentTrait:: |
protected | function | Performs an xpath search on the contents of the internal browser. | |
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
ChainGroupPermissionCalculatorTest:: |
protected | property | The group permissions hash generator service. | |
ChainGroupPermissionCalculatorTest:: |
protected | property | The group role synchronizer service. | |
ChainGroupPermissionCalculatorTest:: |
protected | function | Converts a calculated permissions object into an array. | |
ChainGroupPermissionCalculatorTest:: |
protected | function |
Overrides GroupKernelTestBase:: |
|
ChainGroupPermissionCalculatorTest:: |
public | function | Tests whether anonymous users and 'pure' outsiders can get the same result. | |
ChainGroupPermissionCalculatorTest:: |
public | function | Tests the calculation of the anonymous permissions. | |
ChainGroupPermissionCalculatorTest:: |
public | function | Tests the calculation of the authenticated permissions. | |
ChainGroupPermissionCalculatorTest:: |
public | function | Tests the calculation of the member permissions. | |
ChainGroupPermissionCalculatorTest:: |
public | function | Test members permissions with multiple users, groups and group roles. | |
ChainGroupPermissionCalculatorTest:: |
public | function | Tests the calculation of the outsider permissions. | |
ChainGroupPermissionCalculatorTest:: |
public | function | Tests the calculation of an account's permissions. | |
ConfigTestTrait:: |
protected | function | Returns a ConfigImporter object to import test configuration. | |
ConfigTestTrait:: |
protected | function | Copies configuration objects from source storage to target storage. | |
EntityKernelTestBase:: |
protected | property | The entity type manager service. | 1 |
EntityKernelTestBase:: |
protected | property | A list of generated identifiers. | |
EntityKernelTestBase:: |
protected | property | The state service. | |
EntityKernelTestBase:: |
protected | function | Creates a user. | |
EntityKernelTestBase:: |
protected | function | Generates a random ID avoiding collisions. | |
EntityKernelTestBase:: |
protected | function | Returns the entity_test hook invocation info. | |
EntityKernelTestBase:: |
protected | function | Installs a module and refreshes services. | |
EntityKernelTestBase:: |
protected | function | Refresh services. | 1 |
EntityKernelTestBase:: |
protected | function | Reloads the given entity from the storage and returns it. | |
EntityKernelTestBase:: |
protected | function | Uninstalls a module and refreshes services. | |
ExtensionListTestTrait:: |
protected | function | Gets the path for the specified module. | |
ExtensionListTestTrait:: |
protected | function | Gets the path for the specified theme. | |
GroupKernelTestBase:: |
public static | property |
@todo Refactor tests to not automatically use group_test_config unless they
have a good reason to. Overrides EntityKernelTestBase:: |
11 |
GroupKernelTestBase:: |
protected | property | The group relation plugin manager. | |
GroupKernelTestBase:: |
protected | function | Creates a group. | |
GroupKernelTestBase:: |
protected | function | Creates a group type. | |
GroupKernelTestBase:: |
protected | function | Gets the current user so you can run some checks against them. | |
KernelTestBase:: |
protected | property | Back up and restore any global variables that may be changed by tests. | |
KernelTestBase:: |
protected | property | Back up and restore static class properties that may be changed by tests. | |
KernelTestBase:: |
protected | property | Contains a few static class properties for performance. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | @todo Move into Config test base class. | 7 |
KernelTestBase:: |
protected static | property | An array of config object names that are excluded from schema checking. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | Do not forward any global state from the parent process to the processes that run the actual tests. | |
KernelTestBase:: |
protected | property | The app root. | |
KernelTestBase:: |
protected | property | Kernel tests are run in separate processes because they allow autoloading of code from extensions. Running the test in a separate process isolates this behavior from other tests. Subclasses should not override this property. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | Set to TRUE to strict check all configuration saved. | 6 |
KernelTestBase:: |
protected | property | The virtual filesystem root directory. | |
KernelTestBase:: |
protected | function | 1 | |
KernelTestBase:: |
protected | function | Bootstraps a basic test environment. | |
KernelTestBase:: |
private | function | Bootstraps a kernel for a test. | |
KernelTestBase:: |
protected | function | Configuration accessor for tests. Returns non-overridden configuration. | |
KernelTestBase:: |
protected | function | Disables modules for this test. | |
KernelTestBase:: |
protected | function | Enables modules for this test. | |
KernelTestBase:: |
protected | function | Gets the config schema exclusions for this test. | |
KernelTestBase:: |
protected | function | Returns the Database connection info to be used for this test. | 3 |
KernelTestBase:: |
public | function | ||
KernelTestBase:: |
private | function | Returns Extension objects for $modules to enable. | |
KernelTestBase:: |
private static | function | Returns the modules to enable for this test. | |
KernelTestBase:: |
protected | function | Initializes the FileCache component. | |
KernelTestBase:: |
protected | function | Installs default configuration for a given list of modules. | |
KernelTestBase:: |
protected | function | Installs the storage schema for a specific entity type. | |
KernelTestBase:: |
protected | function | Installs database tables from a module schema definition. | |
KernelTestBase:: |
protected | function | ||
KernelTestBase:: |
public | function |
Registers test-specific services. Overrides ServiceProviderInterface:: |
24 |
KernelTestBase:: |
protected | function | Renders a render array. | 1 |
KernelTestBase:: |
protected | function | Sets the install profile and rebuilds the container to update it. | |
KernelTestBase:: |
protected | function | Sets an in-memory Settings variable. | |
KernelTestBase:: |
public static | function | 1 | |
KernelTestBase:: |
protected | function | Sets up the filesystem, so things like the file directory. | 2 |
KernelTestBase:: |
protected | function | Stops test execution. | |
KernelTestBase:: |
protected | function | 4 | |
KernelTestBase:: |
public | function | @after | |
KernelTestBase:: |
protected | function | Dumps the current state of the virtual filesystem to STDOUT. | |
KernelTestBase:: |
public | function | Prevents serializing any properties. | |
PhpUnitWarnings:: |
private static | property | Deprecation warnings from PHPUnit to raise with @trigger_error(). | |
PhpUnitWarnings:: |
public | function | Converts PHPUnit deprecation warnings to E_USER_DEPRECATED. | |
RandomGeneratorTrait:: |
protected | property | The random generator. | |
RandomGeneratorTrait:: |
protected | function | Gets the random generator for the utility methods. | |
RandomGeneratorTrait:: |
protected | function | Generates a unique random string containing letters and numbers. | 1 |
RandomGeneratorTrait:: |
public | function | Generates a random PHP object. | |
RandomGeneratorTrait:: |
public | function | Generates a pseudo-random string of ASCII characters of codes 32 to 126. | |
RandomGeneratorTrait:: |
public | function | Callback for random string validation. | |
StorageCopyTrait:: |
protected static | function | Copy the configuration from one storage to another and remove stale items. | |
TestRequirementsTrait:: |
private | function | Checks missing module requirements. | |
TestRequirementsTrait:: |
protected | function | Check module requirements for the Drupal use case. | 1 |
TestRequirementsTrait:: |
protected static | function | Returns the Drupal root directory. | |
UserCreationTrait:: |
protected | function | Checks whether a given list of permission names is valid. Aliased as: drupalCheckPermissions | |
UserCreationTrait:: |
protected | function | Creates an administrative role. Aliased as: drupalCreateAdminRole | |
UserCreationTrait:: |
protected | function | Creates a role with specified permissions. Aliased as: drupalCreateRole | |
UserCreationTrait:: |
protected | function | Create a user with a given set of permissions. Aliased as: drupalCreateUser | |
UserCreationTrait:: |
protected | function | Grant permissions to a user role. Aliased as: drupalGrantPermissions | |
UserCreationTrait:: |
protected | function | Switch the current logged in user. Aliased as: drupalSetCurrentUser | |
UserCreationTrait:: |
protected | function | Creates a random user account and sets it as current user. Aliased as: drupalSetUpCurrentUser |