일부 테스트 케이스를 작성하여 PHPUnit을 사용해 보려고합니다. 그러나 작동하지 않습니다.PHPUnit이 아무 것도하지 않고 출력하지 않습니다.
PHPUnit 3.7.14 by Sebastian Bergmann.
내가 phpunit --log-json error.log CategoryTest
,하는 error.log 파일을 표시 할 경우 : 내가 phpunit CategoryTest
를 실행 경우는 출력 그래서
{"event":"suiteStart","suite":"CategoryTest","tests":5}
{"event":"testStart","suite":"CategoryTest","test":"CategoryTest::test__construct"}
를, 그것은 파일의 5 개 시험이 있다는 것을 처음 발견을하고 시작 하나는 아무 이유없이 멈춘다. 실행을 계속할 수없는 이유를 찾을 수있는 로그가 있습니까? 또한 다른 파일 (예 : phpunit --log-json error.log UserTest
)에서 test를 실행하면 쉘에 출력이 표시되지 않고 error.log 파일도 표시되지 않습니다.
다른 유사한 질문 중 하나에서 제안 된대로 다시 설치했지만 아무 것도하지 않았습니다.
어떻게 해결할 수 있습니까?
require_once '../Category.class.php';
require_once '../../db_connect.php';
require_once 'PHPUnit/Framework/TestCase.php';
class CategoryTest extends PHPUnit_Framework_TestCase {
private $Category;
protected function setUp() {
parent::setUp();
$this->Category = new Category(0, $mdb2);
}
protected function tearDown() {
$this->Category = null;
parent::tearDown();
}
public function __construct() {
}
public function test__construct() {
$this->markTestIncomplete ("__construct test not implemented");
$cat = $this->Category->__construct(0, $mdb2);
$this->assertInstanceOf('Category', $cat);
}
public function testReturnID() {
$this->markTestIncomplete ("returnID test not implemented");
$id = $this->Category->returnID();
$this->assertEquals(0, $id);
}
...
}
변수 $mdb2
은 db_connect.php 파일에서옵니다.
나는 그것을 알아 냈다. 문제는 클래스 외부에서 변수를 포함 시켰습니다.
몇 가지 코드를 보여줄 수 있습니까? PHP 테스트 클래스 또는 테스트 된 클래스와 마찬가지로 유형 오류 –
을 볼 수 있습니다./var/log 파일의 error.log를 확인하십시오. 'tail -f/var/log/error.log'를 sytem이나 다른 규칙에서 사이트 용으로 사용하십시오. –
몇 가지 코드를 추가했습니다. 그리고'tail -f/var/log/error.log'를 실행했지만 그런 파일이 없었습니다. –