You are here

protected function StandardProfileTest::doArticleRdfaTests in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/rdf/tests/src/Functional/StandardProfileTest.php \Drupal\Tests\rdf\Functional\StandardProfileTest::doArticleRdfaTests()
  2. 10 core/modules/rdf/tests/src/Functional/StandardProfileTest.php \Drupal\Tests\rdf\Functional\StandardProfileTest::doArticleRdfaTests()

Tests that article data is exposed using RDFa.

Two fields are not tested for output here. Changed date is not displayed on the page, so there is no test for output in node view. Comment count is displayed in teaser view, so it is tested in the front article tests.

1 call to StandardProfileTest::doArticleRdfaTests()
StandardProfileTest::testRdfaOutput in core/modules/rdf/tests/src/Functional/StandardProfileTest.php
Tests that data is exposed correctly when using standard profile.

File

core/modules/rdf/tests/src/Functional/StandardProfileTest.php, line 248

Class

StandardProfileTest
Tests the RDF mappings and RDFa markup of the standard profile.

Namespace

Drupal\Tests\rdf\Functional

Code

protected function doArticleRdfaTests() {

  // Feed the HTML into the parser.
  $this
    ->drupalGet($this->article
    ->toUrl());

  // Type.
  $this
    ->assertEqual($this
    ->getElementRdfType($this->article
    ->toUrl(), $this->baseUri, $this->articleUri), 'schema:Article', 'Article type was found (schema:Article).');

  // Test the properties that are common between pages and articles.
  $this
    ->assertRdfaCommonNodeProperties($this->article, "Article");

  // Test properties that are displayed in both teaser and full mode.
  $this
    ->assertRdfaArticleProperties("Article");

  // Test the comment properties displayed on articles.
  $this
    ->assertRdfaNodeCommentProperties();

  // @todo Once the image points to the original instead of the processed
  //   image, move this to testArticleProperties().
  $expected_value = [
    'type' => 'uri',
    'value' => $this->imageUri,
  ];
  $this
    ->assertTrue($this
    ->hasRdfProperty($this
    ->getSession()
    ->getPage()
    ->getContent(), $this->baseUri, $this->articleUri, 'http://schema.org/image', $expected_value), 'Teaser image was found (schema:image).');
}