You are here

public function AggregatorDisplayConfigurableTest::testItemDisplayConfigurable in Drupal 8

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

Sets item base fields to configurable display and checks settings are respected.

File

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

Class

AggregatorDisplayConfigurableTest
Tests making aggregator_feed and aggregator_item base fields' displays configurable.

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());
}