Skip to content

Commit

Permalink
Fix Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisgoddard committed Apr 14, 2016
1 parent 9a5bd67 commit 6896af9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions _onces/phoenix/once.test.initialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
// Over-ride the DB_Prefix setting.
$settings['db_prefix'] = $settings['db_prefix'].'TESTING_';

if ( getenv('CI') ) {
$root_db = mysqli_connect('localhost', 'root', '', $settings['db_name']);
if ( !$root_db ) {
echo 'Failed to connect to database for testing.';
$failure = true;
}
$query_grant = 'GRANT ALL ON `'.$settings['db_name'].'`.* TO \''.$settings['db_user'].'\'@\''.$settings['db_host'].'\' IDENTIFIED BY \''.$settings['db_pass'].'\';';
$query_flush = 'FLUSH PRIVILEGES;';
mysqli_query($root_db, $query_grant);
mysqli_query($root_db, $query_flush);
}

// Connect to the Database for testing.
$test_db = mysqli_connect($settings['db_host'], $settings['db_user'], $settings['db_pass'], $settings['db_name']);
if ( !$test_db ) {
Expand Down

0 comments on commit 6896af9

Please sign in to comment.