gpt4 book ai didi

yii - PHPUnit 和 Yii 错误需要 *.php 文件

转载 作者:行者123 更新时间:2023-12-01 02:30:48 28 4
gpt4 key购买 nike

我的 PHPUnit 在运行时遇到了问题。我遇到了很多问题,但现在我遇到了这个问题...

所以我在我的应用程序文件夹中保护/测试...
在我的控制台中我写道:

phpunit unit/DbTest.php

并作为答复得到(对不起很多信):
附言使用 Wamp 和 Win8
PHP Warning:  require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to o
pen stream: No such file or directory in C:\wamp\www\framework\test\CWebTestCase
.php on line 12
PHP Stack trace:
PHP 1. {main}() C:\wamp\bin\php\php5.3.13\phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.13\phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.13\pear\PHPUnit\Te
xtUI\Command.php:129
PHP 4. PHPUnit_TextUI_Command->handleArguments() C:\wamp\bin\php\php5.3.13\pea
r\PHPUnit\TextUI\Command.php:138
PHP 5. PHPUnit_TextUI_Command->handleBootstrap() C:\wamp\bin\php\php5.3.13\pea
r\PHPUnit\TextUI\Command.php:606
PHP 6. PHPUnit_Util_Fileloader::checkAndLoad() C:\wamp\bin\php\php5.3.13\pear\
PHPUnit\TextUI\Command.php:778
PHP 7. PHPUnit_Util_Fileloader::load() C:\wamp\bin\php\php5.3.13\pear\PHPUnit\
Util\Fileloader.php:76
PHP 8. include_once() C:\wamp\bin\php\php5.3.13\pear\PHPUnit\Util\Fileloader.p
hp:92
PHP 9. require_once() C:\wamp\www\test\protected\tests\bootstrap.php:8
PHP 10. YiiBase::autoload() C:\wamp\www\test\protected\tests\bootstrap.php:0

PHP 11. include() C:\wamp\www\framework\YiiBase.php:397

Warning: require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to open s
tream: No such file or directory in C:\wamp\www\framework\test\CWebTestCase.php
on line 12

Call Stack:
0.0003 325320 1. {main}() C:\wamp\bin\php\php5.3.13\phpunit:0
0.0081 684192 2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3
.13\phpunit:46
0.0081 684608 3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.
13\pear\PHPUnit\TextUI\Command.php:129
0.0081 684608 4. PHPUnit_TextUI_Command->handleArguments() C:\wamp\bin
\php\php5.3.13\pear\PHPUnit\TextUI\Command.php:138
0.0152 1197056 5. PHPUnit_TextUI_Command->handleBootstrap() C:\wamp\bin
\php\php5.3.13\pear\PHPUnit\TextUI\Command.php:606
0.0157 1209440 6. PHPUnit_Util_Fileloader::checkAndLoad() C:\wamp\bin\p
hp\php5.3.13\pear\PHPUnit\TextUI\Command.php:778
0.0164 1209536 7. PHPUnit_Util_Fileloader::load() C:\wamp\bin\php\php5.
3.13\pear\PHPUnit\Util\Fileloader.php:76
0.0167 1214200 8. include_once('C:\wamp\www\test\protected\tests\boo
tstrap.php') C:\wamp\bin\php\php5.3.13\pear\PHPUnit\Util\Fileloader.php:92
0.0212 1495872 9. require_once('C:\wamp\www\test\protected\tests\Web
TestCase.php') C:\wamp\www\test\protected\tests\bootstrap.php:8
0.0213 1496136 10. YiiBase::autoload() C:\wamp\www\test\protected\tes
ts\bootstrap.php:0
0.0220 1519520 11. include('C:\wamp\www\framework\test\CWebTestCase.php'
) C:\wamp\www\framework\YiiBase.php:397

PHP Fatal error: require_once(): Failed opening required 'PHPUnit/Extensions/Se
leniumTestCase.php' (include_path='.;C:\wamp\bin\php\php5.3.13\pear') in C:\wamp
\www\framework\test\CWebTestCase.php on line 12
PHP Stack trace:
PHP 1. {main}() C:\wamp\bin\php\php5.3.13\phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3.13\phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.13\pear\PHPUnit\Te
xtUI\Command.php:129
PHP 4. PHPUnit_TextUI_Command->handleArguments() C:\wamp\bin\php\php5.3.13\pea
r\PHPUnit\TextUI\Command.php:138
PHP 5. PHPUnit_TextUI_Command->handleBootstrap() C:\wamp\bin\php\php5.3.13\pea
r\PHPUnit\TextUI\Command.php:606
PHP 6. PHPUnit_Util_Fileloader::checkAndLoad() C:\wamp\bin\php\php5.3.13\pear\
PHPUnit\TextUI\Command.php:778
PHP 7. PHPUnit_Util_Fileloader::load() C:\wamp\bin\php\php5.3.13\pear\PHPUnit\
Util\Fileloader.php:76
PHP 8. include_once() C:\wamp\bin\php\php5.3.13\pear\PHPUnit\Util\Fileloader.p
hp:92
PHP 9. require_once() C:\wamp\www\test\protected\tests\bootstrap.php:8
PHP 10. YiiBase::autoload() C:\wamp\www\test\protected\tests\bootstrap.php:0

PHP 11. include() C:\wamp\www\framework\YiiBase.php:397

Fatal error: require_once(): Failed opening required 'PHPUnit/Extensions/Seleniu
mTestCase.php' (include_path='.;C:\wamp\bin\php\php5.3.13\pear') in C:\wamp\www\
framework\test\CWebTestCase.php on line 12

Call Stack:
0.0003 325320 1. {main}() C:\wamp\bin\php\php5.3.13\phpunit:0
0.0081 684192 2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.3
.13\phpunit:46
0.0081 684608 3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.3.
13\pear\PHPUnit\TextUI\Command.php:129
0.0081 684608 4. PHPUnit_TextUI_Command->handleArguments() C:\wamp\bin
\php\php5.3.13\pear\PHPUnit\TextUI\Command.php:138
0.0152 1197056 5. PHPUnit_TextUI_Command->handleBootstrap() C:\wamp\bin
\php\php5.3.13\pear\PHPUnit\TextUI\Command.php:606
0.0157 1209440 6. PHPUnit_Util_Fileloader::checkAndLoad() C:\wamp\bin\p
hp\php5.3.13\pear\PHPUnit\TextUI\Command.php:778
0.0164 1209536 7. PHPUnit_Util_Fileloader::load() C:\wamp\bin\php\php5.
3.13\pear\PHPUnit\Util\Fileloader.php:76
0.0167 1214200 8. include_once('C:\wamp\www\test\protected\tests\boo
tstrap.php') C:\wamp\bin\php\php5.3.13\pear\PHPUnit\Util\Fileloader.php:92
0.0212 1495872 9. require_once('C:\wamp\www\test\protected\tests\Web
TestCase.php') C:\wamp\www\test\protected\tests\bootstrap.php:8
0.0213 1496136 10. YiiBase::autoload() C:\wamp\www\test\protected\tes
ts\bootstrap.php:0
0.0220 1519520 11. include('C:\wamp\www\framework\test\CWebTestCase.php'
) C:\wamp\www\framework\YiiBase.php:397

最佳答案

首先你需要安装Selenium

pear install phpunit/PHPUnit_Selenium

然后你需要更改第 11-14 行
/framework/test/CTestCase.php

如下
require_once('PHPUnit/Runner/Version.php');
require_once('PHPUnit/Util/Filesystem.php'); // workaround for PHPUnit <= 3.6.11
require_once('PHPUnit/Autoload.php');
if (in_array('phpunit_autoload', spl_autoload_functions())) { // PHPUnit >= 3.7 'phpunit_alutoload' was obsoleted
spl_autoload_unregister('phpunit_autoload');
Yii::registerAutoloader('phpunit_autoload');
}

关于yii - PHPUnit 和 Yii 错误需要 *.php 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13090075/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com