I am working on PHPunit tests and so far everything is great. There is one issue, however, and it is with the following setup. Ideally I'd like to select the next value in the sequence (postgreSQL) and pass that into the function so I can validate it against the array returned from my class being tested (new row in database).
The issue is that before the array is returned from the data provider (if I echo it) it is the correct value, but during the test it comes through as blank. Is there a particular series of steps I'm missing in here in terms of what I expect or must I do this a different way?
/**
* @dataProvider testSignupProvider
*/
public function testSignup($a, $b, $c)
{
...stuff is done with $a,$b,$c
}
public function testSignupProvider()
{
$uid = fetchOne(X("SELECT currval('users_id_seq')"));
return array(
array(false, array(), $error4)
,array('email'=>'[email protected]','password'=>'youaintgonnagetit'), $error3)
,array(array('id'=>$uid,'email'=>'[email protected]','username'=>'Guest'), array('email'=>'[email protected]','password'=>'youaintgonnagetit'), null)
);
}
Output:
Array
(
- [id] =>
+ [id] => 2
[email] => [email protected]
[username] => Guest
)