protected function XMLSitemapTestHelper::assertSitemapLinkValues in XML sitemap 7.2
Same name and namespace in other branches
- 6.2 xmlsitemap.test \XMLSitemapTestHelper::assertSitemapLinkValues()
Assert Sitemap Link Values.
4 calls to XMLSitemapTestHelper::assertSitemapLinkValues()
- XMLSitemapCustomFunctionalTest::testCustomLinks in xmlsitemap_custom/
xmlsitemap_custom.test - Test Custom Links.
- XMLSitemapNodeFunctionalTest::testCron in xmlsitemap_node/
xmlsitemap_node.test - Test the import of old nodes via cron.
- XMLSitemapNodeFunctionalTest::testNodeSettings in xmlsitemap_node/
xmlsitemap_node.test - Node Settings.
- XMLSitemapNodeFunctionalTest::testTypeSettings in xmlsitemap_node/
xmlsitemap_node.test - Test the content type settings.
File
- ./
xmlsitemap.test, line 158 - Unit tests for the xmlsitemap.
Class
- XMLSitemapTestHelper
- Helper test class with some added functions for testing.
Code
protected function assertSitemapLinkValues($entity_type, $entity_id, array $conditions) {
$link = xmlsitemap_link_load($entity_type, $entity_id);
if (!$link) {
return $this
->fail(t('Could not load sitemap link for @type @id.', array(
'@type' => $entity_type,
'@id' => $entity_id,
)));
}
foreach ($conditions as $key => $value) {
if ($value === NULL || $link[$key] === NULL) {
// For nullable fields, always check for identical values (===).
$this
->assertIdentical($link[$key], $value, t('Identical values for @type @id link field @key.', array(
'@type' => $entity_type,
'@id' => $entity_id,
'@key' => $key,
)));
}
else {
// Otherwise check simple equality (==).
$this
->assertEqual($link[$key], $value, t('Equal values for @type @id link field @key.', array(
'@type' => $entity_type,
'@id' => $entity_id,
'@key' => $key,
)));
}
}
}