Merge pull request #9505 from annando/test-mysql-no-pdo

Make the tests work again with PHP 7.2
This commit is contained in:
Hypolite Petovan 2020-11-08 12:40:03 -05:00 committed by GitHub
commit e3c8b6def0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,22 +115,30 @@ class DependencyCheckTest extends TestCase
public function testDatabase() public function testDatabase()
{ {
$configCache = $this->dice->create(Cache::class);
$configCache->set('database', 'disable_pdo', true);
/** @var Database $database */ /** @var Database $database */
$database = $this->dice->create(Database::class); $database = $this->dice->create(Database::class);
$database->setTestmode(true);
self::assertInstanceOf(Database::class, $database); self::assertInstanceOf(Database::class, $database);
self::assertContains($database->getDriver(), [Database::PDO, Database::MYSQLI], 'The driver returns an unexpected value'); self::assertContains($database->getDriver(), [Database::MYSQLI], 'The driver returns an unexpected value');
self::assertNotNull($database->getConnection(), 'There is no database connection'); self::assertNotNull($database->getConnection(), 'There is no database connection');
$result = $database->p("SELECT 1"); $result = $database->p("SELECT 1");
self::assertEquals($database->errorMessage(), '', 'There had been a database error message'); self::assertEquals('', $database->errorMessage(), 'There had been a database error message');
self::assertEquals($database->errorNo(), 0, 'There had been a database error number'); self::assertEquals(0, $database->errorNo(), 'There had been a database error number');
self::assertTrue($database->connected(), 'The database is not connected'); self::assertTrue($database->connected(), 'The database is not connected');
} }
public function testAppMode() public function testAppMode()
{ {
$configCache = $this->dice->create(Cache::class);
$configCache->set('database', 'disable_pdo', true);
/** @var App\Mode $mode */ /** @var App\Mode $mode */
$mode = $this->dice->create(App\Mode::class); $mode = $this->dice->create(App\Mode::class);