2014-09-22 26 views
2

我試圖通過phpunit(ver 4.2.6)wordpress插件的單元測試。 但是當我運行PHPUnit的命令,出現此錯誤:phpunit與wordpress的遞歸DjangoIterator錯誤

1)SampleTest :: testSample UnexpectedValueException:RecursiveDirectoryIterator :: __結構(/ tmp目錄/ WordPress的/可溼性粉劑內容/上傳):未能打開目錄:無這樣的文件或目錄

/private/tmp/wordpress-tests-lib/includes/testcase.php:407

/private/tmp/wordpress-tests-lib/includes/testcase.php:425

/private/tmp/wordpress-tests-lib/includes/testca se.php:26

失敗!
測試:1,斷言:0,錯誤:1.

SampleTest文件僅僅是這樣的。

class SampleTest extends WP_UnitTestCase { 

    function testSample() { 
     $this->assertTrue(true); 
    } 
} 

我不知道什麼是錯的。有沒有人遇到過這個問題?

回答

3

我有同樣的問題,我手動創建上傳目錄,然後測試成功運行。

mkdir /tmp/wordpress/wp-content/uploads

好像 「上傳」 文件夾只是失蹤。