Skip to content
Snippets Groups Projects
Commit 92b40092 authored by Demian Katz's avatar Demian Katz Committed by GitHub
Browse files

Eliminate use of VUFIND_PHPUNIT_RUNNING constant. (#1281)

- Relying on APPLICATION_ENV is simpler.
parent 1dc17c4e
No related merge requests found
...@@ -5,7 +5,7 @@ $modules = [ ...@@ -5,7 +5,7 @@ $modules = [
'Zend\Router', 'ZfcRbac', 'Zend\Router', 'ZfcRbac',
'VuFindTheme', 'VuFindSearch', 'VuFind', 'VuFindAdmin', 'VuFindApi' 'VuFindTheme', 'VuFindSearch', 'VuFind', 'VuFindAdmin', 'VuFindApi'
]; ];
if (PHP_SAPI == 'cli' && !defined('VUFIND_PHPUNIT_RUNNING')) { if (PHP_SAPI == 'cli' && APPLICATION_ENV !== 'testing') {
$modules[] = 'Zend\Mvc\Console'; $modules[] = 'Zend\Mvc\Console';
$modules[] = 'VuFindConsole'; $modules[] = 'VuFindConsole';
} }
...@@ -52,7 +52,7 @@ if (!is_dir($cacheDir)) { ...@@ -52,7 +52,7 @@ if (!is_dir($cacheDir)) {
} }
// Enable caching unless in dev mode or running tests: // Enable caching unless in dev mode or running tests:
$useCache = APPLICATION_ENV != 'development' && !defined('VUFIND_PHPUNIT_RUNNING'); $useCache = APPLICATION_ENV != 'development' && APPLICATION_ENV != 'testing';
// Build configuration: // Build configuration:
return [ return [
......
...@@ -163,8 +163,8 @@ class CookieManager ...@@ -163,8 +163,8 @@ class CookieManager
*/ */
public function proxySetCookie() public function proxySetCookie()
{ {
// Special case: in test suite or CLI -- don't actually write headers! // Special case: in CLI -- don't actually write headers!
return defined('VUFIND_PHPUNIT_RUNNING') || 'cli' === PHP_SAPI return 'cli' === PHP_SAPI
? true : call_user_func_array('setcookie', func_get_args()); ? true : call_user_func_array('setcookie', func_get_args());
} }
......
<?php <?php
// Set flag that we're in test mode
define('VUFIND_PHPUNIT_RUNNING', 1);
// Set path to this module // Set path to this module
define('VUFIND_PHPUNIT_MODULE_PATH', __DIR__); define('VUFIND_PHPUNIT_MODULE_PATH', __DIR__);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment