2

Recently i used a trick that from source https://github.com/fmalk/codeigniter-phpunit to integrate PHPUnit test to CodeIgniter. I've done everything as in the instruction, but when i start running the test, it gives me a error Unable to connect to the database server using the provided settings. In database.php , all the settings are right, for both testing and default because they are the same. I can run my project via localhost and it works fine. Here is my setting:

$db['testing']['hostname'] = 'localhost';
$db['testing']['username'] = 'root';
$db['testing']['password'] = 'motngaycu';
$db['testing']['database'] = 'work_is_easy';
$db['testing']['dbdriver'] = 'mysql';
$db['testing']['dbprefix'] = '';
$db['testing']['pconnect'] = TRUE;
$db['testing']['db_debug'] = TRUE;
$db['testing']['cache_on'] = FALSE;
$db['testing']['cachedir'] = '';
$db['testing']['char_set'] = 'utf8';
$db['testing']['dbcollat'] = 'utf8_general_ci';
$db['testing']['swap_pre'] = '';
$db['testing']['autoinit'] = TRUE;
$db['testing']['stricton'] = FALSE;

1 Answer 1

0

I'm the creator of that CI project. Your php.ini CLI settings might be different from when you run under a web server: please see this answer for clues.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.