here is the following method inside the controller I am trying to test:
function index(){
if($this->session->userdata('userid')){
$data['username'] = $this->session->userdata('username');
$data['path'] = $this->session->userdata('logo');
$this->load->view('home', $data);
}
else{
//If no session, redirect to login page
redirect('login', 'refresh');
}
}
here is the test method:
public function test_index($userid, $username, $logo_path, $permissions, $tour, $is_admin, $expected){
//to skip this test uncomment below line
//$this->markTestSkipped();
$_SESSION = [
'userid' => $userid,
'username' => $username,
'logo' => $logo_path,
'permissions' => $permissions,
'tour' => $tour,
'is_admin' => $is_admin
];
$output = $this->request('GET', ['Home', 'index']);
//check if redirect or not
if($output)
$this->assertContains($expected, $output);
else
$this->assertRedirect('login');
}
I keep getting the following error:
Risky Test: Test code or tested code did not (only) close its own output buffers.
I don't know what am I doing wrong? Can someone please help