function AggregatorDisplayConfigurableTest::testItemDisplayConfigurable

Same name and namespace in other branches
  1. 8.9.x core/modules/aggregator/tests/src/Functional/AggregatorDisplayConfigurableTest.php \Drupal\Tests\aggregator\Functional\AggregatorDisplayConfigurableTest::testItemDisplayConfigurable()

Tests item base fields settings.

File

core/modules/aggregator/tests/src/Functional/AggregatorDisplayConfigurableTest.php, line 80

Class

AggregatorDisplayConfigurableTest
Tests aggregator_feed and aggregator_item base fields' displays.

Namespace

Drupal\Tests\aggregator\Functional

Code

public function testItemDisplayConfigurable() {
  $this->createSampleNodes(1);
  $item = Node::load(1);
  $feed = $this->createFeed();
  $this->updateFeedItems($feed);
  $assert = $this->assertSession();
  // Check the aggregator_feed with Drupal default non-configurable display.
  $this->drupalGet('/aggregator');
  $assert->elementTextContains('css', 'h3.feed-item-title', $item->label());
  $assert->elementNotExists('css', '.field--name-title .field__item');
  $assert->elementNotExists('css', '.field--name-title .field__label');
  // Enable helper module to make base fields' displays configurable.
  \Drupal::service('module_installer')->install([
    'aggregator_display_configurable_test',
  ]);
  // Recheck the aggregator_feed with configurable display.
  $this->drupalGet('/aggregator');
  $assert->elementNotExists('css', 'h3.feed-item-title');
  $assert->elementTextContains('css', 'div.field--name-title > div.field__item', $item->label());
}

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