- <?php
- * @file
- * Upgrade tests for the Language module.
- */
-
- require_once BACKDROP_ROOT . '/core/modules/simpletest/tests/upgrade/upgrade.test';
-
- * Tests upgrading a filled database with language data.
- *
- * Loads a filled installation of Drupal 7 with language data and runs the
- * upgrade process on it.
- */
- class LanguageUpgradePathTestCase extends UpgradePathTestCase {
- public function setUp() {
-
- $this->databaseDumpFiles = array(
- backdrop_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.database.php.gz',
- backdrop_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.language.database.php',
- );
- parent::setUp();
- }
-
-
- * Tests a successful upgrade.
- */
- public function testLanguageUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
-
-
- $this->assertTrue(language_default()->langcode == 'ca', t('Catalan is the default language'));
- $languages = language_list();
- foreach ($languages as $language) {
- $this->assertTrue($language->default == ($language->langcode == 'ca'), t('@language default property properly set', array('@language' => $language->name)));
- }
-
-
- $GLOBALS['language_url'] = language_default();
-
-
- $this->backdropGet('node/38');
- $this->assertText('Node title 38', t('Node 38 displayed after update.'));
- $this->assertText('First test comment', t('Comment 1 displayed after update.'));
- $this->assertText('Reply to first test comment', t('Comment 2 displayed after update.'));
-
-
- $this->assertText('2010/01/17 - 15:00', 'Localized Catalan medium date format displayed correctly after update.');
-
- $this->backdropGet('en/node/38');
- $this->assertText('01/17/2010 - 15:00', 'Default U.S. English medium date format displayed correctly after update.');
-
- $this->backdropGet('cv/node/38');
- $this->assertText('2010/01/17 - 3:00pm', 'Localized Chuvash medium date format displayed correctly after update.');
-
-
- $comment = db_query('SELECT * FROM {comment} WHERE cid = :cid', array(':cid' => 1))->fetchObject();
- $this->assertTrue($comment->langcode == 'und', t('Comment 1 language code found.'));
-
-
-
-
- $elements = $this->xpath('//*[contains(@class, :block)]', array(
- ':block' => 'block-locale-language',
- ));
- $this->assertTrue($elements, t('The language switcher block is being correctly showed.'));
-
-
- $language_none_nid = 38;
- $spanish_nid = 39;
- $translation_source_nid = 40;
- $translation_nid = 41;
-
- $this->assertEqual(node_load($language_none_nid)->langcode, LANGUAGE_NONE, "'language' property was renamed to 'langcode' for LANGUAGE_NONE node.");
- $this->assertEqual(node_load($spanish_nid)->langcode, 'ca', "'language' property was renamed to 'langcode' for Catalan node.");
-
- $this->backdropGet("node/$translation_source_nid/translate");
- $this->assertResponse(200, 'The translated node has a proper translation table.');
- $this->assertRaw('<td><strong>English</strong> (source)</td>', 'English is the source node of the translation.');
- $this->assertRaw('<td>Chuvash</td>', 'There is a Chuvash translation of the node.');
- $this->assertLinkByHref("node/$translation_nid", 0, 'The translation table links to the Chuvash translation.');
- $this->assertRaw('<td>Catalan</td><td>N/A</td><td>Not translated</td>', 'There is no Catalan translation of this node.');
-
-
- $this->backdropGet('node/add/article');
- $this->assertFieldByName('langcode');
- $this->backdropGet('node/add/page');
- $this->assertNoFieldByName('langcode');
- }
- }