function tearDown()
 {
     while (sizeof($this->_cleanupGroups) > 0) {
         $gid = array_pop($this->_cleanupGroups);
         node_delete($gid);
     }
     parent::tearDown();
 }
Example #2
0
 function tearDown()
 {
     while (sizeof($this->_cleanupGroups) > 0) {
         $gid = array_pop($this->_cleanupGroups);
         node_delete($gid);
     }
     include_once './' . drupal_get_path('module', 'node') . '/content_types.inc';
     while (sizeof($this->_cleanupNodeTypes) > 0) {
         $name = array_pop($this->_cleanupNodeTypes);
         node_type_delete_confirm_submit(0, array('name' => $name, 'type' => $name));
     }
     parent::tearDown();
 }
 /**
  * Constructor for DrupalWebTestCase.
  */
 function __construct($test_id = NULL)
 {
     parent::__construct($test_id);
     $this->skipClasses[__CLASS__] = TRUE;
 }
 public function setUp()
 {
     parent::setUp();
     if (!defined('DRUPAL_ROOT')) {
         define('DRUPAL_ROOT', UPAL_ROOT);
     }
     $site = DRUPAL_ROOT . '/sites/default';
     $db = parse_url(UPAL_DB_URL);
     // Attempt to make settings.php writable.
     if (file_exists("{$site}/settings.php") && !is_writable("{$site}/settings.php")) {
         chmod("{$site}/settings.php", 0666);
     }
     // Make sure we run against Upal specified database.
     //$drupal_base_url = parse_url(UPAL_WEB_URL);
     //$_SERVER['HTTP_HOST'] = $drupal_base_url['host'];
     //if (!empty($drupal_base_url['port'])) {
     //  $_SERVER['HTTP_HOST'] .= ':' . $drupal_base_url['port'];
     //  $_SERVER['SERVER_PORT'] = $drupal_base_url['port'];
     //}
     //if (array_key_exists('path', $drupal_base_url)) {
     //  $_SERVER['PHP_SELF'] = $drupal_base_url['path'] . '/index.php';
     //}
     //else {
     //  $_SERVER['PHP_SELF'] = '/index.php';
     //}
     //$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'];
     //$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
     //$_SERVER['REQUEST_METHOD']  = NULL;
     //$_SERVER['SERVER_SOFTWARE'] = NULL;
     //$_SERVER['HTTP_USER_AGENT'] = NULL;
     if (!defined('DRUPAL_CORE_VERSION')) {
         define('DRUPAL_CORE_VERSION', "8");
     }
     if (DRUPAL_CORE_VERSION == "7") {
         require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
     } else {
         require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
     }
     drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
     // Enable modules for this test.
     $modules = func_get_args();
     if (isset($modules[0]) && is_array($modules[0])) {
         $modules = $modules[0];
     }
     if ($modules) {
         module_enable($modules, TRUE);
     }
     // Use the test mail class instead of the default mail handler class.
     variable_set('mail_system', array('default-system' => 'TestingMailSystem'));
 }