PHPUnit from Composer: Require doesn't works
Hi Community
Since hours i'm searching for a solution for this problem, but I have no clue what's wrong.
I've added PHPUnit from the composer. Normal tests without any external classes are working perfectly fine.
As soon i include a needed class, the hole test doesn't work anymore.
Here the example:
<?php
error_reporting(E_ALL);
//require_once('../classes/class.GetAddressesSingleton.php');
class GetAddressesSingletonTest extends PHPUnit_Framework_TestCase {
protected $billingNr = null;
protected $customerNr = null;
protected function setUp(){
$this->billingNr = "";
$this->customerNr = "";
}
public function testSomething(){
$this->assertTrue(1==1);
}
}
This test case works fine.
If I uncomment the require_once statement, I get an exite code 255.
The folder structure is like this:
X
classes
class.GetAddressesSingleton.php
Tests
GetAdressesSingletonTest.php
test.php
Hint: If I put the exactly same require_once in to test.php (NOT a PHPUnit test!) it also works fine..
No Idea guys... Hope somebody has an idea..
UPDATE:
Not it's gettint weird... When I call the test from the Terminal IT WORKS?? :)
Cheers
请先登录再写评论。
Hi there,
Try full absolute path instead of relative -- quite possible PHP fails to load that file for some reason (when running from IDE .. since it uses a wrapper script for integration purposes). Something among these lines:
In any case: you can put breakpoint on that line and debug it -- you may be able to see what is going on there (and do not forget to check PHP's error log)