unit testing - Parametrized tests in PHPUnit -
on junit, can use annotation @runwith(parameterized.class) run single unit test several times different actual , expected results. i'm new phpunit know suggested approachs achieving same (running 1 unit test many actual, expected results)?
you can use called data provider. this:
/** * @dataprovider testpersondataprovider */ public function testperson($name, $age) { // test ... } public function testpersondataprovider() { // test values return array( array('foo', 36), array('bar', 99), // ... ); }
you define data provider using @dataprovider
annotation.
Comments
Post a Comment