I'm trying to wrap a test class around a pre-existing PHP class file that does not adhere to any PSR standard.
The PHP object I'm trying to test has a constructor that accepts 1 argument.
When prepping my object in setUp, my test correctly fails because there is a constructor argument missing. Because of this, I feel good that my object is being correctly resolved.
protected function setUp() {
$this->object = new HierarchyChange();
}
However, when I do add a value:
$this->object = new HierarchyChange('username');
NetBeans throws a "Perhaps error occurred, verify in Output window" message when I run the tests. And the output window has no information.
Executing "phpunit . -v" from the command line simply outputs the PHPUnit version I'm working with, but does not show any exception information.
I've tracked the failing line in my HierarchyChange class to this line in the class constructor:
public function __construct($agent_manager)
{
/* require contracting base class */
require_once($_SERVER['DOCUMENT_ROOT'] . '/_inc/oc.class.php');
I've tried a number of different ways to add this file, thinking that the server variable was causing the problem, but even removing it and hardcoding the path in the constructor cause the test suite to crash.
It DOES, however, work when I comment out the require_once line completely.
It doesn't make sense to me why this fails, but I am grasping at straws with this. Thanks.