How to set a global before PHPUnit's skeleton-test is run
- by ministerOfPower
We set a global in our prepend file used to form the path for our require_once calls. For example:
require_once($GLOBALS['root'].'/library/particleboard/JsonUtil.php');
Problem is, when I run PHPUnit's skeleton test builder, the prepend file is not run, so the global is never set. When I run
cd /company/trunk/queue/process; phpunit --skeleton-test QueueProcessView
PHPUnit tries to resolve a require_once in QueueProcessView, but since the $GLOBALS['root'] is never set, I get a fatal error when including the required file.
For example, to PHPUnit, what should be
require_once(/code/trunk/library/particleboard/JsonUtil.php)
is resolved as
require_once(/library/particleboard/JsonUtil.php)
Notice the missing root.
Does anyone know if the skeleton-test code has some way to call PHP file before it is run? In this I could set my GLOBAL['root'] in this file.
Any other creative solutions would be appreciated.