Pull merge.
[yaffs-website] / web / core / modules / aggregator / tests / src / Kernel / Views / AggregatorItemViewsFieldAccessTest.php
1 <?php
2
3 namespace Drupal\Tests\aggregator\Kernel\Views;
4
5 use Drupal\aggregator\Entity\Feed;
6 use Drupal\aggregator\Entity\Item;
7 use Drupal\Tests\views\Kernel\Handler\FieldFieldAccessTestBase;
8
9 /**
10  * Tests base field access in Views for the aggregator_item entity.
11  *
12  * @group aggregator
13  */
14 class AggregatorItemViewsFieldAccessTest extends FieldFieldAccessTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['aggregator', 'entity_test', 'options'];
20
21   /**
22    * {@inheritdoc}
23    */
24   protected function setUp($import_test_views = TRUE) {
25     parent::setUp($import_test_views);
26
27     $this->installEntitySchema('aggregator_feed');
28     $this->installEntitySchema('aggregator_item');
29   }
30
31   /**
32    * Checks access for aggregator_item fields.
33    */
34   public function testAggregatorItemFields() {
35     $feed = Feed::create([
36       'title' => 'Drupal org',
37       'url' => 'https://www.drupal.org/rss.xml',
38     ]);
39     $feed->save();
40     $item = Item::create([
41       'title' => 'Test title',
42       'fid' => $feed->id(),
43       'description' => 'Test description',
44     ]);
45
46     $item->save();
47
48     // @todo Expand the test coverage in https://www.drupal.org/node/2464635
49
50     $this->assertFieldAccess('aggregator_item', 'title', $item->getTitle());
51     $this->assertFieldAccess('aggregator_item', 'langcode', $item->language()->getName());
52     $this->assertFieldAccess('aggregator_item', 'description', $item->getDescription());
53   }
54
55 }