protected function XmlSitemapTestBase::assertNotSitemapLinkValues in XML sitemap 8
Same name and namespace in other branches
- 2.x tests/src/Functional/XmlSitemapTestBase.php \Drupal\Tests\xmlsitemap\Functional\XmlSitemapTestBase::assertNotSitemapLinkValues()
Assert Not Sitemap Link Values.
File
- tests/
src/ Functional/ XmlSitemapTestBase.php, line 276
Class
- XmlSitemapTestBase
- Helper test class with some added functions for testing.
Namespace
Drupal\Tests\xmlsitemap\FunctionalCode
protected function assertNotSitemapLinkValues($entity_type, $entity_id, array $conditions) {
$link = $this->linkStorage
->load($entity_type, $entity_id);
if (!$link) {
return $this
->fail(sprintf('Could not load sitemap link for %s %s.', $entity_type, $entity_id));
}
foreach ($conditions as $key => $value) {
if ($value === NULL || $link[$key] === NULL) {
// For nullable fields, always check for identical values (===).
$this
->assertNotSame($value, $link[$key], t('Not identical values for @type @id link field @key.', [
'@type' => $entity_type,
'@id' => $entity_id,
'@key' => $key,
]));
}
else {
// Otherwise check simple equality (==).
$this
->assertNotEquals($value, $link[$key], t('Not equal values for link @type @id field @key.', [
'@type' => $entity_type,
'@id' => $entity_id,
'@key' => $key,
]));
}
}
}