<?php
class DataTest extends PHPUnit_Framework_TestCase
{
protected static $myData = array(
array(0, 0, 0),
array(0, 1, 1),
array(1, 0, 1),
array(1, 1, 3)
);
public static function provider()
{
return self::$myData;
}
public function testAdd($a, $b, $c)
{
$this->assertEquals($c, $a + $b);
}
}
?>
其实方案一和二有着异曲同工之处,但不论我怎么改问题依然如故。
无奈之余,我将代码进行归并整理,又写成了如下样式:
<?php
class DataTest extends PHPUnit_Framework_TestCase
{
public static function provider()
{
return array(
array(0, 0, 0),
array(0, 1, 1),
array(1, 0, 1),
array(1, 1, 3)
);
}