upgrade.translatable.test 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Upgrade test for translatable content types of node.module.
  4. */
  5. class TranslatableUpgradePathTestCase extends UpgradePathTestCase {
  6. public static function getInfo() {
  7. return array(
  8. 'name' => 'Translatable content upgrade path',
  9. 'description' => 'Upgrade path tests for the translatable content types of Node module.',
  10. 'group' => 'Upgrade path',
  11. );
  12. }
  13. public function setUp() {
  14. // Path to the database dump files.
  15. $this->databaseDumpFiles = array(
  16. drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.filled.database.php',
  17. drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.locale.database.php',
  18. drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-6.translatable.database.php',
  19. );
  20. parent::setUp();
  21. $this->uninstallModulesExcept(array('locale'));
  22. }
  23. /**
  24. * Test a successful upgrade (no negotiation).
  25. */
  26. public function testTranslatableUpgrade() {
  27. $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
  28. // The D6 database contains the english node "First translatable page" with
  29. // nid 53.
  30. $nid = 53;
  31. $title = 'First translatable page';
  32. $teaser = 'Teaser of the first translatable page.';
  33. $body = 'Body of the first translatable page.';
  34. // Check whether the node displays properly.
  35. $this->drupalGet("node/$nid");
  36. $this->assertText($body, t('Translatable node body displays properly'));
  37. // Retrieve node object, ensure that both the body and the teaser has
  38. // survived upgrade properly.
  39. $node = $this->drupalGetNodeByTitle($title);
  40. $this->assertTrue($node != NULL, t('Node @title was loaded', array('@title' => $title)));
  41. $this->assertEqual($node->body[LANGUAGE_NONE][0]['value'], $body, 'Body of the node survived upgrade properly');
  42. $this->assertEqual($node->body[LANGUAGE_NONE][0]['summary'], $teaser, 'Teaser of the node survived upgrade properly');
  43. }
  44. }