我已經嘗試安裝phpunit安裝本身似乎很好。 我可以運行「PHPUnit的」,但是當我嘗試運行一個測試「PHPUnit的test.php的」我得到 '""C:\Program' is not recognized as an internal or external command,
operable program or batch file.
PHPUnit 3.3.17 by Seba
我有沒有使用TDD 現在我想編寫一個測試,看起來像這樣 function somefunction($someargs){
// do a few checks on $someargs
$database = new DB_PG();
$result = $database->select($query);
// do some changes on re
雖然試圖獲得被測遺留代碼庫的構造函數依賴,我遇到一個對象,執行以下操作: class Foo
{
public function __construct($someargs)
{
$this->bar = new Bar();
// [lots more code]
}
}
酒吧在這種情況下有一個構造函數,做一些壞事例如連接到數據庫。我
我在PHP中開始使用命名空間的任務不斷。這次PHPUnit給我帶來了問題。我的設置()方法是這樣的: $test = new \MyNamespace\NonPersistentStorage(); // works
$mock = $this->getMock('\\MyNamespace\\NonPersistentStorage'); // doesn't work
的getMock(
我已經搜索,但無法完全找到我要查找的內容,而且手冊在這方面沒有太多幫助。我對單元測試相當陌生,所以不確定我是否在正確的軌道上。無論如何,在這個問題上。我有一個類: <?php
class testClass {
public function doSomething($array_of_stuff) {
return AnotherClass::returnRa