class RssViewIntegrationTest
@group rdf @group legacy
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\rdf\Functional\RssViewIntegrationTest extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of RssViewIntegrationTest
File
-
core/
modules/ rdf/ tests/ src/ Functional/ RssViewIntegrationTest.php, line 11
Namespace
Drupal\Tests\rdf\FunctionalView source
class RssViewIntegrationTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'rdf_test_namespaces',
'views',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests that RSS views have RDF's XML namespaces defined.
*/
public function testRdfNamespacesAreAddedToRssViews() : void {
// RDF's namespaces are only attached when there is content in the feed.
$node_type = $this->drupalCreateContentType()
->id();
$this->drupalCreateNode([
'type' => $node_type,
]);
$this->drupalGet('rdf-rss-test');
$this->assertSession()
->statusCodeEquals(200);
// Mink insists on treating the page as an HTML document, so we have to use
// PHP's built-in DOM extension to examine the RSS feed.
$xml = $this->getSession()
->getPage()
->getContent();
$document = new \DOMDocument();
$this->assertTrue($document->loadXML($xml));
foreach (rdf_get_namespaces() as $prefix => $uri) {
if ($prefix === 'dc') {
continue;
}
$this->assertSame($uri, $document->lookupNamespaceURI($prefix));
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.