From 2b72efe07d1aa221b15cf71e52859e5a845a0d81 Mon Sep 17 00:00:00 2001 From: Jordan Sebastian Date: Tue, 12 Jun 2012 10:54:07 -0400 Subject: [PATCH 1/3] Added the ability to use UPal with D7. I added a new environment variable to phpunit.xml.dist that indicates which version of drupal core you intend to use. This is then loaded in drupal_test_case.php and used to determine how to find bootstrap.inc. --- drupal_test_case.php | 14 +++++++++++++- phpunit.xml.dist | 9 ++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drupal_test_case.php b/drupal_test_case.php index 4ddfc49..a6662e4 100644 --- a/drupal_test_case.php +++ b/drupal_test_case.php @@ -2385,7 +2385,17 @@ function setUp() { if (!defined('DRUPAL_ROOT')) { define('DRUPAL_ROOT', UPAL_ROOT); } - require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc'; + if (!defined("DRUPAL_CORE_VERSION")) { + define('DRUPAL_CORE_VERSION', "8"); + } + + if (DRUPAL_CORE_VERSION == "7") { + require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; + } + // Assume D8 + else { + require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc'; + } drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); } } @@ -2532,6 +2542,8 @@ function upal_init() { // The URL that browser based tests should use. define('UPAL_WEB_URL', getenv('UPAL_WEB_URL') ? getenv('UPAL_WEB_URL') : (isset($GLOBALS['UPAL_WEB_URL']) ? $GLOBALS['UPAL_WEB_URL'] : 'http://upal')); + define('DRUPAL_CORE_VERSION', getenv('DRUPAL_CORE_VERSION') ? getenv('DRUPAL_CORE_VERSION') :(isset($GLOBALS['DRUPAL_CORE_VERSION']) ? $GLOBALS['DRUPAL_CORE_VERSION'] : "8")); + define('UPAL_TMP', getenv('UPAL_TMP') ? getenv('UPAL_TMP') : (isset($GLOBALS['UPAL_TMP']) ? $GLOBALS['UPAL_TMP'] : sys_get_temp_dir())); // define('UNISH_SANDBOX', UNISH_TMP . '/drush-sandbox'); diff --git a/phpunit.xml.dist b/phpunit.xml.dist index cadea55..ce023b3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,11 +8,11 @@ - + - + @@ -25,6 +25,9 @@ + + + . - \ No newline at end of file + From d55a9a0084621e85c361ac206324aaa5897fcfc3 Mon Sep 17 00:00:00 2001 From: Jordan Sebastian Date: Tue, 12 Jun 2012 16:17:17 -0400 Subject: [PATCH 2/3] Reverted phpunit.xml.dist with the exception of keeping the new environment variable. --- phpunit.xml.dist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ce023b3..1168507 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,11 +8,11 @@ - + - + @@ -26,7 +26,7 @@ - + . From 6e91ed8bc2ad321e811e18920ae1e740378a6b5c Mon Sep 17 00:00:00 2001 From: Jordan Sebastian Date: Wed, 13 Jun 2012 17:08:22 -0400 Subject: [PATCH 3/3] Fixed a few more bugs where upal was doing some drupal 8 specific stuff. --- drupal_test_case.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drupal_test_case.php b/drupal_test_case.php index a6662e4..4b23256 100644 --- a/drupal_test_case.php +++ b/drupal_test_case.php @@ -2302,7 +2302,17 @@ protected function resetAll() { */ protected function refreshVariables() { global $conf; - cache('bootstrap')->delete('variables'); + if (!defined('DRUPAL_CORE_VERSION')) { + define('DRUPAL_CORE_VERSION', "8"); + } + + + if (DRUPAL_CORE_VERSION == "7") { + cache_clear_all('variables', 'cache_bootstrap'); + } + else { + cache('bootstrap')->delete('variables'); + } $conf = variable_initialize(); } @@ -2498,8 +2508,16 @@ public function setUp() { //$_SERVER['REQUEST_METHOD'] = NULL; //$_SERVER['SERVER_SOFTWARE'] = NULL; //$_SERVER['HTTP_USER_AGENT'] = NULL; + if (!defined('DRUPAL_CORE_VERSION')) { + define('DRUPAL_CORE_VERSION', "8"); + } - require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc'; + 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.