Skip to content
This repository was archived by the owner on Aug 19, 2022. It is now read-only.

Commit bf95897

Browse files
committed
Updated to version 1.2.0
1 parent bad2136 commit bf95897

File tree

2 files changed

+15
-39
lines changed

2 files changed

+15
-39
lines changed

src/Database.php

-9
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,6 @@ public static function getConnection(
170170
return self::$conn[$id];
171171
}
172172

173-
if (class_exists($app = 'Eliasis\\Framework\\App')) {
174-
$provider = $provider ?: $app::getOption('db', $id, 'provider');
175-
$host = $host ?: $app::getOption('db', $id, 'host');
176-
$user = $user ?: $app::getOption('db', $id, 'user');
177-
$name = $name ?: $app::getOption('db', $id, 'name');
178-
$password = $password ?: $app::getOption('db', $id, 'password');
179-
$settings = $settings ?: $app::getOption('db', $id, 'settings');
180-
}
181-
182173
return self::$conn[$id] = new self(
183174
$provider,
184175
$host,

tests/ConnectionTest.php

+15-30
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
*/
1111
namespace Josantonius\Database;
1212

13-
use Eliasis\Framework\App;
1413
use PHPUnit\Framework\TestCase;
1514

1615
/**
@@ -39,36 +38,22 @@ public function testGetConnection()
3938
'Josantonius\Database\Database',
4039
get_class($db)
4140
);
42-
}
4341

44-
/**
45-
* Get connection test when using config from the Eliasis Framework.
46-
*/
47-
public function testGetConnectionFromEliasis()
48-
{
49-
App::run(dirname(__DIR__));
50-
51-
App::setOption('db', [
52-
'Eliasis' => [
53-
'id' => 'Eliasis',
54-
'provider' => 'PDOprovider',
55-
'host' => $GLOBALS['DB_HOST'],
56-
'user' => $GLOBALS['DB_USER'],
57-
'name' => $GLOBALS['DB_NAME'],
58-
'password' => $GLOBALS['DB_PASSWORD'],
59-
'settings' => ['charset' => 'utf8'],
60-
'charset' => 'utf8',
61-
'engine' => 'innodb',
62-
],
63-
]);
64-
65-
$db = Database::getConnection('Eliasis');
66-
67-
$this->assertContains('Eliasis', $db::$id);
42+
$db = Database::getConnection(
43+
'api',
44+
'PDOprovider',
45+
$GLOBALS['DB_HOST'],
46+
$GLOBALS['DB_USER'],
47+
$GLOBALS['DB_NAME'],
48+
$GLOBALS['DB_PASSWORD'],
49+
['charset' => 'utf8']
50+
);
51+
52+
$this->assertContains('api', $db::$id);
6853

6954
$this->assertContains(
70-
'Josantonius\Database\Provider\PDOprovider',
71-
get_class($db->provider)
55+
'Josantonius\Database\Database',
56+
get_class($db)
7257
);
7358
}
7459

@@ -83,9 +68,9 @@ public function testMoveBetweenMultipleConnections()
8368

8469
$this->assertContains('identifier', $db::$id);
8570

86-
$db = Database::getConnection('Eliasis');
71+
$db = Database::getConnection('api');
8772

88-
$this->assertContains('Eliasis', $db::$id);
73+
$this->assertContains('api', $db::$id);
8974
}
9075

9176
/**

0 commit comments

Comments
 (0)