Slide 5
Slide 5 text
function isAdult(int $age) : bool {
return $age > 18;
}
class MyTest extends \PHPUnit\Framework\TestCase
{
public function isAdultProvider() : array
{
return [
['age' => 17, 'expected' => false],
['age' => 19, 'expected' => true],
];
}
/**
* @dataProvider isAdultProvider
*/
public function testIsAdult(int $age, bool $expected) : void
{
assertEquals($expected, isAdult($age));
}
}
Граничное условие не
тестируется