通过brew安装了带有PHP的mac开发机器。我正在尝试设置测试工具。我成功地搭建了测试脚手架wp
cli并管理以获取bin/install-wp-tests.sh
做自己的事。
但我有个错误phpunit tests/test-sample.php
:
Error: The PHPUnit Polyfills library is a requirement for running the WP test suite.
If you are trying to run plugin/theme integration tests, make sure the PHPUnit Polyfills library (https://github.com/Yoast/PHPUnit-Polyfills) is available and either load the autoload file of this library in your own test bootstrap before calling the WP Core test bootstrap file; or set the absolute path to the PHPUnit Polyfills library in a "WP_TESTS_PHPUNIT_POLYFILLS_PATH" constant to allow the WP Core bootstrap to load the Polyfills.
If you are trying to run the WP Core tests, make sure to set the "WP_RUN_CORE_TESTS" constant to 1 and run `composer update -W` before running the tests.
Once the dependencies are installed, you can run the tests using the Composer-installed version of PHPUnit or using a PHPUnit phar file, but the dependencies do need to be installed whichever way the tests are run.
所以我跑了
composer require --dev yoast/phpunit-polyfills
并打开了一个新的终端窗口,但仍然得到相同的错误。跑步
brew doctor
不显示任何与php或composer相关的内容。
我不太会用PHP开发,所以我不知道还有什么可以尝试的。