summaryrefslogtreecommitdiffstats
path: root/core/modules/simpletest/tests/upgrade/upgrade.language.test
blob: ee77fa77d44a79942d21b467a711fa00c096be61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
 * @file
 * Upgrade tests for the Language module.
 */

/**
 * 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 static function getInfo() {
    return array(
      'name'  => 'Language upgrade test',
      'description'  => 'Upgrade tests with language data.',
      'group' => 'Upgrade path',
    );
  }

  public function setUp() {
    // Path to the database dump files.
    $this->databaseDumpFiles = array(
      drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.database.php.gz',
      drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.language.database.php',
    );
    parent::setUp();
  }

  /**
   * Tests a successful upgrade.
   */
  public function testLanguageUpgrade() {
    $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));

    // Ensure Catalan was properly upgraded to be the new default language.
    $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)));
    }

    // Check for node content type settings upgrade.
    $this->drupalGet('node/add/article');
    $this->assertFieldByName('language');
    $this->drupalGet('node/add/page');
    $this->assertNoFieldByName('language');
  }
}