update.field.test 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * @file
  4. * Provides update path tests for the Field module.
  5. */
  6. /**
  7. * Tests the Field 7.0 -> 7.x update path.
  8. */
  9. class FieldUpdatePathTestCase extends UpdatePathTestCase {
  10. public static function getInfo() {
  11. return array(
  12. 'name' => 'Field update path',
  13. 'description' => 'Field update path tests.',
  14. 'group' => 'Upgrade path',
  15. );
  16. }
  17. public function setUp() {
  18. // Use the filled update path and our field data.
  19. $path = drupal_get_path('module', 'simpletest') . '/tests/upgrade';
  20. $this->databaseDumpFiles = array(
  21. $path . '/drupal-7.filled.standard_all.database.php.gz',
  22. $path . '/drupal-7.field.database.php',
  23. );
  24. parent::setUp();
  25. // Our test data includes poll extra field settings.
  26. $this->uninstallModulesExcept(array('field', 'poll'));
  27. }
  28. /**
  29. * Tests that the update is successful.
  30. */
  31. public function testFilledUpgrade() {
  32. $this->assertTrue($this->performUpgrade(), t('The update was completed successfully.'));
  33. $expected_settings = array(
  34. 'extra_fields' => array(
  35. 'display' => array(
  36. 'poll_view_voting' => array(
  37. 'default' => array(
  38. 'weight' => '0',
  39. 'visible' => TRUE,
  40. ),
  41. ),
  42. 'poll_view_results' => array(
  43. 'default' => array(
  44. 'weight' => '0',
  45. 'visible' => FALSE,
  46. ),
  47. ),
  48. ),
  49. 'form' => array(),
  50. ),
  51. 'view_modes' => array(),
  52. );
  53. $actual_settings = field_bundle_settings('node', 'poll');
  54. $this->assertEqual($expected_settings, $actual_settings, 'Settings stored in field_bundle_settings were updated to per-bundle settings.');
  55. }
  56. }