How to pass parameters to a controller (testing) How to pass parameters to a controller (testing) codeigniter codeigniter

How to pass parameters to a controller (testing)


you can use flash_ which is in the CodeIgniter.Try the below one:

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

Controller:

In Controller you can get the values from flashdata function.

$this->session->flashdata('params');

or

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


Another option:

$params = array(            'a' => 'foo',            'b' => 'bar'        );$output = $this->request('GET', 'my_controller/my_function', $params);