f7c3c0bdfd43e353f9e1862ed5a4edacc9b288e9
[yaffs-website] / web / core / modules / field / tests / src / Unit / FieldConfigAccessControlHandlerTest.php
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->entity->getName(),
25       'entity_type' => 'node',
26       'fieldStorage' => $this->entity,
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 }