updated contrib modules : pathauto, token, entity_api, search_api, redirect, features
This commit is contained in:
+3
-3
@@ -6,8 +6,8 @@ package: Testing
|
||||
dependencies:
|
||||
- entity
|
||||
|
||||
# Information added by Drupal.org packaging script on 2018-03-12
|
||||
version: '8.x-1.0-beta2'
|
||||
# Information added by Drupal.org packaging script on 2018-06-08
|
||||
version: '8.x-1.0-beta4'
|
||||
core: '8.x'
|
||||
project: 'entity'
|
||||
datestamp: 1520873296
|
||||
datestamp: 1528452194
|
||||
|
||||
+3
-3
@@ -6,8 +6,8 @@ package: Testing
|
||||
dependencies:
|
||||
- entity
|
||||
|
||||
# Information added by Drupal.org packaging script on 2018-03-12
|
||||
version: '8.x-1.0-beta2'
|
||||
# Information added by Drupal.org packaging script on 2018-06-08
|
||||
version: '8.x-1.0-beta4'
|
||||
core: '8.x'
|
||||
project: 'entity'
|
||||
datestamp: 1520873296
|
||||
datestamp: 1528452194
|
||||
|
||||
+3
-3
@@ -3,8 +3,8 @@ type: module
|
||||
package: Testing
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2018-03-12
|
||||
version: '8.x-1.0-beta2'
|
||||
# Information added by Drupal.org packaging script on 2018-06-08
|
||||
version: '8.x-1.0-beta4'
|
||||
core: '8.x'
|
||||
project: 'entity'
|
||||
datestamp: 1520873296
|
||||
datestamp: 1528452194
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ use Drupal\entity\Revision\RevisionableContentEntityBase;
|
||||
* "access" = "\Drupal\Core\Entity\EntityAccessControlHandler",
|
||||
* "permission_provider" = "\Drupal\entity\EntityPermissionProvider",
|
||||
* "form" = {
|
||||
* "add" = "\Drupal\Core\Entity\ContentEntityForm",
|
||||
* "edit" = "\Drupal\Core\Entity\ContentEntityForm",
|
||||
* "add" = "\Drupal\entity\Form\RevisionableContentEntityForm",
|
||||
* "edit" = "\Drupal\entity\Form\RevisionableContentEntityForm",
|
||||
* "delete" = "\Drupal\Core\Entity\EntityDeleteForm",
|
||||
* },
|
||||
* "route_provider" = {
|
||||
|
||||
+3
@@ -15,6 +15,9 @@ use Drupal\Core\Entity\RevisionableEntityBundleInterface;
|
||||
* admin_permission = "administer entity_test_enhanced",
|
||||
* config_prefix = "entity_test_enhanced_bundle",
|
||||
* bundle_of = "entity_test_enhanced",
|
||||
* handlers = {
|
||||
* "access" = "\Drupal\entity\BundleEntityAccessControlHandler",
|
||||
* },
|
||||
* entity_keys = {
|
||||
* "id" = "id",
|
||||
* "label" = "label"
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ class RevisionRouteAccessTest extends BrowserTestBase {
|
||||
/**
|
||||
* The current user.
|
||||
*
|
||||
* @var \Drupal\Core\Session\AccountInterface;
|
||||
* @var \Drupal\Core\Session\AccountInterface
|
||||
*/
|
||||
protected $account;
|
||||
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\entity\Kernel;
|
||||
|
||||
use Drupal\entity_module_test\Entity\EnhancedEntityBundle;
|
||||
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests the bundle entity access control handler.
|
||||
*
|
||||
* @group entity
|
||||
*/
|
||||
class BundleEntityAccessControlHandlerTest extends EntityKernelTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = [
|
||||
'entity',
|
||||
'entity_module_test',
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installEntitySchema('entity_test_enhanced');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the "view label" access checking.
|
||||
*/
|
||||
public function testAccess() {
|
||||
$bundle = EnhancedEntityBundle::create([
|
||||
'id' => 'default',
|
||||
'label' => 'Default',
|
||||
]);
|
||||
$bundle->save();
|
||||
|
||||
// The default user has no permissions related to entity_test_enhanced.
|
||||
$this->assertFalse($bundle->access('view label'));
|
||||
|
||||
$permissions = [
|
||||
'administer entity_test_enhanced',
|
||||
'view entity_test_enhanced',
|
||||
'view default entity_test_enhanced',
|
||||
];
|
||||
foreach ($permissions as $permission) {
|
||||
$account = $this->createUser([], [$permission]);
|
||||
$this->assertTrue($bundle->access('view label', $account));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests the delete entity action.
|
||||
*
|
||||
* @group entity
|
||||
*/
|
||||
class DeleteActionTest extends KernelTestBase {
|
||||
@@ -25,8 +26,9 @@ class DeleteActionTest extends KernelTestBase {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['action', 'node', 'entity_module_test', 'entity',
|
||||
'user', 'system'];
|
||||
public static $modules = [
|
||||
'action', 'node', 'entity_module_test', 'entity', 'user', 'system',
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
||||
+2
@@ -10,6 +10,8 @@ use Symfony\Component\Routing\Route;
|
||||
*
|
||||
* - Are the routes added properly.
|
||||
* - Are the local tasks added properly.
|
||||
*
|
||||
* @group entity
|
||||
*/
|
||||
class RevisionOverviewIntegrationTest extends KernelTestBase {
|
||||
|
||||
+74
-82
@@ -77,84 +77,71 @@ class EntityAccessControlHandlerTest extends UnitTestCase {
|
||||
* A list of testAccess method arguments.
|
||||
*/
|
||||
public function accessProvider() {
|
||||
$data = [];
|
||||
|
||||
$entity_type = $this->prophesize(ContentEntityTypeInterface::class);
|
||||
$entity_type->id()->willReturn('green_entity');
|
||||
$entity_type->getAdminPermission()->willReturn('administer green_entity');
|
||||
$entity_type->hasHandlerClass('permission_provider')->willReturn(TRUE);
|
||||
$entity_type->getHandlerClass('permission_provider')->willReturn(EntityPermissionProvider::class);
|
||||
|
||||
// User with the admin permission can do anything.
|
||||
$entity = $this->buildMockEntity($entity_type->reveal());
|
||||
$account = $this->prophesize(AccountInterface::class);
|
||||
$account->id()->willReturn(6);
|
||||
$account->hasPermission('administer green_entity')->willReturn(TRUE);
|
||||
$data[] = [$entity->reveal(), 'view', $account->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), 'update', $account->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), 'delete', $account->reveal(), TRUE];
|
||||
|
||||
// Entity with no owner.
|
||||
$entity = $this->buildMockEntity($entity_type->reveal());
|
||||
// User who has access.
|
||||
$first_account = $this->prophesize(AccountInterface::class);
|
||||
$first_account->id()->willReturn(6);
|
||||
$first_account->hasPermission('view green_entity')->willReturn(TRUE);
|
||||
$first_account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
// User who doesn't have access.
|
||||
$second_account = $this->prophesize(AccountInterface::class);
|
||||
$second_account->id()->willReturn(7);
|
||||
$second_account->hasPermission('view green_entity')->willReturn(FALSE);
|
||||
$second_account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
$data[] = [$entity->reveal(), 'view', $first_account->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), 'view', $second_account->reveal(), FALSE];
|
||||
|
||||
// Entity with owner.
|
||||
$entity = $this->buildMockEntity($entity_type->reveal(), 6);
|
||||
// Owner.
|
||||
$first_account = $this->prophesize(AccountInterface::class);
|
||||
$first_account->id()->willReturn(6);
|
||||
$first_account->hasPermission('update own green_entity')->willReturn(TRUE);
|
||||
$first_account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
// Non-owner.
|
||||
$second_account = $this->prophesize(AccountInterface::class);
|
||||
$second_account->id()->willReturn(7);
|
||||
$second_account->hasPermission('update own green_entity')->willReturn(TRUE);
|
||||
$second_account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
// User who can update any.
|
||||
$third_account = $this->prophesize(AccountInterface::class);
|
||||
$third_account->id()->willReturn(8);
|
||||
$third_account->hasPermission('update any green_entity')->willReturn(TRUE);
|
||||
$third_account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
$data[] = [$entity->reveal(), 'update', $first_account->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), 'update', $second_account->reveal(), FALSE];
|
||||
$data[] = [$entity->reveal(), 'update', $third_account->reveal(), TRUE];
|
||||
|
||||
// Test the unpublished permissions.
|
||||
$entity_first_other_up = $this->buildMockEntity($entity_type->reveal(), 9999, 'first', FALSE);
|
||||
$entity_first_own_up = $this->buildMockEntity($entity_type->reveal(), 14, 'first', FALSE);
|
||||
$entity_first_own_bundle_up = $this->buildMockEntity($entity_type->reveal(), 15, 'first', FALSE);
|
||||
$data = [];
|
||||
// Admin permission.
|
||||
$admin_user = $this->buildMockUser(5, 'administer green_entity');
|
||||
$data[] = [$entity->reveal(), 'view', $admin_user->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), 'update', $admin_user->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), 'delete', $admin_user->reveal(), TRUE];
|
||||
|
||||
$entity_second_other_up = $this->buildMockEntity($entity_type->reveal(), 9999, 'second', FALSE);
|
||||
$entity_second_own_up = $this->buildMockEntity($entity_type->reveal(), 14, 'second', FALSE);
|
||||
$entity_second_own_bundle_up = $this->buildMockEntity($entity_type->reveal(), 15, 'second', FALSE);
|
||||
// View, Update, delete permissions, entity without an owner.
|
||||
$second_entity = $this->buildMockEntity($entity_type->reveal());
|
||||
foreach (['view', 'update', 'delete'] as $operation) {
|
||||
$first_user = $this->buildMockUser(6, $operation . ' green_entity');
|
||||
$second_user = $this->buildMockUser(7, 'access content');
|
||||
|
||||
$user_view_own_up = $this->buildMockUser(14, 'view own unpublished green_entity');
|
||||
$user_view_other = $this->buildMockUser(15, 'view green_entity');
|
||||
$data[] = [$second_entity->reveal(), $operation, $first_user->reveal(), TRUE];
|
||||
$data[] = [$second_entity->reveal(), $operation, $second_user->reveal(), FALSE];
|
||||
}
|
||||
|
||||
$data['entity_first_other_up user_view_own_up'] = [$entity_first_other_up->reveal(), 'view', $user_view_own_up->reveal(), FALSE];
|
||||
$data['entity_first_own_up user_view_own_up'] = [$entity_first_own_up->reveal(), 'view', $user_view_own_up->reveal(), TRUE];
|
||||
$data['entity_first_own_bundle_up user_view_own_up'] = [$entity_first_own_bundle_up->reveal(), 'view', $user_view_own_up->reveal(), FALSE];
|
||||
$data['entity_second_other_up user_view_own_up'] = [$entity_second_other_up->reveal(), 'view', $user_view_own_up->reveal(), FALSE];
|
||||
$data['entity_second_own_up user_view_own_up'] = [$entity_second_own_up->reveal(), 'view', $user_view_own_up->reveal(), TRUE];
|
||||
$data['entity_second_own_bundle_up user_view_own_up'] = [$entity_second_own_bundle_up->reveal(), 'view', $user_view_own_up->reveal(), FALSE];
|
||||
// Update and delete permissions.
|
||||
foreach (['update', 'delete'] as $operation) {
|
||||
// Owner, non-owner, user with "any" permission.
|
||||
$first_user = $this->buildMockUser(6, $operation . ' own green_entity');
|
||||
$second_user = $this->buildMockUser(7, $operation . ' own green_entity');
|
||||
$third_user = $this->buildMockUser(8, $operation . ' any green_entity');
|
||||
|
||||
$data['entity_first_other_up user_view_other'] = [$entity_first_other_up->reveal(), 'view', $user_view_other->reveal(), FALSE];
|
||||
$data['entity_first_own_up user_view_other'] = [$entity_first_own_up->reveal(), 'view', $user_view_other->reveal(), FALSE];
|
||||
$data['entity_first_own_bundle_up user_view_other'] = [$entity_first_own_bundle_up->reveal(), 'view', $user_view_other->reveal(), FALSE];
|
||||
$data['entity_second_other_up user_view_other'] = [$entity_second_other_up->reveal(), 'view', $user_view_other->reveal(), FALSE];
|
||||
$data['entity_second_own_up user_view_other'] = [$entity_second_own_up->reveal(), 'view', $user_view_other->reveal(), FALSE];
|
||||
$data['entity_second_own_bundle_up user_view_other'] = [$entity_second_own_bundle_up->reveal(), 'view', $user_view_other->reveal(), FALSE];
|
||||
$data[] = [$entity->reveal(), $operation, $first_user->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), $operation, $second_user->reveal(), FALSE];
|
||||
$data[] = [$entity->reveal(), $operation, $third_user->reveal(), TRUE];
|
||||
}
|
||||
|
||||
// View permissions.
|
||||
$first_user = $this->buildMockUser(9, 'view green_entity');
|
||||
$second_user = $this->buildMockUser(10, 'view first green_entity');
|
||||
$third_user = $this->buildMockUser(14, 'view own unpublished green_entity');
|
||||
$fourth_user = $this->buildMockUser(14, 'access content');
|
||||
|
||||
$first_entity = $this->buildMockEntity($entity_type->reveal(), 1, 'first');
|
||||
$second_entity = $this->buildMockEntity($entity_type->reveal(), 1, 'second');
|
||||
$third_entity = $this->buildMockEntity($entity_type->reveal(), 14, 'first', FALSE);
|
||||
|
||||
// The first user can view the two published entities.
|
||||
$data[] = [$first_entity->reveal(), 'view', $first_user->reveal(), TRUE];
|
||||
$data[] = [$second_entity->reveal(), 'view', $first_user->reveal(), TRUE];
|
||||
$data[] = [$third_entity->reveal(), 'view', $first_user->reveal(), FALSE];
|
||||
|
||||
// The second user can only view published entities of bundle "first".
|
||||
$data[] = [$first_entity->reveal(), 'view', $second_user->reveal(), TRUE];
|
||||
$data[] = [$second_entity->reveal(), 'view', $second_user->reveal(), FALSE];
|
||||
$data[] = [$third_entity->reveal(), 'view', $second_user->reveal(), FALSE];
|
||||
|
||||
// The third user can view their own unpublished entity.
|
||||
$data[] = [$first_entity->reveal(), 'view', $third_user->reveal(), FALSE];
|
||||
$data[] = [$second_entity->reveal(), 'view', $third_user->reveal(), FALSE];
|
||||
$data[] = [$third_entity->reveal(), 'view', $third_user->reveal(), TRUE];
|
||||
|
||||
// The fourth user can't view anything.
|
||||
$data[] = [$first_entity->reveal(), 'view', $fourth_user->reveal(), FALSE];
|
||||
$data[] = [$second_entity->reveal(), 'view', $fourth_user->reveal(), FALSE];
|
||||
$data[] = [$third_entity->reveal(), 'view', $fourth_user->reveal(), FALSE];
|
||||
|
||||
return $data;
|
||||
}
|
||||
@@ -175,29 +162,19 @@ class EntityAccessControlHandlerTest extends UnitTestCase {
|
||||
$entity_type->getHandlerClass('permission_provider')->willReturn(EntityPermissionProvider::class);
|
||||
|
||||
// User with the admin permission.
|
||||
$account = $this->prophesize(AccountInterface::class);
|
||||
$account->id()->willReturn(6);
|
||||
$account->hasPermission('administer green_entity')->willReturn(TRUE);
|
||||
$account = $this->buildMockUser('6', 'administer green_entity');
|
||||
$data[] = [$entity_type->reveal(), NULL, $account->reveal(), TRUE];
|
||||
|
||||
// Ordinary user.
|
||||
$account = $this->prophesize(AccountInterface::class);
|
||||
$account->id()->willReturn(6);
|
||||
$account->hasPermission('create green_entity')->willReturn(TRUE);
|
||||
$account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
$account = $this->buildMockUser('6', 'create green_entity');
|
||||
$data[] = [$entity_type->reveal(), NULL, $account->reveal(), TRUE];
|
||||
|
||||
// Ordinary user, entity with a bundle.
|
||||
$account = $this->prophesize(AccountInterface::class);
|
||||
$account->id()->willReturn(6);
|
||||
$account->hasPermission('create first_bundle green_entity')->willReturn(TRUE);
|
||||
$account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
$account = $this->buildMockUser('6', 'create first_bundle green_entity');
|
||||
$data[] = [$entity_type->reveal(), 'first_bundle', $account->reveal(), TRUE];
|
||||
|
||||
// User with no permissions.
|
||||
$account = $this->prophesize(AccountInterface::class);
|
||||
$account->id()->willReturn(6);
|
||||
$account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
$account = $this->buildMockUser('6', 'access content');
|
||||
$data[] = [$entity_type->reveal(), NULL, $account->reveal(), FALSE];
|
||||
|
||||
return $data;
|
||||
@@ -210,6 +187,10 @@ class EntityAccessControlHandlerTest extends UnitTestCase {
|
||||
* The entity type.
|
||||
* @param string $owner_id
|
||||
* The owner ID.
|
||||
* @param string $bundle
|
||||
* The bundle.
|
||||
* @param bool $published
|
||||
* Whether the entity is published.
|
||||
*
|
||||
* @return \Prophecy\Prophecy\ObjectProphecy
|
||||
* The entity mock.
|
||||
@@ -242,15 +223,26 @@ class EntityAccessControlHandlerTest extends UnitTestCase {
|
||||
$entity->getCacheTags()->willReturn([]);
|
||||
$entity->getCacheMaxAge()->willReturn(Cache::PERMANENT);
|
||||
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a mock user.
|
||||
*
|
||||
* @param int $uid
|
||||
* The user ID.
|
||||
* @param string $permission
|
||||
* The permission to grant.
|
||||
*
|
||||
* @return \Prophecy\Prophecy\ObjectProphecy
|
||||
* The user mock.
|
||||
*/
|
||||
protected function buildMockUser($uid, $permission) {
|
||||
$account = $this->prophesize(AccountInterface::class);
|
||||
$account->id()->willReturn($uid);
|
||||
$account->hasPermission($permission)->willReturn(TRUE);
|
||||
$account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
|
||||
+9
-1
@@ -72,12 +72,12 @@ class EntityPermissionProviderTest extends UnitTestCase {
|
||||
$entity_type->id()->willReturn('green_entity');
|
||||
$entity_type->getSingularLabel()->willReturn('green entity');
|
||||
$entity_type->getPluralLabel()->willReturn('green entities');
|
||||
$entity_type->hasLinkTemplate('collection')->willReturn(FALSE);
|
||||
$entity_type->entityClassImplements(EntityOwnerInterface::class)->willReturn(FALSE);
|
||||
$entity_type->entityClassImplements(EntityPublishedInterface::class)->willReturn(FALSE);
|
||||
$entity_type->getPermissionGranularity()->willReturn('entity_type');
|
||||
$expected_permissions = [
|
||||
'administer green_entity' => 'Administer green entities',
|
||||
'access green_entity overview' => 'Access the green entities overview page',
|
||||
'create green_entity' => 'Create green entities',
|
||||
'update green_entity' => 'Update green entities',
|
||||
'delete green_entity' => 'Delete green entities',
|
||||
@@ -91,6 +91,7 @@ class EntityPermissionProviderTest extends UnitTestCase {
|
||||
$entity_type->id()->willReturn('blue_entity');
|
||||
$entity_type->getSingularLabel()->willReturn('blue entity');
|
||||
$entity_type->getPluralLabel()->willReturn('blue entities');
|
||||
$entity_type->hasLinkTemplate('collection')->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityOwnerInterface::class)->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityPublishedInterface::class)->willReturn(FALSE);
|
||||
$entity_type->getPermissionGranularity()->willReturn('entity_type');
|
||||
@@ -112,6 +113,7 @@ class EntityPermissionProviderTest extends UnitTestCase {
|
||||
$entity_type->id()->willReturn('white_entity');
|
||||
$entity_type->getSingularLabel()->willReturn('white entity');
|
||||
$entity_type->getPluralLabel()->willReturn('white entities');
|
||||
$entity_type->hasLinkTemplate('collection')->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityOwnerInterface::class)->willReturn(FALSE);
|
||||
$entity_type->entityClassImplements(EntityPublishedInterface::class)->willReturn(FALSE);
|
||||
$entity_type->getPermissionGranularity()->willReturn('bundle');
|
||||
@@ -125,6 +127,8 @@ class EntityPermissionProviderTest extends UnitTestCase {
|
||||
'update second white_entity' => 'Second: Update white entities',
|
||||
'delete second white_entity' => 'Second: Delete white entities',
|
||||
'view white_entity' => 'View white entities',
|
||||
'view first white_entity' => 'First: View white entities',
|
||||
'view second white_entity' => 'Second: View white entities',
|
||||
];
|
||||
$data[] = [$entity_type->reveal(), $expected_permissions];
|
||||
|
||||
@@ -134,6 +138,7 @@ class EntityPermissionProviderTest extends UnitTestCase {
|
||||
$entity_type->id()->willReturn('black_entity');
|
||||
$entity_type->getSingularLabel()->willReturn('black entity');
|
||||
$entity_type->getPluralLabel()->willReturn('black entities');
|
||||
$entity_type->hasLinkTemplate('collection')->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityOwnerInterface::class)->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityPublishedInterface::class)->willReturn(FALSE);
|
||||
$entity_type->getPermissionGranularity()->willReturn('bundle');
|
||||
@@ -146,6 +151,7 @@ class EntityPermissionProviderTest extends UnitTestCase {
|
||||
'delete any third black_entity' => 'Third: Delete any black entity',
|
||||
'delete own third black_entity' => 'Third: Delete own black entities',
|
||||
'view black_entity' => 'View black entities',
|
||||
'view third black_entity' => 'Third: View black entities',
|
||||
];
|
||||
$data[] = [$entity_type->reveal(), $expected_permissions];
|
||||
|
||||
@@ -155,6 +161,7 @@ class EntityPermissionProviderTest extends UnitTestCase {
|
||||
$entity_type->id()->willReturn('pink_entity');
|
||||
$entity_type->getSingularLabel()->willReturn('pink entity');
|
||||
$entity_type->getPluralLabel()->willReturn('pink entities');
|
||||
$entity_type->hasLinkTemplate('collection')->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityOwnerInterface::class)->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityPublishedInterface::class)->willReturn(TRUE);
|
||||
$entity_type->getPermissionGranularity()->willReturn('bundle');
|
||||
@@ -168,6 +175,7 @@ class EntityPermissionProviderTest extends UnitTestCase {
|
||||
'delete any third pink_entity' => 'Third: Delete any pink entity',
|
||||
'delete own third pink_entity' => 'Third: Delete own pink entities',
|
||||
'view pink_entity' => 'View pink entities',
|
||||
'view third pink_entity' => 'Third: View pink entities',
|
||||
];
|
||||
$data[] = [$entity_type->reveal(), $expected_permissions];
|
||||
|
||||
|
||||
+74
-120
@@ -21,7 +21,7 @@ use Drupal\user\EntityOwnerInterface;
|
||||
use Prophecy\Argument;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \Drupal\entity\EntityAccessControlHandler
|
||||
* @coversDefaultClass \Drupal\entity\UncacheableEntityAccessControlHandler
|
||||
* @group entity
|
||||
*/
|
||||
class UncacheableEntityAccessControlHandlerTest extends UnitTestCase {
|
||||
@@ -77,126 +77,75 @@ class UncacheableEntityAccessControlHandlerTest extends UnitTestCase {
|
||||
* A list of testAccess method arguments.
|
||||
*/
|
||||
public function accessProvider() {
|
||||
$data = [];
|
||||
|
||||
$entity_type = $this->prophesize(ContentEntityTypeInterface::class);
|
||||
$entity_type->id()->willReturn('green_entity');
|
||||
$entity_type->getAdminPermission()->willReturn('administer green_entity');
|
||||
$entity_type->hasHandlerClass('permission_provider')->willReturn(TRUE);
|
||||
$entity_type->getHandlerClass('permission_provider')->willReturn(UncacheableEntityPermissionProvider::class);
|
||||
|
||||
// User with the admin permission can do anything.
|
||||
$entity = $this->buildMockEntity($entity_type->reveal());
|
||||
$account = $this->prophesize(AccountInterface::class);
|
||||
$account->id()->willReturn(6);
|
||||
$account->hasPermission('administer green_entity')->willReturn(TRUE);
|
||||
$data[] = [$entity->reveal(), 'view', $account->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), 'update', $account->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), 'delete', $account->reveal(), TRUE];
|
||||
|
||||
// Entity with no owner.
|
||||
$entity = $this->buildMockEntity($entity_type->reveal());
|
||||
// User who has access.
|
||||
$first_account = $this->prophesize(AccountInterface::class);
|
||||
$first_account->id()->willReturn(6);
|
||||
$first_account->hasPermission('view green_entity')->willReturn(TRUE);
|
||||
$first_account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
// User who doesn't have access.
|
||||
$second_account = $this->prophesize(AccountInterface::class);
|
||||
$second_account->id()->willReturn(7);
|
||||
$second_account->hasPermission('view green_entity')->willReturn(FALSE);
|
||||
$second_account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
$data[] = [$entity->reveal(), 'view', $first_account->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), 'view', $second_account->reveal(), FALSE];
|
||||
|
||||
// Entity with owner.
|
||||
$entity = $this->buildMockEntity($entity_type->reveal(), 6);
|
||||
// Owner.
|
||||
$first_account = $this->prophesize(AccountInterface::class);
|
||||
$first_account->id()->willReturn(6);
|
||||
$first_account->hasPermission('update own green_entity')->willReturn(TRUE);
|
||||
$first_account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
// Non-owner.
|
||||
$second_account = $this->prophesize(AccountInterface::class);
|
||||
$second_account->id()->willReturn(7);
|
||||
$second_account->hasPermission('update own green_entity')->willReturn(TRUE);
|
||||
$second_account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
// User who can update any.
|
||||
$third_account = $this->prophesize(AccountInterface::class);
|
||||
$third_account->id()->willReturn(8);
|
||||
$third_account->hasPermission('update any green_entity')->willReturn(TRUE);
|
||||
$third_account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
$data[] = [$entity->reveal(), 'update', $first_account->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), 'update', $second_account->reveal(), FALSE];
|
||||
$data[] = [$entity->reveal(), 'update', $third_account->reveal(), TRUE];
|
||||
|
||||
// Per bundle permissions.
|
||||
$entity_first_other = $this->buildMockEntity($entity_type->reveal(), 9999, 'first');
|
||||
$entity_first_own = $this->buildMockEntity($entity_type->reveal(), 10, 'first');
|
||||
$entity_first_own_bundle = $this->buildMockEntity($entity_type->reveal(), 12, 'first');
|
||||
$data = [];
|
||||
// Admin permission.
|
||||
$admin_user = $this->buildMockUser(5, 'administer green_entity');
|
||||
$data[] = [$entity->reveal(), 'view', $admin_user->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), 'update', $admin_user->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), 'delete', $admin_user->reveal(), TRUE];
|
||||
|
||||
$entity_second_other = $this->buildMockEntity($entity_type->reveal(), 9999, 'second');
|
||||
$entity_second_own = $this->buildMockEntity($entity_type->reveal(), 10, 'second');
|
||||
$entity_second_own_bundle = $this->buildMockEntity($entity_type->reveal(), 12, 'second');
|
||||
|
||||
$user_view_any = $this->buildMockUser(9, 'view any green_entity');
|
||||
$user_view_own = $this->buildMockUser(10, 'view own green_entity');
|
||||
$user_view_bundle_any = $this->buildMockUser(11, 'view any first green_entity');
|
||||
$user_view_bundle_own = $this->buildMockUser(12, 'view own first green_entity');
|
||||
// View, update, delete permissions, entity without an owner.
|
||||
$second_entity = $this->buildMockEntity($entity_type->reveal());
|
||||
foreach (['view', 'update', 'delete'] as $operation) {
|
||||
$first_user = $this->buildMockUser(6, $operation . ' green_entity');
|
||||
$second_user = $this->buildMockUser(7, 'access content');
|
||||
|
||||
$data['entity_first_other user_view_any'] = [$entity_first_other->reveal(), 'view', $user_view_any->reveal(), TRUE];
|
||||
$data['entity_first_own user_view_any'] = [$entity_first_own->reveal(), 'view', $user_view_any->reveal(), TRUE];
|
||||
$data['entity_first_own_bundle user_view_any'] = [$entity_first_own_bundle->reveal(), 'view', $user_view_any->reveal(), TRUE];
|
||||
$data['entity_second_other user_view_any'] = [$entity_second_other->reveal(), 'view', $user_view_any->reveal(), TRUE];
|
||||
$data['entity_second_own user_view_any'] = [$entity_second_own->reveal(), 'view', $user_view_any->reveal(), TRUE];
|
||||
$data['entity_second_own_bundle user_view_any'] = [$entity_second_own_bundle->reveal(), 'view', $user_view_any->reveal(), TRUE];
|
||||
$data[] = [$second_entity->reveal(), $operation, $first_user->reveal(), TRUE];
|
||||
$data[] = [$second_entity->reveal(), $operation, $second_user->reveal(), FALSE];
|
||||
}
|
||||
|
||||
$data['entity_first_other user_view_own'] = [$entity_first_other->reveal(), 'view', $user_view_own->reveal(), FALSE];
|
||||
$data['entity_first_own user_view_own'] = [$entity_first_own->reveal(), 'view', $user_view_own->reveal(), TRUE];
|
||||
$data['entity_first_own_bundle user_view_own'] = [$entity_first_own_bundle->reveal(), 'view', $user_view_own->reveal(), FALSE];
|
||||
$data['entity_second_other user_view_own'] = [$entity_second_other->reveal(), 'view', $user_view_own->reveal(), FALSE];
|
||||
$data['entity_second_own user_view_own'] = [$entity_second_own->reveal(), 'view', $user_view_own->reveal(), TRUE];
|
||||
$data['entity_second_own_bundle user_view_own'] = [$entity_second_own_bundle->reveal(), 'view', $user_view_own->reveal(), FALSE];
|
||||
// View, update, delete permissions.
|
||||
foreach (['view', 'update', 'delete'] as $operation) {
|
||||
// Owner, non-owner, user with "any" permission.
|
||||
$first_user = $this->buildMockUser(6, $operation . ' own green_entity');
|
||||
$second_user = $this->buildMockUser(7, $operation . ' own green_entity');
|
||||
$third_user = $this->buildMockUser(8, $operation . ' any green_entity');
|
||||
|
||||
$data['entity_first_other user_view_bundle_any'] = [$entity_first_other->reveal(), 'view', $user_view_bundle_any->reveal(), TRUE];
|
||||
$data['entity_first_own user_view_bundle_any'] = [$entity_first_own->reveal(), 'view', $user_view_bundle_any->reveal(), TRUE];
|
||||
$data['entity_first_own_bundle user_view_bundle_any'] = [$entity_first_own_bundle->reveal(), 'view', $user_view_bundle_any->reveal(), TRUE];
|
||||
$data['entity_second_other user_view_bundle_any'] = [$entity_second_other->reveal(), 'view', $user_view_bundle_any->reveal(), FALSE];
|
||||
$data['entity_second_own user_view_bundle_any'] = [$entity_second_own->reveal(), 'view', $user_view_bundle_any->reveal(), FALSE];
|
||||
$data['entity_second_own_bundle user_view_bundle_any'] = [$entity_second_own_bundle->reveal(), 'view', $user_view_bundle_any->reveal(), FALSE];
|
||||
$data[] = [$entity->reveal(), $operation, $first_user->reveal(), TRUE];
|
||||
$data[] = [$entity->reveal(), $operation, $second_user->reveal(), FALSE];
|
||||
$data[] = [$entity->reveal(), $operation, $third_user->reveal(), TRUE];
|
||||
}
|
||||
|
||||
$data['entity_first_other user_view_bundle_any'] = [$entity_first_other->reveal(), 'view', $user_view_bundle_own->reveal(), FALSE];
|
||||
$data['entity_first_own user_view_bundle_any'] = [$entity_first_own->reveal(), 'view', $user_view_bundle_own->reveal(), FALSE];
|
||||
$data['entity_first_own_bundle user_view_bundle_any'] = [$entity_first_own_bundle->reveal(), 'view', $user_view_bundle_own->reveal(), TRUE];
|
||||
$data['entity_second_other user_view_bundle_any'] = [$entity_second_other->reveal(), 'view', $user_view_bundle_own->reveal(), FALSE];
|
||||
$data['entity_second_own user_view_bundle_any'] = [$entity_second_own->reveal(), 'view', $user_view_bundle_own->reveal(), FALSE];
|
||||
$data['entity_second_own_bundle user_view_bundle_any'] = [$entity_second_own_bundle->reveal(), 'view', $user_view_bundle_own->reveal(), FALSE];
|
||||
// Per bundle and unpublished view permissions.
|
||||
$first_user = $this->buildMockUser(11, 'view any first green_entity');
|
||||
$second_user = $this->buildMockUser(12, 'view own first green_entity');
|
||||
$third_user = $this->buildMockUser(13, 'view own unpublished green_entity');
|
||||
|
||||
// Test the unpublished permissions.
|
||||
$entity_first_other_up = $this->buildMockEntity($entity_type->reveal(), 9999, 'first', FALSE);
|
||||
$entity_first_own_up = $this->buildMockEntity($entity_type->reveal(), 14, 'first', FALSE);
|
||||
$entity_first_own_bundle_up = $this->buildMockEntity($entity_type->reveal(), 15, 'first', FALSE);
|
||||
$first_entity = $this->buildMockEntity($entity_type->reveal(), 9999, 'first');
|
||||
$second_entity = $this->buildMockEntity($entity_type->reveal(), 12, 'first');
|
||||
$third_entity = $this->buildMockEntity($entity_type->reveal(), 9999, 'second');
|
||||
$fourth_entity = $this->buildMockEntity($entity_type->reveal(), 10, 'second');
|
||||
$fifth_entity = $this->buildMockEntity($entity_type->reveal(), 13, 'first', FALSE);
|
||||
|
||||
$entity_second_other_up = $this->buildMockEntity($entity_type->reveal(), 9999, 'second', FALSE);
|
||||
$entity_second_own_up = $this->buildMockEntity($entity_type->reveal(), 14, 'second', FALSE);
|
||||
$entity_second_own_bundle_up = $this->buildMockEntity($entity_type->reveal(), 15, 'second', FALSE);
|
||||
// The first user can view the two entities of bundle "first".
|
||||
$data[] = [$first_entity->reveal(), 'view', $first_user->reveal(), TRUE];
|
||||
$data[] = [$second_entity->reveal(), 'view', $first_user->reveal(), TRUE];
|
||||
$data[] = [$third_entity->reveal(), 'view', $first_user->reveal(), FALSE];
|
||||
$data[] = [$fourth_entity->reveal(), 'view', $first_user->reveal(), FALSE];
|
||||
$data[] = [$fifth_entity->reveal(), 'view', $first_user->reveal(), FALSE];
|
||||
|
||||
$user_view_own_up = $this->buildMockUser(14, 'view own unpublished green_entity');
|
||||
$user_view_other = $this->buildMockUser(15, 'view green_entity');
|
||||
// The second user can view their own entity of bundle "first".
|
||||
$data[] = [$first_entity->reveal(), 'view', $second_user->reveal(), FALSE];
|
||||
$data[] = [$second_entity->reveal(), 'view', $second_user->reveal(), TRUE];
|
||||
$data[] = [$third_entity->reveal(), 'view', $second_user->reveal(), FALSE];
|
||||
$data[] = [$fourth_entity->reveal(), 'view', $second_user->reveal(), FALSE];
|
||||
$data[] = [$fourth_entity->reveal(), 'view', $second_user->reveal(), FALSE];
|
||||
$data[] = [$fifth_entity->reveal(), 'view', $second_user->reveal(), FALSE];
|
||||
|
||||
$data['entity_first_other_up user_view_own_up'] = [$entity_first_other_up->reveal(), 'view', $user_view_own_up->reveal(), FALSE];
|
||||
$data['entity_first_own_up user_view_own_up'] = [$entity_first_own_up->reveal(), 'view', $user_view_own_up->reveal(), TRUE];
|
||||
$data['entity_first_own_bundle_up user_view_own_up'] = [$entity_first_own_bundle_up->reveal(), 'view', $user_view_own_up->reveal(), FALSE];
|
||||
$data['entity_second_other_up user_view_own_up'] = [$entity_second_other_up->reveal(), 'view', $user_view_own_up->reveal(), FALSE];
|
||||
$data['entity_second_own_up user_view_own_up'] = [$entity_second_own_up->reveal(), 'view', $user_view_own_up->reveal(), TRUE];
|
||||
$data['entity_second_own_bundle_up user_view_own_up'] = [$entity_second_own_bundle_up->reveal(), 'view', $user_view_own_up->reveal(), FALSE];
|
||||
|
||||
$data['entity_first_other_up user_view_other'] = [$entity_first_other_up->reveal(), 'view', $user_view_other->reveal(), FALSE];
|
||||
$data['entity_first_own_up user_view_other'] = [$entity_first_own_up->reveal(), 'view', $user_view_other->reveal(), FALSE];
|
||||
$data['entity_first_own_bundle_up user_view_other'] = [$entity_first_own_bundle_up->reveal(), 'view', $user_view_other->reveal(), FALSE];
|
||||
$data['entity_second_other_up user_view_other'] = [$entity_second_other_up->reveal(), 'view', $user_view_other->reveal(), FALSE];
|
||||
$data['entity_second_own_up user_view_other'] = [$entity_second_own_up->reveal(), 'view', $user_view_other->reveal(), FALSE];
|
||||
$data['entity_second_own_bundle_up user_view_other'] = [$entity_second_own_bundle_up->reveal(), 'view', $user_view_other->reveal(), FALSE];
|
||||
// The third user can only view their own unpublished entity.
|
||||
$data[] = [$first_entity->reveal(), 'view', $third_user->reveal(), FALSE];
|
||||
$data[] = [$second_entity->reveal(), 'view', $third_user->reveal(), FALSE];
|
||||
$data[] = [$third_entity->reveal(), 'view', $third_user->reveal(), FALSE];
|
||||
$data[] = [$fourth_entity->reveal(), 'view', $third_user->reveal(), FALSE];
|
||||
$data[] = [$fourth_entity->reveal(), 'view', $third_user->reveal(), FALSE];
|
||||
$data[] = [$fifth_entity->reveal(), 'view', $third_user->reveal(), TRUE];
|
||||
|
||||
return $data;
|
||||
}
|
||||
@@ -217,29 +166,19 @@ class UncacheableEntityAccessControlHandlerTest extends UnitTestCase {
|
||||
$entity_type->getHandlerClass('permission_provider')->willReturn(UncacheableEntityPermissionProvider::class);
|
||||
|
||||
// User with the admin permission.
|
||||
$account = $this->prophesize(AccountInterface::class);
|
||||
$account->id()->willReturn(6);
|
||||
$account->hasPermission('administer green_entity')->willReturn(TRUE);
|
||||
$account = $this->buildMockUser('6', 'administer green_entity');
|
||||
$data[] = [$entity_type->reveal(), NULL, $account->reveal(), TRUE];
|
||||
|
||||
// Ordinary user.
|
||||
$account = $this->prophesize(AccountInterface::class);
|
||||
$account->id()->willReturn(6);
|
||||
$account->hasPermission('create green_entity')->willReturn(TRUE);
|
||||
$account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
$account = $this->buildMockUser('6', 'create green_entity');
|
||||
$data[] = [$entity_type->reveal(), NULL, $account->reveal(), TRUE];
|
||||
|
||||
// Ordinary user, entity with a bundle.
|
||||
$account = $this->prophesize(AccountInterface::class);
|
||||
$account->id()->willReturn(6);
|
||||
$account->hasPermission('create first_bundle green_entity')->willReturn(TRUE);
|
||||
$account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
$account = $this->buildMockUser('6', 'create first_bundle green_entity');
|
||||
$data[] = [$entity_type->reveal(), 'first_bundle', $account->reveal(), TRUE];
|
||||
|
||||
// User with no permissions.
|
||||
$account = $this->prophesize(AccountInterface::class);
|
||||
$account->id()->willReturn(6);
|
||||
$account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
$account = $this->buildMockUser('6', 'access content');
|
||||
$data[] = [$entity_type->reveal(), NULL, $account->reveal(), FALSE];
|
||||
|
||||
return $data;
|
||||
@@ -252,6 +191,10 @@ class UncacheableEntityAccessControlHandlerTest extends UnitTestCase {
|
||||
* The entity type.
|
||||
* @param string $owner_id
|
||||
* The owner ID.
|
||||
* @param string $bundle
|
||||
* The bundle.
|
||||
* @param bool $published
|
||||
* Whether the entity is published.
|
||||
*
|
||||
* @return \Prophecy\Prophecy\ObjectProphecy
|
||||
* The entity mock.
|
||||
@@ -284,15 +227,26 @@ class UncacheableEntityAccessControlHandlerTest extends UnitTestCase {
|
||||
$entity->getCacheTags()->willReturn([]);
|
||||
$entity->getCacheMaxAge()->willReturn(Cache::PERMANENT);
|
||||
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a mock user.
|
||||
*
|
||||
* @param int $uid
|
||||
* The user ID.
|
||||
* @param string $permission
|
||||
* The permission to grant.
|
||||
*
|
||||
* @return \Prophecy\Prophecy\ObjectProphecy
|
||||
* The user mock.
|
||||
*/
|
||||
protected function buildMockUser($uid, $permission) {
|
||||
$account = $this->prophesize(AccountInterface::class);
|
||||
$account->id()->willReturn($uid);
|
||||
$account->hasPermission($permission)->willReturn(TRUE);
|
||||
$account->hasPermission(Argument::any())->willReturn(FALSE);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -72,12 +72,12 @@ class UncacheableEntityPermissionProviderTest extends UnitTestCase {
|
||||
$entity_type->id()->willReturn('green_entity');
|
||||
$entity_type->getSingularLabel()->willReturn('green entity');
|
||||
$entity_type->getPluralLabel()->willReturn('green entities');
|
||||
$entity_type->hasLinkTemplate('collection')->willReturn(FALSE);
|
||||
$entity_type->entityClassImplements(EntityOwnerInterface::class)->willReturn(FALSE);
|
||||
$entity_type->entityClassImplements(EntityPublishedInterface::class)->willReturn(FALSE);
|
||||
$entity_type->getPermissionGranularity()->willReturn('entity_type');
|
||||
$expected_permissions = [
|
||||
'administer green_entity' => 'Administer green entities',
|
||||
'access green_entity overview' => 'Access the green entities overview page',
|
||||
'create green_entity' => 'Create green entities',
|
||||
'update green_entity' => 'Update green entities',
|
||||
'delete green_entity' => 'Delete green entities',
|
||||
@@ -91,6 +91,7 @@ class UncacheableEntityPermissionProviderTest extends UnitTestCase {
|
||||
$entity_type->id()->willReturn('blue_entity');
|
||||
$entity_type->getSingularLabel()->willReturn('blue entity');
|
||||
$entity_type->getPluralLabel()->willReturn('blue entities');
|
||||
$entity_type->hasLinkTemplate('collection')->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityOwnerInterface::class)->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityPublishedInterface::class)->willReturn(FALSE);
|
||||
$entity_type->getPermissionGranularity()->willReturn('entity_type');
|
||||
@@ -113,6 +114,7 @@ class UncacheableEntityPermissionProviderTest extends UnitTestCase {
|
||||
$entity_type->id()->willReturn('white_entity');
|
||||
$entity_type->getSingularLabel()->willReturn('white entity');
|
||||
$entity_type->getPluralLabel()->willReturn('white entities');
|
||||
$entity_type->hasLinkTemplate('collection')->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityOwnerInterface::class)->willReturn(FALSE);
|
||||
$entity_type->entityClassImplements(EntityPublishedInterface::class)->willReturn(FALSE);
|
||||
$entity_type->getPermissionGranularity()->willReturn('bundle');
|
||||
@@ -137,6 +139,7 @@ class UncacheableEntityPermissionProviderTest extends UnitTestCase {
|
||||
$entity_type->id()->willReturn('black_entity');
|
||||
$entity_type->getSingularLabel()->willReturn('black entity');
|
||||
$entity_type->getPluralLabel()->willReturn('black entities');
|
||||
$entity_type->hasLinkTemplate('collection')->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityOwnerInterface::class)->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityPublishedInterface::class)->willReturn(FALSE);
|
||||
$entity_type->getPermissionGranularity()->willReturn('bundle');
|
||||
@@ -161,6 +164,7 @@ class UncacheableEntityPermissionProviderTest extends UnitTestCase {
|
||||
$entity_type->id()->willReturn('pink_entity');
|
||||
$entity_type->getSingularLabel()->willReturn('pink entity');
|
||||
$entity_type->getPluralLabel()->willReturn('pink entities');
|
||||
$entity_type->hasLinkTemplate('collection')->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityOwnerInterface::class)->willReturn(TRUE);
|
||||
$entity_type->entityClassImplements(EntityPublishedInterface::class)->willReturn(TRUE);
|
||||
$entity_type->getPermissionGranularity()->willReturn('bundle');
|
||||
|
||||
Reference in New Issue
Block a user