PHPUnit のインストールに成功しました。現在、Zend Framework 1.x で動作させようとしています。どこでもさまざまな方法をチェックしましたが、「test」フォルダーで PHPUnit コマンドを実行するたびに次のエラーが発生するため、どれも機能しません。
警告: require_once(Zend/xxxxxxxxx.php): ストリームを開くことができませんでした: 12 行目の C:\wamp\www\square\tests\TestHelper.php にそのようなファイルまたはディレクトリはありません"
xxxxxxx.php は Application.php、Autoloader.php などです。
だから私は、PHPUnitまたはBootstrapがZendライブラリを見つけられないという結論に達しました。奇妙なのは、自分のプロジェクトを私の production|developer 環境 (Zend へのルートが php.ini に追加されている場所) で実行しても問題がないからです。
phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./TestHelper.php">
<testsuite>
<directory>./</directory>
</testsuite>
<filter>
<whitelist>
<directory suffix=".php">../application/</directory>
<exclude>
<directory suffix=".phtml">../application/</directory>
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="./log/report" charset="UTF-8"
yui="true" highlight="true"
lowUpperBound="50" highLowerBound="80"/>
<log type="testdox-html" target="./log/testdox.html" />
</logging>
</phpunit>
TestHelper.php
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/**
* Register autoloader
*/
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
require_once APPLICATION_PATH . '/../tests/application/ControllerTestCase.php';