【问题标题】:FuelPHP Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration()FuelPHP 调用未定义的方法 PHPUnit_Util_Configuration::getTestdoxGroupConfiguration()
【发布时间】:2019-04-15 10:43:55
【问题描述】:

fuelphp 单元测试代码出现错误。请建议我如何解决它。我在fuelphp中没有得到任何解决方案

$ phpunit --version
PHPUnit 3.7.21 by Sebastian Bergmann.

错误在这里

$ php oil test
Tests Running...This may take a few moments.
PHP Fatal error:  Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in D:\xampp\htdocs\basic\api\fuel\vendor\phpunit\phpunit\src\TextUI\TestRunner.php on line 1066

Fatal error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in D:\xampp\htdocs\basic\api\fuel\vendor\phpunit\phpunit\src\TextUI\TestRunner.php on line 1066
Fatal Error - Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in D:/xampp/htdocs/basic/api/fuel/vendor/phpunit/phpunit/src/TextUI/TestRunner.php on line 1066

我的测试代码在这里

use Fuel\Core\Cli;
use Fuel\Core\Config;
/**
 * @command php oil test --group=Admins
 * @command for this only >>> php oil test --file=fuel/app/tests/controller/admins.php
 * @group Admins
 */
class Test_Controller_Admins extends \TestCase {


    public function test_action_detail() {
        $this->assertTrue(true);
    }

    /**
     * setUp method
     *
     * @return void
     */
    public function setUp() {
        parent::setUp();
    }

    /**
     * tearDown method
     *
     * @return void
     */
    public function tearDown() {
        parent::tearDown();
    }

}

【问题讨论】:

    标签: php xml unit-testing phpunit fuelphp


    【解决方案1】:

    通过 Composer 安装 PHPUnit 并使用 Composer 生成的自动加载器。那么你不能使用vendor/bin/phpunit以外的可执行文件调用PHPUnit。

    "require-dev": {
        "phpunit/phpunit": "*"
    },
    

    【讨论】:

    • 感谢您的回答。我解决了。通过使用 'binary_path' => DOCROOT.'fuel/vendor/bin/phpunit' 编辑 oil.php 配置文件,它现在可以工作了
    【解决方案2】:

    我就是这样解决的。在下面我放置了我如何解决它的步骤。 这对我有用。获取 PHPUnit 的最简单方法是下载 PHP 存档 (PHAR)。

    (1) 全局安装PHPUNIT

    wget https://phar.phpunit.de/phpunit.phar
    chmod +x phpunit.phar
    sudo mv phpunit.phar /usr/local/bin/phpunit
    phpunit --version
    

    (2) 将“fuel/packages/oil/config/oil.php”复制到“fuel/app/config/oil.php”

    (3) 将二进制路径改为

     'binary_path' => VENDORPATH.'bin/phpunit',  
    

    (4) 现在测试你的fuelphp

     fuelphp oil test
    

    【讨论】:

      猜你喜欢
      • 2017-06-11
      • 2012-07-27
      • 1970-01-01
      • 2019-10-25
      • 2018-07-11
      • 2013-10-23
      • 2012-02-17
      • 1970-01-01
      相关资源
      最近更新 更多