function AggregatorItemViewsFieldAccessTest::testAggregatorItemFields

Same name and namespace in other branches
  1. 9 core/modules/aggregator/tests/src/Kernel/Views/AggregatorItemViewsFieldAccessTest.php \Drupal\Tests\aggregator\Kernel\Views\AggregatorItemViewsFieldAccessTest::testAggregatorItemFields()

Checks access for aggregator_item fields.

File

core/modules/aggregator/tests/src/Kernel/Views/AggregatorItemViewsFieldAccessTest.php, line 34

Class

AggregatorItemViewsFieldAccessTest
Tests base field access in Views for the aggregator_item entity.

Namespace

Drupal\Tests\aggregator\Kernel\Views

Code

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();
    // @todo Expand the test coverage in https://www.drupal.org/node/2464635
    $this->assertFieldAccess('aggregator_item', 'title', $item->getTitle());
    $this->assertFieldAccess('aggregator_item', 'langcode', $item->language()
        ->getName());
    $this->assertFieldAccess('aggregator_item', 'description', $item->getDescription());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.