Skip to content

Commit a2bfa40

Browse files
committed
Merge branch 'bpo/2.9/#3662' into 2.9
2 parents e738a71 + 367f86e commit a2bfa40

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,27 @@
33
namespace Doctrine\Tests\DBAL\Functional;
44

55
use Doctrine\DBAL\Driver\ExceptionConverterDriver;
6+
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
67
use Doctrine\DBAL\DriverManager;
78
use Doctrine\DBAL\Exception;
9+
use Doctrine\DBAL\Platforms\DrizzlePlatform;
10+
use Doctrine\DBAL\Platforms\MySqlPlatform;
11+
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
12+
use Doctrine\DBAL\Platforms\SqlitePlatform;
813
use Doctrine\DBAL\Schema\Schema;
914
use Doctrine\DBAL\Schema\Table;
1015
use Doctrine\Tests\DbalFunctionalTestCase;
1116
use Throwable;
1217
use function array_merge;
18+
use function assert;
1319
use function chmod;
1420
use function defined;
1521
use function file_exists;
1622
use function sprintf;
1723
use function sys_get_temp_dir;
1824
use function touch;
1925
use function unlink;
26+
use function version_compare;
2027

2128
class ExceptionTest extends DbalFunctionalTestCase
2229
{
@@ -289,7 +296,7 @@ public function testSyntaxErrorException()
289296
*/
290297
public function testConnectionExceptionSqLite($mode, $exceptionClass)
291298
{
292-
if ($this->connection->getDatabasePlatform()->getName() !== 'sqlite') {
299+
if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
293300
$this->markTestSkipped('Only fails this way on sqlite');
294301
}
295302

@@ -333,18 +340,29 @@ public function getSqLiteOpenConnection()
333340
*/
334341
public function testConnectionException($params)
335342
{
336-
if ($this->connection->getDatabasePlatform()->getName() === 'sqlite') {
343+
$platform = $this->connection->getDatabasePlatform();
344+
345+
if ($platform instanceof SqlitePlatform) {
337346
$this->markTestSkipped('Only skipped if platform is not sqlite');
338347
}
339348

340-
if ($this->connection->getDatabasePlatform()->getName() === 'drizzle') {
349+
if ($platform instanceof DrizzlePlatform) {
341350
$this->markTestSkipped('Drizzle does not always support authentication');
342351
}
343352

344-
if ($this->connection->getDatabasePlatform()->getName() === 'postgresql' && isset($params['password'])) {
353+
if ($platform instanceof PostgreSqlPlatform && isset($params['password'])) {
345354
$this->markTestSkipped('Does not work on Travis');
346355
}
347356

357+
if ($platform instanceof MySqlPlatform && isset($params['user'])) {
358+
$wrappedConnection = $this->connection->getWrappedConnection();
359+
assert($wrappedConnection instanceof ServerInfoAwareConnection);
360+
361+
if (version_compare($wrappedConnection->getServerVersion(), '8', '>=')) {
362+
$this->markTestIncomplete('PHP currently does not completely support MySQL 8');
363+
}
364+
}
365+
348366
$defaultParams = $this->connection->getParams();
349367
$params = array_merge($defaultParams, $params);
350368

0 commit comments

Comments
 (0)