您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
phpunit敏捷文档testdox的带参情况
发布时间:2021-09-18 11:08:34编辑:雪饮阅读()
前番了解了phpunit中testdox对于不同函数名像是仅仅只是后缀出现一个或多个数字这种情况生成敏捷文档的一种呈现方式。
//use PHPUnit\Framework\TestCase;
namespace TestNamespace;
use PHPUnit\Framework\TestCase;
class BankAccountTest extends TestCase
{
public function testBalanceIsInitiallyZero()
{
$this->assertTrue(true);
}
public function test_balance_is_initially_zero()
{
$this->assertTrue(false);
}
public function testBalanceCannotBecomeNegative()
{
$this->assertTrue(true);
}
public function testBalanceCannotBecomeNegative2()
{
$this->assertTrue(true);
}
/**
* @dataProvider provider
*/
public function testMethod($data)
{
$this->assertTrue($data);
}
public function provider()
{
return [
'my named data' => [true],
'my data' => [true]
];
}
}
那么再次执行这个结果就不同了:
//use PHPUnit\Framework\TestCase;
namespace TestNamespace;
use PHPUnit\Framework\TestCase;
class BankAccountTest extends TestCase
{
public function testBalanceIsInitiallyZero()
{
$this->assertTrue(true);
}
public function test_balance_is_initially_zero()
{
$this->assertTrue(false);
}
public function testBalanceCannotBecomeNegative()
{
$this->assertTrue(true);
}
public function testBalanceCannotBecomeNegative2()
{
$this->assertTrue(true);
}
/**
* @dataProvider provider
*/
public function testBanancingMethod($data)
{
$this->assertTrue($data);
}
public function provider()
{
return [
'my named data' => [true],
'my data' => [true]
];
}
}
关键字词:phpunit,testdox
相关文章
- phpunit使用testdox情况下多个测试方法的名字互相之间
- phpunit使用testdox生成敏捷文档
- phpunit中filter的使用(匹配命名空间、类、方法以及数
- phpunit中expectException的使用
- phpunit中NOTICE、WARNING、ERROR的断言支持
- phpunit中expectDeprecationMessageMatches的使用
- phpunit中expectDeprecationMessage的使用
- phpunit中的expectDeprecation的使用
- phpunit使用弱比较(assertEquals)时在差异生成过程中
- phpunit长数组的数组比较失败时的错误输出