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