update.aggregator.test 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * @file
  4. * Tests schema changes in aggregator.module.
  5. */
  6. class AggregatorUpdatePathTestCase extends UpdatePathTestCase {
  7. public static function getInfo() {
  8. return array(
  9. 'name' => 'Aggregator update path',
  10. 'description' => 'Aggregator update path tests.',
  11. 'group' => 'Upgrade path',
  12. );
  13. }
  14. public function setUp() {
  15. // Use the normal installation and add our feed data.
  16. $path = drupal_get_path('module', 'simpletest') . '/tests/upgrade';
  17. $this->databaseDumpFiles = array(
  18. $path . '/drupal-7.bare.standard_all.database.php.gz',
  19. $path . '/drupal-7.aggregator.database.php',
  20. );
  21. parent::setUp();
  22. // Our test data only relies on aggregator.module.
  23. $this->uninstallModulesExcept(array('aggregator'));
  24. }
  25. /**
  26. * Tests that the aggregator.module update is successful.
  27. */
  28. public function testAggregatorUpdate() {
  29. // Get a selection of the fields affected by the schema update.
  30. $query = db_select('aggregator_feed', 'af');
  31. $query->join('aggregator_item', 'ai', 'af.fid = ai.fid');
  32. $query
  33. ->fields('af', array('url', 'link'))
  34. ->fields('ai', array('link', 'guid'));
  35. $pre_update_data = $query->execute()->fetchAll();
  36. $this->assertTrue($this->performUpgrade(), 'The update was completed successfully.');
  37. $post_update_data = $query->execute()->fetchAll();
  38. $this->assertTrue($pre_update_data == $post_update_data, 'Feed data was preserved during the update.');
  39. }
  40. }