You are here

protected function RdfParsingTrait::hasRdfProperty in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/rdf/tests/src/Traits/RdfParsingTrait.php \Drupal\Tests\rdf\Traits\RdfParsingTrait::hasRdfProperty()

Checks if a html document contains a resource with a given property value.

Parameters

string $html: The HTML to parse.

string $base_uri: The base URI for the html being parsed.

string $resource: The URI of the resource which should have the given property.

string $property: The property being tested.

array $value: The expected value. This should include the following keys:

Return value

bool TRUE if the property exists with the given value.

17 calls to RdfParsingTrait::hasRdfProperty()
CommentAttributesTest::testCommentReplyOfRdfaMarkup in core/modules/rdf/tests/src/Functional/CommentAttributesTest.php
Tests RDF comment replies.
CommentAttributesTest::testNumberOfCommentsRdfaMarkup in core/modules/rdf/tests/src/Functional/CommentAttributesTest.php
Tests the presence of the RDFa markup for the number of comments.
CommentAttributesTest::_testBasicCommentRdfaMarkup in core/modules/rdf/tests/src/Functional/CommentAttributesTest.php
Helper function for testCommentRdfaMarkup().
EntityReferenceFieldAttributesTest::testNodeTeaser in core/modules/rdf/tests/src/Functional/EntityReferenceFieldAttributesTest.php
Tests if file fields in teasers have correct resources.
FieldRdfaTestBase::assertFormatterRdfa in core/modules/rdf/tests/src/Kernel/Field/FieldRdfaTestBase.php
Helper function to test the formatter's RDFa.

... See full list

File

core/modules/rdf/tests/src/Traits/RdfParsingTrait.php, line 43

Class

RdfParsingTrait
Defines a trait for parsing RDF properties from HTML.

Namespace

Drupal\Tests\rdf\Traits

Code

protected function hasRdfProperty($html, $base_uri, $resource, $property, array $value) {
  $parser = new \EasyRdf_Parser_Rdfa();
  $graph = new \EasyRdf_Graph();
  $parser
    ->parse($graph, $html, 'rdfa', $base_uri);
  return $graph
    ->hasProperty($resource, $property, $value);
}