EntityTestViewsFieldAccessTest.php in Drupal 8
File
core/modules/views/tests/src/Kernel/Handler/EntityTestViewsFieldAccessTest.php
View source
<?php
namespace Drupal\Tests\views\Kernel\Handler;
use Drupal\entity_test\Entity\EntityTest;
class EntityTestViewsFieldAccessTest extends FieldFieldAccessTestBase {
public static $modules = [
'entity_test',
];
protected function setUp($import_test_views = TRUE) {
parent::setUp($import_test_views);
$this
->installEntitySchema('entity_test');
}
public function testEntityTestFields() {
$entity_test = EntityTest::create([
'name' => 'test entity name',
]);
$entity_test
->save();
$this
->assertFieldAccess('entity_test', 'id', $entity_test
->id());
$this
->assertFieldAccess('entity_test', 'langcode', $entity_test
->language()
->getName());
$this
->assertFieldAccess('entity_test', 'name', $entity_test
->getName());
}
}