diff --git a/Changelog b/Changelog index b3df25260..88d84e3aa 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2017-07-14 DariusIII + * Fix: Fix phpunit install test * Fix: Fix phpunit.xml bootstrap.php path * Mrg: Merge dev-laravel-switch branch into dev 2017-07-05 DariusIII diff --git a/tests/Install/InstallTest.php b/tests/Install/InstallTest.php index 5bb7ad001..9a476b9cf 100644 --- a/tests/Install/InstallTest.php +++ b/tests/Install/InstallTest.php @@ -5,10 +5,10 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @package NNTmux - * @author DariusIII + * @package NNTmux + * @author DariusIII * @copyright (c) 2017, NNTmux - * @version 0.0.1 + * @version 0.0.1 */ namespace tests; @@ -22,6 +22,7 @@ use nntmux\db\DB; use nntmux\db\DbUpdate; use nntmux\ColorCLI; use nntmux\Users; +use Illuminate\Database\Capsule\Manager as Capsule; /** * Class InstallTest @@ -196,26 +197,22 @@ class InstallTest extends \PHPUnit\Framework\TestCase break; } - if ($adapter !== null) { - if (empty(env('DB_SOCKET'))) { - $host = empty(env('DB_PORT')) ? env('DB_HOST') : env('DB_HOST') . ':' . env('DB_PORT'); - } else { - $host = env('DB_SOCKET'); - } - - \lithium\data\Connections::add('default', - [ - 'type' => 'database', - 'adapter' => $adapter, - 'host' => $host, - 'login' => env('DB_USER'), - 'password' => env('DB_PASSWORD'), - 'database' => env('DB_NAME'), - 'encoding' => 'UTF-8', - 'persistent' => false, - ] - ); - } + $capsule = new Capsule; + // Same as database configuration file of Laravel. + $capsule->addConnection([ + 'driver' => env('DB_SYSTEM'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_NAME', 'nntmux'), + 'username' => env('DB_USER', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8', + 'collation' => 'utf8_unicode_ci', + 'strict' => false + ], 'default' + ); + $capsule->bootEloquent(); $user = new Users(); if (!$user->isValidUsername(env('ADMIN_USER'))) {