protected function XmlSitemapTestBase::assertSitemapLinkValues in XML sitemap 8
Same name and namespace in other branches
- 2.x tests/src/Functional/XmlSitemapTestBase.php \Drupal\Tests\xmlsitemap\Functional\XmlSitemapTestBase::assertSitemapLinkValues()
Assert Sitemap Link Values.
8 calls to XmlSitemapTestBase::assertSitemapLinkValues()
- XmlSitemapEntityFunctionalTest::testEntitiesSettingsForms in tests/
src/ Functional/ XmlSitemapEntityFunctionalTest.php - Test the form at admin/config/search/xmlsitemap/entities/settings.
- XmlSitemapEntityFunctionalTest::testEntityLinkBundleSettingsForm in tests/
src/ Functional/ XmlSitemapEntityFunctionalTest.php - Test Entity Link Bundle Settings Form.
- XmlSitemapEntityFunctionalTest::testUserCannotViewEntity in tests/
src/ Functional/ XmlSitemapEntityFunctionalTest.php - Test User Cannot View Entity.
- XmlSitemapNodeFunctionalTest::testCron in tests/
src/ Functional/ XmlSitemapNodeFunctionalTest.php - Test the import of old nodes via cron.
- XmlSitemapNodeFunctionalTest::testNodeSettings in tests/
src/ Functional/ XmlSitemapNodeFunctionalTest.php - Test Node Settings.
File
- tests/
src/ Functional/ XmlSitemapTestBase.php, line 244
Class
- XmlSitemapTestBase
- Helper test class with some added functions for testing.
Namespace
Drupal\Tests\xmlsitemap\FunctionalCode
protected function assertSitemapLinkValues($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
->assertSame($value, $link[$key], t('Identical values for @type @id link field @key.', [
'@type' => $entity_type,
'@id' => $entity_id,
'@key' => $key,
]));
}
else {
// Otherwise check simple equality (==).
$this
->assertEquals($value, $link[$key], t('Equal values for @type @id link field @key - @a - @b.', [
'@type' => $entity_type,
'@id' => $entity_id,
'@key' => $key,
'@a' => $link[$key],
'@b' => $value,
]));
}
}
}