简体   繁体   English

phpunit 8 和 PHPUnit_Framework_TestCase

[英]phpunit 8 and PHPUnit_Framework_TestCase

I wrote the following test:我写了以下测试:

use PHPUnit\Framework\TestCase;
//other uses

class StatusCheckerTest extends TestCase
{
    public function testEntryValidation() {
        //some code
        $this->assertFalse($validation_result);
   }

}

I tried to run it with phpunit StatusCheckerTest.php But when I do it, I see error:我尝试使用phpunit StatusCheckerTest.php运行它但是当我这样做时,我看到错误:

PHP Fatal error:  Class 'PHPUnit_Framework_TestCase' not found in 
/var/www/html/nextcloud/apps/globalstatus/tests/OCA/GlobalStatus/Tests/StatusCheckerTest.php on line 12

I used PHPUnit 8.4.3 (also tried with 6.5.5).我使用了 PHPUnit 8.4.3(也尝试使用 6.5.5)。 I installed it manually.我手动安装了它。

phpunit --version
PHPUnit 8.4.3 by Sebastian Bergmann and contributors.

Why does it look for PHPUnit_Framework_TestCase ?为什么要寻找PHPUnit_Framework_TestCase It must be deprecated.它必须被弃用。

If you want to run only a specific test class, you need to pass it with a filter option:如果你只想运行一个特定的测试 class,你需要通过一个filter选项:

phpunit --filter StatusCheckerTest

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用\\ PHPUnit_Framework_TestCase或.. \\ TestCase - Use \PHPUnit_Framework_TestCase or ..\TestCase 找不到Symfony / PHPUnitClass'PHPUnit_Framework_TestCase' - Symfony/PHPUnitClass 'PHPUnit_Framework_TestCase' not found 如何使用此文件PHPunit测试“扩展PHPUnit_Framework_TestCase” - How to use this File PHPunit test “extend PHPUnit_Framework_TestCase” PHPUnit类“错误”不会扩展PHPUnit_Framework_TestCase - PHPUnit Class “Error” does not extend PHPUnit_Framework_TestCase PHPUnit:dataProvider在PHPUnit_Framework_TestCase的子类中不起作用 - PHPUnit: dataProvider not working in the sub classes of PHPUnit_Framework_TestCase PHPUnit-如何在PHPUnit_Framework_TestCase中实例化我的pdo类? - PHPUnit - How to instantiate my pdo class in PHPUnit_Framework_TestCase? 是否可以在不扩展PHPUnit_Framework_TestCase的情况下使用PHPUnit断言? - Is it possible to use PHPUnit assertions without extending PHPUnit_Framework_TestCase? PHPUnit_Framework_TestCase类不可用。 解决…-Makegood,Eclipse - PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse Selenium RC-无法重新声明类PHPUnit_Framework_TestCase - Selenium RC - Cannot redeclare class PHPUnit_Framework_TestCase PHPUnit_Framework_TestCase找到但未定义的方法:: call() - PHPUnit_Framework_TestCase Found but undefined method ::call()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM