protected function XMLSitemapTestHelper::assertNotSitemapLinkValues in XML sitemap 7.2
Same name and namespace in other branches
- 6.2 xmlsitemap.test \XMLSitemapTestHelper::assertNotSitemapLinkValues()
Assert Not Sitemap Link Values.
File
- ./
xmlsitemap.test, line 191 - Unit tests for the xmlsitemap.
Class
- XMLSitemapTestHelper
- Helper test class with some added functions for testing.
Code
protected function assertNotSitemapLinkValues($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
->assertNotIdentical($link[$key], $value, t('Not identical values for @type @id link field @key.', array(
'@type' => $entity_type,
'@id' => $entity_id,
'@key' => $key,
)));
}
else {
// Otherwise check simple equality (==).
$this
->assertNotEqual($link[$key], $value, t('Not equal values for link @type @id field @key.', array(
'@type' => $entity_type,
'@id' => $entity_id,
'@key' => $key,
)));
}
}
}