簡體   English   中英

phpunit 8 和 PHPUnit_Framework_TestCase

[英]phpunit 8 and PHPUnit_Framework_TestCase

我寫了以下測試:

use PHPUnit\Framework\TestCase;
//other uses

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

}

我嘗試使用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

我使用了 PHPUnit 8.4.3(也嘗試使用 6.5.5)。 我手動安裝了它。

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

為什么要尋找PHPUnit_Framework_TestCase 它必須被棄用。

如果你只想運行一個特定的測試 class,你需要通過一個filter選項:

phpunit --filter StatusCheckerTest

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM