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

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

?@requires? 標(biāo)注用于在常規(guī)前提條件(例如 PHP 版本或所安裝的擴(kuò)展)不滿足時(shí)跳過測(cè)試。

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

/**
 * @requires extension mysqli
 */
final class DatabaseTest extends TestCase
{
    /**
     * @requires PHP >= 5.3
     */
    public function testConnection(): void
    {
        // 測(cè)試需要 mysqli 擴(kuò)展,并且要求 PHP >= 5.3
    }

    // ... 其他需要 mysqli 擴(kuò)展的測(cè)試
}


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

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)