comparison core/modules/field/tests/src/Unit/FieldConfigAccessControlHandlerTest.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 1fec387a4317
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Tests\field\Unit;
4
5 use Drupal\field\Entity\FieldConfig;
6 use Drupal\field\FieldConfigAccessControlHandler;
7
8 /**
9 * Tests the field config access controller.
10 *
11 * @group field
12 *
13 * @coversDefaultClass \Drupal\field\FieldConfigAccessControlHandler
14 */
15 class FieldConfigAccessControlHandlerTest extends FieldStorageConfigAccessControlHandlerTest {
16
17 /**
18 * {@inheritdoc}
19 */
20 protected function setUp() {
21 parent::setUp();
22
23 $this->entity = new FieldConfig([
24 'field_name' => $this->fieldStorage->getName(),
25 'entity_type' => 'node',
26 'fieldStorage' => $this->fieldStorage,
27 'bundle' => 'test_bundle',
28 'field_type' => 'test_field',
29 ], 'node');
30
31 $this->accessControlHandler = new FieldConfigAccessControlHandler($this->entity->getEntityType());
32 $this->accessControlHandler->setModuleHandler($this->moduleHandler);
33 }
34
35 /**
36 * Ensures field config access is working properly.
37 */
38 public function testAccess() {
39 $this->assertAllowOperations([], $this->anon);
40 $this->assertAllowOperations(['view', 'update', 'delete'], $this->member);
41 }
42
43 }