How to pass parameters to a controller (testing)

Viewed 918

I'm testing with PHPUnit 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 those parameters?

Note: I used a library for integrating PHPUnit to Codeigniter:

"require-dev": {
        "kenjis/ci-phpunit-test": "^0.15.0"
    }
2 Answers
Related