| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 | 
							- <?php
 
- /**
 
-  * Upgrade test for locale.module.
 
-  */
 
- class LocaleUpgradePathTestCase extends UpgradePathTestCase {
 
-   public static function getInfo() {
 
-     return array(
 
-       'name'  => 'Locale upgrade path',
 
-       'description'  => 'Upgrade path tests for the Locale module.',
 
-       'group' => 'Upgrade path',
 
-     );
 
-   }
 
-   public function setUp() {
 
-     // Path to the database dump files.
 
-     $this->databaseDumpFiles = array(
 
-       drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
 
-       drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.locale.database.php',
 
-     );
 
-     parent::setUp();
 
-     $this->uninstallModulesExcept(array('locale', 'comment'));
 
-   }
 
-   /**
 
-    * Test a successful upgrade (no negotiation).
 
-    */
 
-   public function testLocaleUpgrade() {
 
-     $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
 
-     // The home page should be in French.
 
-     $this->assertPageInLanguage('', 'fr');
 
-     // No prefixed page should exist.
 
-     $this->drupalGet('en');
 
-     $this->assertResponse(404);
 
-     $this->drupalGet('fr');
 
-     $this->assertResponse(404);
 
-   }
 
-   /**
 
-    * Test an upgrade with path-based negotiation.
 
-    */
 
-   public function testLocaleUpgradePathDefault() {
 
-     // LANGUAGE_NEGOTIATION_PATH_DEFAULT.
 
-     $this->variable_set('language_negotiation', 1);
 
-     $this->assertTrue($this->performUpgrade(), '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', 'The language switcher block is displayed.');
 
-     // The French prefix should not be active because French is the default language.
 
-     $this->drupalGet('fr');
 
-     $this->assertResponse(404);
 
-     // The English prefix should be active.
 
-     $this->assertPageInLanguage('en', 'en');
 
-   }
 
-   /**
 
-    * Test an upgrade with path-based (with fallback) negotiation.
 
-    */
 
-   public function testLocaleUpgradePathFallback() {
 
-     // LANGUAGE_NEGOTIATION_PATH.
 
-     $this->variable_set('language_negotiation', 2);
 
-     // Set the language of the admin user to English.
 
-     db_update('users')
 
-       ->fields(array('language' => 'en'))
 
-       ->condition('uid', 1)
 
-       ->execute();
 
-     $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
 
-     // Both prefixes should be active.
 
-     $this->assertPageInLanguage('fr', 'fr');
 
-     $this->assertPageInLanguage('en', 'en');
 
-     // The home page should be in the admin user language.
 
-     $this->assertPageInLanguage('', 'en');
 
-     // The language switcher block should be displayed.
 
-     $this->assertRaw('block-locale-language', 'The language switcher block is displayed.');
 
-   }
 
-   /**
 
-    * Test an upgrade with domain-based negotiation.
 
-    */
 
-   public function testLocaleUpgradeDomain() {
 
-     // LANGUAGE_NEGOTIATION_DOMAIN.
 
-     $this->variable_set('language_negotiation', 3);
 
-     $this->assertTrue($this->performUpgrade(), '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', '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, '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);
 
-   }
 
-   /**
 
-    * Asserts that a page exists and is in the specified language.
 
-    */
 
-   public function assertPageInLanguage($path = NULL, $langcode) {
 
-     if (isset($path)) {
 
-       $this->drupalGet($path);
 
-     }
 
-     if (!$this->assertResponse(200)) {
 
-       return FALSE;
 
-     }
 
-     if ($this->parse()) {
 
-       return $this->assertIdentical($langcode, (string) $this->elements['xml:lang']);
 
-     }
 
-     else {
 
-       return FALSE;
 
-     }
 
-   }
 
- }
 
 
  |