각 테스트 방법 전에 메소드를 실행해야합니다. 문서 https://phpunit.de/manual/current/en/appendixes.annotations.html#appendixes.annotations.before을 바탕으로, 나는이 작은 테스트를했다 :phpunit @before @after not working
/**
* @before
*/
public function setupSomeFixtures()
{
echo "setupSomeFixtures\n";
}
/**
* @after
*/
public function tearDownSomeFixtures()
{
echo "tearDownSomeFixtures\n";
}
public function testTruc()
{
echo "un test\n";
}
출력 :
PHPUnit 3.7.21 by Sebastian Bergmann.
Configuration read from <root>\phpunit.xml
.un test
Time: 5 seconds, Memory: 14.25Mb
OK (1 test, 0 assertions)
내가 실종 무엇인가?
을 phpunit을 업그레이드 아니라'@된다
이 내 출력입니까? 그리고 테스트가 끝나면'@ after'? 출력 결과 만 테스트 결과를 출력합니까? (그냥 무작위 추측) – Gudgip
phpunit 의사가 :'@before 주석은 테스트 케이스 클래스의 각 테스트 메소드 전에 호출되어야하는 메소드를 지정하는 데 사용될 수 있습니다. ' 잘 알고 있으므로 @before가 가정됩니다 테스트 케이스 클래스가 아닌 각 테스트 메소드를 실행하기 전에 – smarber