function LanguageHierarchyPathsFunctionalTest::checkCanonicalPathAndText in Language Hierarchy 7
Check that the canonical path of a path is that path, and that the necessary text was found on it, proving the lookup worked in both directions.
Parameters
string $path Path to test.:
string $text Text to check.:
string $language_name Language name to use in messages to display.:
null $clear_path_cache If specified, clear the cache for this path.:
1 call to LanguageHierarchyPathsFunctionalTest::checkCanonicalPathAndText()
- LanguageHierarchyPathsFunctionalTest::checkLookups in modules/
language_hierarchy_paths/ language_hierarchy_paths.test - Test path lookups via the page canonical path and node title.
File
- modules/
language_hierarchy_paths/ language_hierarchy_paths.test, line 208 - Tests for language_hierarchy_paths.module.
Class
- LanguageHierarchyPathsFunctionalTest
- Functional tests for configuring a different path alias per language.
Code
function checkCanonicalPathAndText($path, $text, $language_name, $clear_path_cache = NULL) {
global $base_path;
if ($clear_path_cache) {
cache_clear_all($clear_path_cache, 'cache_path');
}
$this
->drupalGet($path);
$message = $language_name . ' alias';
if (!$clear_path_cache) {
$message .= ' from cache';
}
$message .= ' is correctly matched for the canonical URL.';
$href = $path;
if (empty($this->originalCleanUrl)) {
$href = '?q=' . $href;
}
$href = $base_path . $href;
$this
->assertRaw('<link rel="canonical" href="' . $href . '" />', $message);
$this
->assertText($text, $language_name . ' alias was matched to the correct page.');
}