Restore the connection check
This commit is contained in:
parent
1e52c430e6
commit
eb8caaa5e7
2 changed files with 8 additions and 9 deletions
|
@ -385,12 +385,11 @@ class Database
|
||||||
|
|
||||||
switch ($this->driver) {
|
switch ($this->driver) {
|
||||||
case self::PDO:
|
case self::PDO:
|
||||||
$connected = true;
|
$r = $this->p("SELECT 1");
|
||||||
// $r = $this->p("SELECT 1");
|
if ($this->isResult($r)) {
|
||||||
// if ($this->isResult($r)) {
|
$row = $this->toArray($r);
|
||||||
// $row = $this->toArray($r);
|
$connected = ($row[0]['1'] == '1');
|
||||||
// $connected = ($row[0]['1'] == '1');
|
}
|
||||||
// }
|
|
||||||
break;
|
break;
|
||||||
case self::MYSQLI:
|
case self::MYSQLI:
|
||||||
$connected = $this->connection->ping();
|
$connected = $this->connection->ping();
|
||||||
|
|
|
@ -119,9 +119,9 @@ class DependencyCheckTest extends TestCase
|
||||||
$database = $this->dice->create(Database::class);
|
$database = $this->dice->create(Database::class);
|
||||||
|
|
||||||
self::assertInstanceOf(Database::class, $database);
|
self::assertInstanceOf(Database::class, $database);
|
||||||
self::assertContains($database->getDriver(), [Database::PDO, Database::MYSQLI]);
|
self::assertContains($database->getDriver(), [Database::PDO, Database::MYSQLI], 'The driver returns an unexpected value');
|
||||||
self::assertNotNull($database->getConnection());
|
self::assertNotNull($database->getConnection(), 'There is no database connection');
|
||||||
self::assertTrue($database->connected());
|
self::assertTrue($database->connected(), 'The database is not connected');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAppMode()
|
public function testAppMode()
|
||||||
|
|
Loading…
Reference in a new issue