PHPUnit9.0 標(biāo)注-@beforeClass

2022-03-24 10:58 更新
PHPUnit9.0 標(biāo)注集合PHPUnit9.0 標(biāo)注集合

?@beforeClass? 標(biāo)注用于指明此靜態(tài)方法應(yīng)該于測試類中的所有測試方法都運(yùn)行完成之后調(diào)用,用于建立共享基境(?fixture?)。

<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;

final class MyTest extends TestCase
{
    /**
     * @beforeClass
     */
    public static function setUpSomeSharedFixtures(): void
    {
        // ...
    }

    /**
     * @beforeClass
     */
    public static function setUpSomeOtherSharedFixtures(): void
    {
        // ...
    }
}


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號