kenjis / ci-app-for-ci-phpunit-test

CodeIgniter Test Application for ci-phpunit-test
31 stars 20 forks source link

add resetInstance test case #14

Closed ytetsuro closed 6 years ago

ytetsuro commented 6 years ago

An error occurred when I ran the following code.

<?php
class Sample_model_test extends DbTestCase
{
   private $obj;

    public function setUp()
    {
        parent::setUp();
        $this->obj = $this->newModel('sample_model');
    }

    public function test_sample_insert()
    {
        $this->obj->add_sample('john');
        $this->grabFromDatabase('sample', ['name' => 'john']);
    }
}

following error message.

Error: Call to a member function real_escape_string() on boolean

/vagrant/vendor/codeigniter/framework/system/database/drivers/mysqli/mysqli_driver.php:391
/vagrant/vendor/codeigniter/framework/system/database/DB_driver.php:1143
/vagrant/vendor/codeigniter/framework/system/database/DB_driver.php:1108
/vagrant/vendor/codeigniter/framework/system/database/DB_query_builder.php:683
/vagrant/vendor/codeigniter/framework/system/database/DB_query_builder.php:623
/vagrant/vendor/kenjis/ci-phpunit-test/application/tests/_ci_phpunit_test/CIPHPUnitTestDbTestCase.php:109

This is to close the DB that the CI Instance has when calling resetInstance.

ci-phpunit-test PR: https://github.com/kenjis/ci-phpunit-test/pull/225