|
3 | 3 | namespace Doctrine\Tests\DBAL\Functional; |
4 | 4 |
|
5 | 5 | use Doctrine\DBAL\Driver\ExceptionConverterDriver; |
| 6 | +use Doctrine\DBAL\Driver\ServerInfoAwareConnection; |
6 | 7 | use Doctrine\DBAL\DriverManager; |
7 | 8 | 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; |
8 | 13 | use Doctrine\DBAL\Schema\Schema; |
9 | 14 | use Doctrine\DBAL\Schema\Table; |
10 | 15 | use Doctrine\Tests\DbalFunctionalTestCase; |
11 | 16 | use Throwable; |
12 | 17 | use function array_merge; |
| 18 | +use function assert; |
13 | 19 | use function chmod; |
14 | 20 | use function defined; |
15 | 21 | use function file_exists; |
16 | 22 | use function sprintf; |
17 | 23 | use function sys_get_temp_dir; |
18 | 24 | use function touch; |
19 | 25 | use function unlink; |
| 26 | +use function version_compare; |
20 | 27 |
|
21 | 28 | class ExceptionTest extends DbalFunctionalTestCase |
22 | 29 | { |
@@ -289,7 +296,7 @@ public function testSyntaxErrorException() |
289 | 296 | */ |
290 | 297 | public function testConnectionExceptionSqLite($mode, $exceptionClass) |
291 | 298 | { |
292 | | - if ($this->connection->getDatabasePlatform()->getName() !== 'sqlite') { |
| 299 | + if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { |
293 | 300 | $this->markTestSkipped('Only fails this way on sqlite'); |
294 | 301 | } |
295 | 302 |
|
@@ -333,18 +340,29 @@ public function getSqLiteOpenConnection() |
333 | 340 | */ |
334 | 341 | public function testConnectionException($params) |
335 | 342 | { |
336 | | - if ($this->connection->getDatabasePlatform()->getName() === 'sqlite') { |
| 343 | + $platform = $this->connection->getDatabasePlatform(); |
| 344 | + |
| 345 | + if ($platform instanceof SqlitePlatform) { |
337 | 346 | $this->markTestSkipped('Only skipped if platform is not sqlite'); |
338 | 347 | } |
339 | 348 |
|
340 | | - if ($this->connection->getDatabasePlatform()->getName() === 'drizzle') { |
| 349 | + if ($platform instanceof DrizzlePlatform) { |
341 | 350 | $this->markTestSkipped('Drizzle does not always support authentication'); |
342 | 351 | } |
343 | 352 |
|
344 | | - if ($this->connection->getDatabasePlatform()->getName() === 'postgresql' && isset($params['password'])) { |
| 353 | + if ($platform instanceof PostgreSqlPlatform && isset($params['password'])) { |
345 | 354 | $this->markTestSkipped('Does not work on Travis'); |
346 | 355 | } |
347 | 356 |
|
| 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 | + |
348 | 366 | $defaultParams = $this->connection->getParams(); |
349 | 367 | $params = array_merge($defaultParams, $params); |
350 | 368 |
|
|
0 commit comments