Projet

Général

Profil

Paste
Télécharger (1,96 ko) Statistiques
| Branche: | Révision:

root / drupal7 / modules / simpletest / tests / upgrade / upgrade.translatable.test @ f7a2490e

1
<?php
2

    
3
/**
4
 * Upgrade test for translatable content types of node.module.
5
 */
6
class TranslatableUpgradePathTestCase extends UpgradePathTestCase {
7
  public static function getInfo() {
8
    return array(
9
      'name'  => 'Translatable content upgrade path',
10
      'description'  => 'Upgrade path tests for the translatable content types of Node module.',
11
      'group' => 'Upgrade path',
12
    );
13
  }
14

    
15
  public function setUp() {
16
    // Path to the database dump files.
17
    $this->databaseDumpFiles = array(
18
      drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
19
      drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.locale.database.php',
20
      drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.translatable.database.php',
21
    );
22
    parent::setUp();
23

    
24
    $this->uninstallModulesExcept(array('locale'));
25
  }
26

    
27
  /**
28
   * Test a successful upgrade (no negotiation).
29
   */
30
  public function testTranslatableUpgrade() {
31
    $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
32

    
33
    // The D6 database contains the english node "First translatable page" with
34
    // nid 53.
35
    $nid = 53;
36
    $title = 'First translatable page';
37
    $teaser = 'Teaser of the first translatable page.';
38
    $body = 'Body of the first translatable page.';
39

    
40
    // Check whether the node displays properly.
41
    $this->drupalGet("node/$nid");
42
    $this->assertText($body, 'Translatable node body displays properly');
43

    
44
    // Retrieve node object, ensure that both the body and the teaser has
45
    // survived upgrade properly.
46
    $node = $this->drupalGetNodeByTitle($title);
47
    $this->assertTrue($node != NULL, format_string('Node @title was loaded', array('@title' => $title)));
48
    $this->assertEqual($node->body[LANGUAGE_NONE][0]['value'], $body, 'Body of the node survived upgrade properly');
49
    $this->assertEqual($node->body[LANGUAGE_NONE][0]['summary'], $teaser, 'Teaser of the node survived upgrade properly');
50
  }
51
}