[eluser]rafsoaken[/eluser]
[quote author="MDomansky" date="1238771349"]phpunit execute 4 tests of testSovve2 by given elements of array (provider2)
But, I can't create tests for CI app without fooStack ([/quote]
Hi MDomansky,
Somehow the custom __construct() method of the CIUnit_Testcase troubles phpUnit which should not be the case - so that might be a bug in phpUnit.
If you do not need CIUnit features other than access to your codeigniter object, you can simply use the PHPUnit_Framework_TestCase to extend from and in your setUp method assign the $this->CI controller object like so:
Code:
include_once dirname(__FILE__).'/../CIUnit.php';
class testPHPUnitFeatures extends PHPUnit_Framework_TestCase {
function setUp()
{
$this->CI = &get;_instance();
}
/**
* @dataProvider provider2
*/
public function testSolve2($a, $b, $c, $res)
{
$this->assertEquals($a+$b+$c, $res);
}
public function provider2()
{
return array(
array(1, 0, -4, -3),
array(1, 0, -144, -143),
array(0, 0, -4, 4),
array(1, 0, 4, false)
);
}
}
Hope that helps for now.
raf