Refactored Database.
This commit is contained in:
parent
8b5a874789
commit
e23ad3237a
|
@ -4,6 +4,7 @@ namespace b8;
|
|||
|
||||
use b8\Http\Request;
|
||||
use b8\Http\Response;
|
||||
use PHPCensor\View;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace b8;
|
||||
namespace PHPCensor;
|
||||
|
||||
use b8\Config;
|
||||
|
||||
class Database extends \PDO
|
||||
{
|
||||
|
@ -76,7 +78,7 @@ class Database extends \PDO
|
|||
/**
|
||||
* @param string $type
|
||||
*
|
||||
* @return \b8\Database
|
||||
* @return Database
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
|
@ -6,7 +6,7 @@ use PDO;
|
|||
use PHPCensor\Builder;
|
||||
use PHPCensor\Model\Build;
|
||||
use PHPCensor\Plugin;
|
||||
use b8\Database;
|
||||
use PHPCensor\Database;
|
||||
|
||||
/**
|
||||
* MySQL Plugin - Provides access to a MySQL database.
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace PHPCensor;
|
||||
|
||||
use b8\Database;
|
||||
|
||||
abstract class Store
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Store;
|
||||
|
||||
use b8\Database;
|
||||
use PHPCensor\Database;
|
||||
use PHPCensor\Model\BuildError;
|
||||
use b8\Exception\HttpException;
|
||||
use PHPCensor\Store;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PHPCensor\Store;
|
||||
|
||||
use b8\Config;
|
||||
use b8\Database;
|
||||
use PHPCensor\Database;
|
||||
use PHPCensor\Model\BuildError;
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PHPCensor\Store;
|
||||
|
||||
use PHPCensor\Store;
|
||||
use b8\Database;
|
||||
use PHPCensor\Database;
|
||||
use PHPCensor\Model\BuildMeta;
|
||||
use b8\Exception\HttpException;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Store;
|
||||
|
||||
use b8\Database;
|
||||
use PHPCensor\Database;
|
||||
use PHPCensor\Model\Build;
|
||||
use b8\Exception\HttpException;
|
||||
use PHPCensor\Model\BuildMeta;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Store;
|
||||
|
||||
use b8\Database;
|
||||
use PHPCensor\Database;
|
||||
use PHPCensor\Model\Environment;
|
||||
use PHPCensor\Store;
|
||||
use b8\Exception\HttpException;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Store;
|
||||
|
||||
use b8\Database;
|
||||
use PHPCensor\Database;
|
||||
use b8\Exception\HttpException;
|
||||
use PHPCensor\Store;
|
||||
use PHPCensor\Model\ProjectGroup;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace PHPCensor\Store;
|
||||
|
||||
use b8\Database;
|
||||
use PHPCensor\Database;
|
||||
use PHPCensor\Model\Project;
|
||||
use PHPCensor\Store;
|
||||
use b8\Exception\HttpException;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace PHPCensor\Store;
|
||||
|
||||
use PHPCensor\Store;
|
||||
use b8\Database;
|
||||
use PHPCensor\Database;
|
||||
use b8\Exception\HttpException;
|
||||
use PHPCensor\Model\User;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Tests\b8;
|
||||
|
||||
use b8\Config;
|
||||
use b8\Database;
|
||||
use PHPCensor\Database;
|
||||
|
||||
class DatabaseMysqlTest extends \PHPUnit_Extensions_Database_TestCase
|
||||
{
|
||||
|
@ -117,8 +117,8 @@ class DatabaseMysqlTest extends \PHPUnit_Extensions_Database_TestCase
|
|||
$writeConnection = Database::getConnection('write');
|
||||
$readConnection = Database::getConnection('read');
|
||||
|
||||
self::assertInstanceOf('\b8\Database', $writeConnection);
|
||||
self::assertInstanceOf('\b8\Database', $readConnection);
|
||||
self::assertInstanceOf('\PHPCensor\Database', $writeConnection);
|
||||
self::assertInstanceOf('\PHPCensor\Database', $readConnection);
|
||||
|
||||
$writeDetails = $writeConnection->getDetails();
|
||||
|
||||
|
@ -168,8 +168,8 @@ class DatabaseMysqlTest extends \PHPUnit_Extensions_Database_TestCase
|
|||
$writeConnection = Database::getConnection('write');
|
||||
$readConnection = Database::getConnection('read');
|
||||
|
||||
self::assertInstanceOf('\b8\Database', $writeConnection);
|
||||
self::assertInstanceOf('\b8\Database', $readConnection);
|
||||
self::assertInstanceOf('\PHPCensor\Database', $writeConnection);
|
||||
self::assertInstanceOf('\PHPCensor\Database', $readConnection);
|
||||
|
||||
self::assertEquals('mysql:host=localhost;port=3306;dbname=b8_test', $readConnection->getDsn());
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
namespace Tests\b8;
|
||||
|
||||
use b8\Config;
|
||||
use b8\Database;
|
||||
use PHPCensor\Database;
|
||||
|
||||
class DatabasePostgresqlTest extends \PHPUnit_Extensions_Database_TestCase
|
||||
{
|
||||
|
@ -117,8 +117,8 @@ class DatabasePostgresqlTest extends \PHPUnit_Extensions_Database_TestCase
|
|||
$writeConnection = Database::getConnection('write');
|
||||
$readConnection = Database::getConnection('read');
|
||||
|
||||
self::assertInstanceOf('\b8\Database', $writeConnection);
|
||||
self::assertInstanceOf('\b8\Database', $readConnection);
|
||||
self::assertInstanceOf('\PHPCensor\Database', $writeConnection);
|
||||
self::assertInstanceOf('\PHPCensor\Database', $readConnection);
|
||||
|
||||
$writeDetails = $writeConnection->getDetails();
|
||||
|
||||
|
@ -168,8 +168,8 @@ class DatabasePostgresqlTest extends \PHPUnit_Extensions_Database_TestCase
|
|||
$writeConnection = Database::getConnection('write');
|
||||
$readConnection = Database::getConnection('read');
|
||||
|
||||
self::assertInstanceOf('\b8\Database', $writeConnection);
|
||||
self::assertInstanceOf('\b8\Database', $readConnection);
|
||||
self::assertInstanceOf('\PHPCensor\Database', $writeConnection);
|
||||
self::assertInstanceOf('\PHPCensor\Database', $readConnection);
|
||||
|
||||
self::assertEquals('pgsql:host=localhost;port=5432;dbname=b8_test', $readConnection->getDsn());
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
namespace Tests\PHPCensor;
|
||||
|
||||
use b8\Config;
|
||||
use b8\Database;
|
||||
use PHPCensor\Database;
|
||||
use PHPCensor\Store\Factory;
|
||||
use PHPCensor\Model\Project;
|
||||
use PHPCensor\Model\ProjectGroup;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace Tests\PHPCensor;
|
||||
|
||||
use b8\Config;
|
||||
use b8\Database;
|
||||
use PHPCensor\Database;
|
||||
use PHPCensor\Store\Factory;
|
||||
use PHPCensor\Model\Project;
|
||||
use PHPCensor\Model\ProjectGroup;
|
||||
|
|
Loading…
Reference in a new issue