Step
- composer安裝PHPUnit
- 配置
- 建立Test code
- 執行測試
Implement
1. composer安裝PHPUnitTerminal 輸入 composer require --dev phpunit/phpunit ^7
指令會下載PHPUnit到專案中的vendor/

2. 配置composer.json 自動載入src/內的程式

3. test/內建立測試檔案
4. 執行測試檔案
Terminal輸入 ./vendor/bin/phpunit tests/EmailTest
P.S.
PHPUnit相關設定在vendor/phpunit/phpunit/phpunit.xml
0 意見:
張貼留言