我正在嘗試爲我的wordpress插件編寫php單元測試,並且一直遵循writing-wordpress-plugin-unit-tests教程。我已經在本地克隆了'core.trac.wordpress.org/browser/tests/trunk/includes'WP_UnitTestCase - 如何使用phpunit正確配置include_path PHAR
我已經通過PHAR機制安裝了phpunit,如下所述:https://phpunit.de/manual/current/en/installation.html#installation.requirements。我也有一個composer.json配置
[14:11:[email protected]~]$ phpunit --version
PHPUnit 4.7.3 by Sebastian Bergmann and contributors.
在我/etc/php.ini中的文件,我有
include_path="."
運行我PHPUnit的我得到這個錯誤
[14:18:[email protected]]$ phpunit
PHP Fatal error: require_once(): Failed opening required 'PHPUnit/Autoload.php' (include_path='.') in /Users/pauloconnell/projects/bhaawp/wp-phpunit/bootstrap.php on line 7
的bootstrap.php文件有這個包括
<?php
/**
* Installs WordPress for running the tests and loads WordPress and the test libraries
*/
require_once 'PHPUnit/Autoload.php';
我想我需要將phpunit文件夾添加到路徑,但是我有一個心理障礙,應該在哪裏設置?
在[WordPress開發SE站點](https://wordpress.stackexchange.com/)上提問可能會更好。 –
您應該可以克隆主幹/測試而不是測試/主幹。它有所不同,因爲測試/主幹是舊的,不再維護。 –