CodeIgniter Forums

Full Version: Issue while running phpunit in codeigniter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I am new to PHPUnit tests for CodeIgniter application. I have installed ci-phpunit-test(with reference from https://github.com/kenjis/ci-phpunit-test) in my CI application and tried to run it with Welcome Test case. Then I got some errors. I am not sure whether I missed any configuration. Please find the issues below,

  1. Undefined index: scheme in DB.php line number 121. Then, I statically gave mysqli instead of $dns['scheme'] to check further.

  2. After 1, got an error such Error: Call to a member function close() on string in the file mysqli_driver line number 541. Then I commented this line and executed the phpunit. Welcome controller got tested successfully.

  3. So, I thought to test the model and then I wrote a test and executed. The error is Error: Call to a member function result() on null. Model Code below,
    $this->db->select('name,value'); $query = $this->db->get('config'); $configData=$query->result();
I tried to fix it by myself but I couldn't. Please help me to fix these errors.