Commit 97eb4137 authored by catch's avatar catch
Browse files

Issue #3303278 by smustgrave, longwave: Decouple NodeDisplayConfigurableTest from RDF module

parent 42a77435
Loading
Loading
Loading
Loading
+0 −40
Original line number Diff line number Diff line
langcode: en
status: true
dependencies:
  config:
    - node.type.page
  module:
    - node
id: node.page
targetEntityType: node
bundle: page
types:
  - 'schema:WebPage'
fieldMappings:
  title:
    properties:
      - 'schema:name'
  created:
    properties:
      - 'schema:dateCreated'
    datatype_callback:
      callable: 'Drupal\rdf\CommonDataConverter::dateIso8601Value'
  changed:
    properties:
      - 'schema:dateModified'
    datatype_callback:
      callable: 'Drupal\rdf\CommonDataConverter::dateIso8601Value'
  body:
    properties:
      - 'schema:text'
  uid:
    properties:
      - 'schema:author'
    mapping_type: rel
  comment_count:
    properties:
      - 'schema:interactionCount'
    datatype_callback:
      callable: 'Drupal\rdf\SchemaOrgDataConverter::interactionCount'
      arguments:
        interaction_type: UserComments
+6 −7
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ class NodeDisplayConfigurableTest extends NodeTestBase {
   *
   * @var array
   */
  protected static $modules = ['rdf', 'block'];
  protected static $modules = ['block'];

  /**
   * {@inheritdoc}
@@ -90,15 +90,12 @@ public function testDisplayConfigurable(string $theme, string $metadata_region,

    $this->assertNodeHtml($node, $user, FALSE, $metadata_region, $field_classes, FALSE);

    $assert->elementExists('css', 'div[rel="schema:author"]');

    // Remove from display.
    $display->removeComponent('uid')
      ->removeComponent('created')
      ->save();

    $this->drupalGet($node->toUrl());
    $assert->elementNotExists('css', 'div[rel="schema:author"]');
    $assert->elementTextNotContains('css', 'article', $user->getAccountName());
  }

@@ -148,12 +145,14 @@ protected function assertNodeHtml(NodeInterface $node, UserInterface $user, bool
    if (!$is_inline) {
      $field_classes_selector = $field_classes ? "[contains(concat(' ', normalize-space(@class), ' '), ' field--name-uid ')]" : '';
      $assert->elementExists('xpath', sprintf('//article//%s//*%s//%s[text()="Authored by"]', $html_element, $field_classes_selector, $html_element));
      $assert->elementTextContains('css', "$uid_selector $html_element" . '[rel="schema:author"]', $user->getAccountName());
      $assert->elementTextContains('css', $uid_selector, $user->getAccountName());
      $assert->elementNotExists('css', "$uid_selector a");
      $assert->elementExists('css', 'span[property="schema:dateCreated"]');
      if ($field_classes) {
        $assert->elementExists('css', $created_selector);
      }
    }
    else {
      $assert->elementTextContains('css', $uid_selector . ' a[property="schema:name"]', $user->getAccountName());
      $assert->elementTextContains('css', $uid_selector . ' a', $user->getAccountName());
      $assert->elementTextContains('css', 'article ' . $metadata_region, 'Submitted by');
    }
  }