You are here

protected function CoderUpgradeUnitTestCase::setUp in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_upgrade/coder_upgrade.test \CoderUpgradeUnitTestCase::setUp()

Sets up unit test environment.

Unlike DrupalWebTestCase::setUp(), DrupalUnitTestCase::setUp() does not install modules because tests are performed without accessing the database. Any required files must be explicitly included by the child class setUp() method.

Overrides DrupalUnitTestCase::setUp

2 calls to CoderUpgradeUnitTestCase::setUp()
CoderUpgradeUnitTestCase1::setUp in coder_upgrade/coder_upgrade.test
Sets up unit test environment.
CoderUpgradeUnitTestCase2::setUp in coder_upgrade/coder_upgrade.test
Sets up unit test environment.
2 methods override CoderUpgradeUnitTestCase::setUp()
CoderUpgradeUnitTestCase1::setUp in coder_upgrade/coder_upgrade.test
Sets up unit test environment.
CoderUpgradeUnitTestCase2::setUp in coder_upgrade/coder_upgrade.test
Sets up unit test environment.

File

coder_upgrade/coder_upgrade.test, line 40

Class

CoderUpgradeUnitTestCase
Unit tests for the upgrade routines.

Code

protected function setUp() {

  /*
   * When running a unit test case, we do not have access to a database once
   * the parent::setUp() method is called. If there are any pre-processing
   * tasks that require database access, we need to do them first.
   */
  if (!variable_get('coder_upgrade_preserve_array_format', FALSE)) {

    // Expected files were created with this setting enabled.
    variable_set('coder_upgrade_preserve_array_format', TRUE);
  }
  file_put_contents('output.html', '');
  file_put_contents('output.html', __METHOD__ . "\n", FILE_APPEND);

  // Build theme registry cache.
  $this
    ->captureThemeInfo();
  file_put_contents('output.html', "after captureThemeInfo\n", FILE_APPEND);

  // Save the live site files directory path.
  $this->site_directory = DRUPAL_ROOT . '/' . coder_upgrade_directory_path('new');
  file_put_contents('output.html', $this->site_directory . "\n", FILE_APPEND);
  parent::setUp('grammar_parser', 'coder_upgrade');

  // Create output file directories.
  module_load_include('install', 'coder_upgrade');
  coder_upgrade_install();
  file_put_contents('output.html', "after install\n", FILE_APPEND);

  // Enable debug printing.
  global $_coder_upgrade_debug;
  $_coder_upgrade_debug = TRUE;
}