setUp()->testReserve()->tearDown()->...->setUp()->testDuplicatedReservationWithException
在前面使用phpunit工具來執行測試時,有用到--bootstrap,在執行測試前先執行vendor/autoload.php來注入自動加載的功能。但是每次執行測試,都要加上參數有點麻煩,phpunit可以使用XML來設定測試。
phpunit.xml的內容如下:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="../vendor/autoload.php" verbose="true">
<testsuite>
<directory suffix="Test.php">../tests</directory>
</testsuite
原文轉自:http://www.jianshu.com/p/ba6829a6f3ec