3492ff150d96e652176806d78e4e9c2827d0975b
[yaffs-website] / web / core / modules / views / tests / src / Kernel / Handler / EntityTestViewsFieldAccessTest.php
1 <?php
2
3 namespace Drupal\Tests\views\Kernel\Handler;
4 use Drupal\entity_test\Entity\EntityTest;
5
6 /**
7  * Tests base field access in Views for the entity_test entity.
8  *
9  * @group entity_test
10  */
11 class EntityTestViewsFieldAccessTest extends FieldFieldAccessTestBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   public static $modules = ['entity_test'];
17
18   /**
19    * {@inheritdoc}
20    */
21   protected function setUp($import_test_views = TRUE) {
22     parent::setUp($import_test_views);
23
24     $this->installEntitySchema('entity_test');
25   }
26
27   public function testEntityTestFields() {
28     $entity_test = EntityTest::create([
29       'name' => 'test entity name',
30     ]);
31     $entity_test->save();
32
33     // @todo Expand the test coverage in https://www.drupal.org/node/2464635
34
35     $this->assertFieldAccess('entity_test', 'id', $entity_test->id());
36     $this->assertFieldAccess('entity_test', 'langcode', $entity_test->language()->getName());
37     $this->assertFieldAccess('entity_test', 'name', $entity_test->getName());
38   }
39
40 }