From 1e710a24ae4dc94495facd8ea33eb81e674b51f7 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Wed, 26 Apr 2017 14:52:18 +0200 Subject: [PATCH] AAAAAAANNNDDD once more --- .travis.yml | 4 ++++ tests/UsersTest.php | 39 +-------------------------------------- 2 files changed, 5 insertions(+), 38 deletions(-) diff --git a/.travis.yml b/.travis.yml index 34fb46154..71388d48d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,6 +59,10 @@ before_script: - sed -i "s/'NN_LOGERROR', false/'NN_LOGERROR', true/" nntmux/config/settings.php - sed -i "s/'NN_LOGFATAL', false/'NN_LOGFATAL', true/" nntmux/config/settings.php - sed -i "s/'NN_LOGQUERIES', false/'NN_LOGQUERIES', true/" nntmux/config/settings.php + - cp .env.example .env + - sed -i "s/DB_USER = /DB_USER = NNTMUX/" .env + - sed -i "s/DB_PASSWORD = /DB_PASSWORD = NNTMUX/" .env + - sed -i "s/DB_NAME = nntmux/DB_NAME = NNTMUX/" .env script: phpunit --configuration tests/phpunit.xml diff --git a/tests/UsersTest.php b/tests/UsersTest.php index 13e750428..4b82f11c3 100644 --- a/tests/UsersTest.php +++ b/tests/UsersTest.php @@ -15,9 +15,6 @@ namespace tests; include_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'nntmux' . DIRECTORY_SEPARATOR . 'constants.php'; -use lithium\data\Connections; -use Dotenv\Dotenv; -use nntmux\config\Configure; use nntmux\db\DB; use nntmux\Users; @@ -28,42 +25,8 @@ class UsersTest extends \PHPUnit_Framework_TestCase const EMAIL = 'example@example.com'; public function testUsersAdd() { - - if (!defined('NN_INSTALLER')) { - define('NN_INSTALLER', true); - } - $config = new Configure('install'); - - - $dotenv = new Dotenv(NN_ROOT . DS . 'tests' . DS , '.env.test'); - $dotenv->load(); - $pdo = new DB( - [ - 'checkVersion' => true, - 'createDb' => true, - 'dbhost' => '127.0.0.1', - 'dbname' => 'NNTMUX', - 'dbpass' => 'NNTMUX', - 'dbport' => '3306', - 'dbsock' => '', - 'dbtype' => 'mysql', - 'dbuser' => 'NNTMUX' - ] - ); + $pdo = new DB(); $users = new Users(['Settings' => $pdo]); - - Connections::add('default', - [ - 'type' => 'database', - 'adapter' => 'MySql', - 'host' => '127.0.0.1:3306', - 'login' => 'NNTMUX', - 'password' => 'NNTMUX', - 'database' => 'NNTMUX', - 'encoding' => 'UTF-8', - 'persistent' => false, - ] - ); $users->add(self::USERNAME, self::PASSWORD, self::EMAIL, '2', '', ''); $userTest = $users->getByEmail(self::EMAIL); $this->assertEquals(self::EMAIL, $userTest['email']);