【发布时间】:2014-07-26 09:52:58
【问题描述】:
我有一个正常的目录结构:
- root
- vendor
- bin/phpunit
- tests
- bootstrap.php
我的 composer.json:
{
"name": "test/testing",
"minimum-stability": "dev",
"require": {
"phpunit/phpunit": "4.1.*@dev",
"phpunit/phpunit-mock-objects": "2.2.*@dev"
},
"autoload": {
"classmap": ["tests/config.inc","test.inc"]
}
}
我的 bootstrap.php:
<?php
require_once 'vendor/autoload.php';
引导程序中还有一些其他的东西,这就是我需要它的原因, 但我在这里删除了它,因为它与我的问题无关。
当我尝试在根文件夹运行 PHPUnit 时:
vendor/bin/phpunit --bootstrap tests/bootstrap.php tests/ItemsTest.php
我得到错误:
PHP Warning: require(xxxx/vendor/phpunit/phpunit-mock-objects/tests/../vendor/autoload.php): failed to open stream: No such file or directory in xxxxxxx/vendor/phpunit/phpunit-mock-objects/tests/bootstrap.php on line 4
我不知道为什么 phpunit/自动加载器正在加载这个引导程序:
phpunit-mock-objects/tests/bootstrap.php
当然还有第 4 行:
require __DIR__ . '/../vendor/autoload.php';
不起作用。
【问题讨论】:
标签: php phpunit composer-php