【问题标题】:require_once(PHPUnit/Extensions/SeleniumTestCase.php) in yiiyii 中的 require_once(PHPUnit/Extensions/SeleniumTestCase.php)
【发布时间】:2014-09-03 11:47:18
【问题描述】:

我正在尝试在 yii 中使用 phpunit

我按照http://phpunit.de/manual/4.1/en/installation.html的说明进行安装

当我这样做时

phpunit protected/tests/unit/

发生了这个错误

PHP Warning:  require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/news/framework/test/CWebTestCase.php on line 12

当我再次尝试安装 SeleniumTestCase 时抛出

composer global require "phpunit/phpunit-selenium": ">=1.2"

这就是出现的样子

Changed current directory to /home/qts1234/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev) 
Nothing to install or update 
Generating autoload files 

我能做什么。请帮忙

【问题讨论】:

    标签: phpunit composer-php yii-components


    【解决方案1】:

    使用 composer 全局安装 selenium 脚本不会将它们添加到您的包含路径中,自动加载器也不会看到它。

    您应该添加 phpunit/phpunit-selenium 作为开发依赖项,并让 composer 将其安装到您的项目中,这样您的引导程序就可以加载自动加载器并且您正在扩展的测试将会被发现。

    【讨论】:

    • 我照说的做了,通过 composer 安装了它和其他依赖项(Invoker、DBunit 等),并且文件按预期位于供应商文件夹中,但我一直收到这个错误。还有什么建议吗?我在 yii 1.1。
    • @Shad 你是否在你的 phpunit 引导脚本中包含了自动加载器?
    猜你喜欢
    • 1970-01-01
    • 2010-12-04
    • 1970-01-01
    • 2013-01-29
    • 1970-01-01
    • 2017-02-22
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    相关资源
    最近更新 更多