简体   繁体   中英

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:

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). I installed it manually.

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

Why does it look for 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:

phpunit --filter StatusCheckerTest

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM