- Patch #540294 by Gábor Hojtsy, clemens.tolboom, Xano: node language settings from...
[project/drupal.git] / core / modules / simpletest / tests / upgrade / upgrade.language.test
1 <?php
2 /**
3 * @file
4 * Upgrade tests for the Language module.
5 */
6
7 /**
8 * Tests upgrading a filled database with language data.
9 *
10 * Loads a filled installation of Drupal 7 with language data and runs the
11 * upgrade process on it.
12 */
13 class LanguageUpgradePathTestCase extends UpgradePathTestCase {
14 public static function getInfo() {
15 return array(
16 'name' => 'Language upgrade test',
17 'description' => 'Upgrade tests with language data.',
18 'group' => 'Upgrade path',
19 );
20 }
21
22 public function setUp() {
23 // Path to the database dump files.
24 $this->databaseDumpFiles = array(
25 drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.filled.database.php.gz',
26 drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.language.database.php',
27 );
28 parent::setUp();
29 }
30
31 /**
32 * Tests a successful upgrade.
33 */
34 public function testLanguageUpgrade() {
35 $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
36
37 // Ensure Catalan was properly upgraded to be the new default language.
38 $this->assertTrue(language_default()->langcode == 'ca', t('Catalan is the default language'));
39 $languages = language_list();
40 foreach ($languages as $language) {
41 $this->assertTrue($language->default == ($language->langcode == 'ca'), t('@language default property properly set', array('@language' => $language->name)));
42 }
43
44 // Check for node content type settings upgrade.
45 $this->drupalGet('node/add/article');
46 $this->assertFieldByName('language');
47 $this->drupalGet('node/add/page');
48 $this->assertNoFieldByName('language');
49 }
50 }