필자는 PHP에서 최신 API 래퍼 코드를 작성하기 위해 노력한 간단한 테스트 스위트를 보유하고 있습니다. 그러나 테스트를 실행할 때마다 모든 테스트가 두 번 실행됩니다.Simpletest에서 모든 테스트를 두 번 실행하고 있습니다. 왜?
내 호출 코드 :
require_once(dirname(__FILE__) . '/simpletest/autorun.php');
require_once('CompanyNameAPI.php');
$test = new TestSuite('API test');
$test->addFile(dirname(__FILE__) . '/tests/authentication_test.php');
if (TextReporter::inCli()) {
exit ($test->run(new TextReporter()) ? 0 : 1);
} else {
$test->run(new HtmlReporter());
}
authentication_test.php은 다음과 같습니다
class Test_CallLoop_Authentication extends UnitTestCase {
function test_ClassCreate(){
$class = new CallLoopAPI();
$this->assertIsA($class, CallLoopAPI);
}
//More tests
}
있습니다하지 더 이상 하나 authentication_test.php 내 simpletest하는 autorun.php 또는 다른 통화에 포함되어 있습니다.
아이디어가 있으십니까?
를 사용해야합니다 그것을 당신이 사용하려고 코드, 이미 말한다 간단한 테스트 라이브러리에 내장되어 있으므로 명령 행이나 브라우저를 사용할 때 리포터가 사용할 테스트가 자동으로 인식됩니다. 실제로 내가 제안한 코드는 브라우저와 명령 줄에서 적절한 Reporter를 사용하여 실행됩니다. –