-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,41 @@ | ||
<?php | ||
use FastD\Application; | ||
|
||
/** | ||
* @author jan huang <[email protected]> | ||
* @copyright 2016 | ||
* | ||
* @see https://www.github.com/janhuang | ||
* @see http://www.fast-d.cn/ | ||
*/ | ||
class DatabaseTest extends PHPUnit_Framework_TestCase | ||
class DatabaseTest extends \FastD\TestCase | ||
{ | ||
public function testConnection() | ||
public function createApplication() | ||
{ | ||
$app = new Application(__DIR__.'/../app/default'); | ||
|
||
return $app; | ||
} | ||
|
||
public function createDatabase() | ||
{ | ||
$config = config()->get('database.default'); | ||
return new \FastD\Model\Database([ | ||
'database_type' => isset($config['adapter']) ? $config['adapter'] : 'mysql', | ||
'database_name' => $config['name'], | ||
'server' => $config['host'], | ||
'username' => $config['user'], | ||
'password' => $config['pass'], | ||
'charset' => isset($config['charset']) ? $config['charset'] : 'utf8', | ||
'port' => isset($config['port']) ? $config['port'] : 3306, | ||
'prefix' => isset($config['prefix']) ? $config['prefix'] : '', | ||
]); | ||
} | ||
|
||
public function testGoneAwayConnection() | ||
{ | ||
$database = $this->createDatabase(); | ||
$tables = $database->query('show tables;')->fetchAll(); | ||
$this->assertTrue(true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,12 +13,6 @@ | |
*/ | ||
'name' => 'fast-d', | ||
|
||
/* | ||
* Application logger path | ||
*/ | ||
'log' => [ | ||
], | ||
|
||
/* | ||
* Exception handle | ||
*/ | ||
|