| 7 upgrade.locale.test | public LocaleUpgradePathTestCase::testLocaleUpgradeDomain() |
Test an upgrade with domain-based negotiation.
File
- modules/
simpletest/ tests/ upgrade/ upgrade.locale.test, line 94
Code
public function testLocaleUpgradeDomain() {
// LANGUAGE_NEGOTIATION_DOMAIN.
$this->variable_set('language_negotiation', 3);
$this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
// The home page should be in French.
$this->assertPageInLanguage('', 'fr');
// The language switcher block should be displayed.
$this->assertRaw('block-locale-language', t('The language switcher block is displayed.'));
// The language switcher block should point to http://en.example.com.
$language_links = $this->xpath('//ul[contains(@class, :class)]/li/a', array(':class' => 'language-switcher-locale-url'));
$found_english_link = FALSE;
foreach ($language_links as $link) {
if ((string) $link['href'] == 'http://en.example.com/') {
$found_english_link = TRUE;
}
}
$this->assertTrue($found_english_link, t('The English link points to the correct domain.'));
// Both prefixes should be inactive.
$this->drupalGet('en');
$this->assertResponse(404);
$this->drupalGet('fr');
$this->assertResponse(404);
}
Login or register to post comments