AggregatorItemViewsFieldAccessTest.php in Drupal 8
File
core/modules/aggregator/tests/src/Kernel/Views/AggregatorItemViewsFieldAccessTest.php
View source
<?php
namespace Drupal\Tests\aggregator\Kernel\Views;
use Drupal\aggregator\Entity\Feed;
use Drupal\aggregator\Entity\Item;
use Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase;
class AggregatorItemViewsFieldAccessTest extends FieldFieldAccessTestBase {
public static $modules = [
'aggregator',
'entity_test',
'options',
];
protected function setUp($import_test_views = TRUE) {
parent::setUp($import_test_views);
$this
->installEntitySchema('aggregator_feed');
$this
->installEntitySchema('aggregator_item');
}
public function testAggregatorItemFields() {
$feed = Feed::create([
'title' => 'Drupal org',
'url' => 'https://www.drupal.org/rss.xml',
]);
$feed
->save();
$item = Item::create([
'title' => 'Test title',
'fid' => $feed
->id(),
'description' => 'Test description',
]);
$item
->save();
$this
->assertFieldAccess('aggregator_item', 'title', $item
->getTitle());
$this
->assertFieldAccess('aggregator_item', 'langcode', $item
->language()
->getName());
$this
->assertFieldAccess('aggregator_item', 'description', $item
->getDescription());
}
}