mardi 4 juillet 2017

How to pass parameters to a controller (testing)

I'm testing with PHP unit a controller which has at least one parameter:

public function testSomething($a,$b='')
{
}

Im trying to test it this way:

$params = array('a'=>'foo','b'=>'bar');
$output = $this->request('POST', ['MyController','Something'], $params);

But I'm getting:

ArgumentCountError: Too few arguments to function MyController::Something

How can I pass at those parameters?

Aucun commentaire:

Enregistrer un commentaire