function RdfParsingTrait::hasRdfChildProperty

Same name in other branches
  1. 8.9.x core/modules/rdf/tests/src/Traits/RdfParsingTrait.php \Drupal\Tests\rdf\Traits\RdfParsingTrait::hasRdfChildProperty()

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 $parent_property: The parent property being tested.

string $child_property: The child 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.

Throws

\EasyRdf\Exception

1 call to RdfParsingTrait::hasRdfChildProperty()
CommentAttributesTest::_testBasicCommentRdfaMarkup in core/modules/rdf/tests/src/Functional/CommentAttributesTest.php
Helper function for testCommentRdfaMarkup().

File

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

Class

RdfParsingTrait
Defines a trait for parsing RDF properties from HTML.

Namespace

Drupal\Tests\rdf\Traits

Code

protected function hasRdfChildProperty($html, $base_uri, $resource, $parent_property, string $child_property, array $value) {
    $parser = $this->getInstanceParser();
    $graph = $this->getInstanceGraph();
    $parser->parse($graph, $html, 'rdfa', $base_uri);
    $node = $graph->get($resource, $parent_property);
    return $graph->hasProperty($node, $child_property, $value);
}

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