protected function PermissionsGeneratorTest::assertOwnerPermissions in Entity Construction Kit (ECK) 8
Asserts that the correct owner permissions are returned.
3 calls to PermissionsGeneratorTest::assertOwnerPermissions()
- PermissionsGeneratorTest::givenMultipleEntityTypesWithMixedSettingsGeneratesCorrectPermissions in tests/
src/ Unit/ PermissionsGeneratorTest.php - Tests permission creation for entity types with mixed settings.
- PermissionsGeneratorTest::givenSingleEntityTypeGeneratesCorrectPermissions in tests/
src/ Unit/ PermissionsGeneratorTest.php - Tests permission creation for a single entity type.
- PermissionsGeneratorTest::givenSingleEntityTypeWithAuthorFieldGeneratesCorrectPermissions in tests/
src/ Unit/ PermissionsGeneratorTest.php - Tests permission creation for an entity type with an author field.
File
- tests/
src/ Unit/ PermissionsGeneratorTest.php, line 118
Class
- PermissionsGeneratorTest
- Tests the form element implementation.
Namespace
Drupal\Tests\eck\UnitCode
protected function assertOwnerPermissions($permissions) {
foreach ($this->entities as $id => $entity) {
/** @var \Drupal\eck\Entity\EckEntityType $entity */
if ($entity
->hasAuthorField()) {
$this
->assertArrayHasKey("edit own {$id} entities", $permissions);
$this
->assertArrayHasKey("delete own {$id} entities", $permissions);
$this
->assertArrayHasKey("view own {$id} entities", $permissions);
}
else {
$this
->assertArrayNotHasKey("edit own {$id} entities", $permissions);
$this
->assertArrayNotHasKey("delete own {$id} entities", $permissions);
$this
->assertArrayNotHasKey("view own {$id} entities", $permissions);
}
}
}