W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
指定生成敏捷文檔句子時(shí)使用的替換描述。
測(cè)試類和測(cè)試方法都可以應(yīng)用 ?@testdox
? 標(biāo)注。
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
/**
* @testdox A bank account
*/
final class BankAccountTest extends TestCase
{
/**
* @testdox has an initial balance of zero
*/
public function balanceIsInitiallyZero(): void
{
$this->assertSame(0, $this->ba->getBalance());
}
}
在 PHPUnit 7.0 之前(由于標(biāo)注解析中的一個(gè) bug),使用 ?@testdox
? 標(biāo)注也會(huì)激活 ?@test
? 標(biāo)注的行為
如果將 ?@testdox
? 標(biāo)注在方法級(jí)別和 ?@dataProvider
? 聯(lián)用,可以在替換描述中將方法參數(shù)用作占位符。
/**
* @dataProvider additionProvider
* @testdox Adding $a to $b results in $expected
*/
public function testAdd($a, $b, $expected)
{
$this->assertSame($expected, $a + $b);
}
public function additionProvider()
{
return [
[0, 0, 0],
[0, 1, 1],
[1, 0, 1],
[1, 1, 3]
];
}
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: