function LanguageHierarchyPathsFunctionalTest::checkLookups in Language Hierarchy 7
Test path lookups via the page canonical path and node title.
Canonical paths are used for the test as those are produced by node_page_view() via calls to url(), which uses drupal_get_path_alias() and therefore drupal_lookup_path(). Testing the node title is done to check that the reverse lookup, drupal_get_normal_path() worked correctly - i.e. that on visiting the alias, the correct system path was found.
1 call to LanguageHierarchyPathsFunctionalTest::checkLookups()
- LanguageHierarchyPathsFunctionalTest::testLanguageHierarchyPathsLookup in modules/
language_hierarchy_paths/ language_hierarchy_paths.test - Test if language hierarchies are used for path aliases associated with language.
File
- modules/
language_hierarchy_paths/ language_hierarchy_paths.test, line 148 - Tests for language_hierarchy_paths.module.
Class
- LanguageHierarchyPathsFunctionalTest
- Functional tests for configuring a different path alias per language.
Code
function checkLookups($paths, $node_title, $page_node_paths, $clear_path_cache = NULL) {
foreach ($paths as $langcode) {
if (isset($this->languages[$langcode])) {
$language_name = $this->languages[$langcode]['name'];
if (isset($this->languages[$langcode]['parent_language_list'])) {
$parent_langcode = $this->languages[$langcode]['parent_language_list'];
$alias = $page_node_paths[$parent_langcode]['alias'];
}
elseif (isset($page_node_paths[$langcode]['alias'])) {
$alias = $page_node_paths[$langcode]['alias'];
}
else {
$this
->fail($language_name . ' has no alias.');
continue;
}
$alias = $langcode . '/' . $alias;
}
else {
$language_name = 'English';
$alias = $page_node_paths[$langcode]['alias'];
}
$this
->checkCanonicalPathAndText($alias, $node_title, $language_name, $clear_path_cache);
}
}