我有以下测试文件,PHPUnit网站上的一个例子。
<?php
require_once 'PHPUnit/Autoload.php';
class StackTest extends PHPUnit_Framework_TestCase
{
public function testPushAndPop()
{
$stack = array();
$this->assertEquals(0, count($stack));
array_push($stack, 'foo');
$this->assertEquals('foo', $stack[count($stack)-1]);
$this->assertEquals(1, count($stack));
$this->assertEquals('foo', array_pop($stack));
$this->assertEquals(0, count($stack));
}
}
?>
我正在尝试在PHPStorm 5.0中运行它,但是我收到以下错误:
E:\wamp\bin\php\php5.3.13\php.exe C:\Users\<user>\AppData\Local\Temp\ide-phpunit.php --no-configuration StackTest E:\wamp\www\renting\tests\StackTest.php
Testing started at 03:37 ...
SCREAM: Error suppression ignored for
Warning: require_once(PHPUnit/Runner/Version.php): failed to open stream: No such file or directory in C:\Users\<user>\AppData\Local\Temp\ide-phpunit.php on line 166
为什么它会转到C:我将包含路径设置为E:?
答案 0 :(得分:9)
解决了!
似乎某些依赖项存在问题,特别是pear.symfony.com/Yaml。
通过以下方式解决:
pear channel-discover pear.symfony.com
pear install pear.symfony.com/Yaml
pear channel-discover pear.phpunit.de
pear install --alldeps pear.phpunit.de/PHPUnit
答案 1 :(得分:1)
我在很长一段时间内遇到了类似问题,结果证明这是一个供股问题。
以下是我的解决方案:https://stackoverflow.com/a/22886926/1311443
希望它可以帮助其他人更快地解决类似问题。
答案 2 :(得分:1)
我的问题很相似 - 但我通过从测试中指出bootstrap文件来解决这个问题。然后,一切正常。
答案 3 :(得分:0)
以下是JetBrains糟糕黑客的正确解决方案。