protected function RdfParsingTrait::getElementByRdfTypeCount in Drupal 9
Same name and namespace in other branches
- 8 core/modules/rdf/tests/src/Traits/RdfParsingTrait.php \Drupal\Tests\rdf\Traits\RdfParsingTrait::getElementByRdfTypeCount()
- 10 core/modules/rdf/tests/src/Traits/RdfParsingTrait.php \Drupal\Tests\rdf\Traits\RdfParsingTrait::getElementByRdfTypeCount()
Counts the number of resources of the provided type.
Parameters
\Drupal\Core\Url $url: URL of the document.
string $base_uri: The base URI for the html being parsed.
string $type: Type of resource to count.
Return value
int The number of resources of the provided type.
Throws
\EasyRdf\Exception
1 call to RdfParsingTrait::getElementByRdfTypeCount()
- StandardProfileTest::doFrontPageRdfaTests in core/
modules/ rdf/ tests/ src/ Functional/ StandardProfileTest.php - Tests that data is exposed in the front page teasers.
File
- core/
modules/ rdf/ tests/ src/ Traits/ RdfParsingTrait.php, line 97
Class
- RdfParsingTrait
- Defines a trait for parsing RDF properties from HTML.
Namespace
Drupal\Tests\rdf\TraitsCode
protected function getElementByRdfTypeCount(Url $url, $base_uri, $type) {
$parser = $this
->getInstanceParser();
$graph = $this
->getInstanceGraph();
$parser
->parse($graph, $this
->drupalGet($url), 'rdfa', $base_uri);
return count($graph
->allOfType($type));
}