Advertisement
btmash

Upgrade tests using checkRequirements

Sep 8th, 2011
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.09 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Upgrade test for the bare database..
  5.  *
  6.  * Load an empty installation of Drupal 7 and run the upgrade process on it.
  7.  */
  8. class BareUpgradePathTestCase extends UpgradePathTestCase {
  9.   public static function getInfo() {
  10.     return array(
  11.       'name'  => 'Bare upgrade test',
  12.       'description'  => 'Bare upgrade test.',
  13.       'group' => 'Upgrade path',
  14.     );
  15.   }
  16.  
  17.   public function checkRequirements() {
  18.     if (!function_exists('gzopen')) {
  19.       return array(
  20.         'errors' => array(
  21.           t('The zlib extension is not enabled. As a result, this test cannot run.'),
  22.         ),
  23.       );
  24.     }
  25.     return parent::checkRequirements();
  26.   }
  27.  
  28.   public function setUp() {
  29.     // Path to the database dump.
  30.     $this->databaseDumpFiles = array(
  31.       drupal_get_path('module', 'simpletest') . '/tests/upgrade/drupal-7.bare.database.php.gz',
  32.     );
  33.     parent::setUp();
  34.   }
  35.  
  36.   /**
  37.    * Test a successful upgrade.
  38.    */
  39.   public function testBareUpgrade() {
  40.     $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
  41.   }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement