diff --git a/tests/Driver/API/ExceptionConverterTest.php b/tests/Driver/API/ExceptionConverterTest.php deleted file mode 100644 index 35bdcc397a6..00000000000 --- a/tests/Driver/API/ExceptionConverterTest.php +++ /dev/null @@ -1,79 +0,0 @@ -converter = $this->createConverter(); - } - - abstract protected function createConverter(): ExceptionConverter; - - /** - * @param class-string $expectedClass - * - * @dataProvider exceptionConversionProvider - */ - public function testConvertsException( - string $expectedClass, - int $errorCode, - ?string $sqlState = null, - string $message = '', - ?Query $query = null - ): void { - $driverException = $this->getMockForAbstractClass( - AbstractException::class, - [$message, $sqlState, $errorCode] - ); - - if ($query !== null) { - $expectedMessage = 'An exception occurred while executing a query: ' . $message; - } else { - $expectedMessage = 'An exception occurred in the driver: ' . $message; - } - - $dbalException = $this->converter->convert($driverException, $query); - - self::assertInstanceOf($expectedClass, $dbalException); - self::assertSame($driverException->getCode(), $dbalException->getCode()); - self::assertSame($driverException->getSQLState(), $dbalException->getSQLState()); - self::assertSame($driverException, $dbalException->getPrevious()); - self::assertSame($expectedMessage, $dbalException->getMessage()); - self::assertSame($query, $dbalException->getQuery()); - } - - /** - * @return iterable - */ - public static function exceptionConversionProvider(): iterable - { - foreach (static::getExceptionConversionData() as $expectedClass => $items) { - foreach ($items as $item) { - yield array_merge([$expectedClass], $item); - } - } - - yield [DriverException::class, 1, 'HY000', 'The message']; - yield [DriverException::class, 1, 'HY000', 'The message', new Query('SELECT x', [], [])]; - } - - /** - * @return array - */ - abstract protected static function getExceptionConversionData(): array; -} diff --git a/tests/Driver/API/MySQL/ExceptionConverterTest.php b/tests/Driver/API/MySQL/ExceptionConverterTest.php deleted file mode 100644 index 79a86875685..00000000000 --- a/tests/Driver/API/MySQL/ExceptionConverterTest.php +++ /dev/null @@ -1,109 +0,0 @@ - [ - [1044], - [1045], - [1046], - [1049], - [1095], - [1142], - [1143], - [1227], - [1370], - [2002], - [2005], - ], - ForeignKeyConstraintViolationException::class => [ - [1216], - [1217], - [1451], - [1452], - ], - InvalidFieldNameException::class => [ - [1054], - [1166], - [1611], - ], - NonUniqueFieldNameException::class => [ - [1052], - [1060], - [1110], - ], - NotNullConstraintViolationException::class => [ - [1048], - [1121], - [1138], - [1171], - [1252], - [1263], - [1364], - [1566], - ], - SyntaxErrorException::class => [ - [1064], - [1149], - [1287], - [1341], - [1342], - [1343], - [1344], - [1382], - [1479], - [1541], - [1554], - [1626], - ], - TableExistsException::class => [ - [1050], - ], - TableNotFoundException::class => [ - [1051], - [1146], - ], - UniqueConstraintViolationException::class => [ - [1062], - [1557], - [1569], - [1586], - ], - DeadlockException::class => [ - [1213], - ], - LockWaitTimeoutException::class => [ - [1205], - ], - ]; - } -} diff --git a/tests/Driver/API/OCI/ExceptionConverterTest.php b/tests/Driver/API/OCI/ExceptionConverterTest.php deleted file mode 100644 index 13f01331dca..00000000000 --- a/tests/Driver/API/OCI/ExceptionConverterTest.php +++ /dev/null @@ -1,66 +0,0 @@ - [ - [1017], - [12545], - ], - ForeignKeyConstraintViolationException::class => [ - [2292], - ], - InvalidFieldNameException::class => [ - [904], - ], - NonUniqueFieldNameException::class => [ - [918], - [960], - ], - NotNullConstraintViolationException::class => [ - [1400], - ], - SyntaxErrorException::class => [ - [923], - ], - TableExistsException::class => [ - [955], - ], - TableNotFoundException::class => [ - [942], - ], - UniqueConstraintViolationException::class => [ - [1], - [2299], - [38911], - ], - ]; - } -} diff --git a/tests/Driver/API/PostgreSQL/ExceptionConverterTest.php b/tests/Driver/API/PostgreSQL/ExceptionConverterTest.php deleted file mode 100644 index 65e39096300..00000000000 --- a/tests/Driver/API/PostgreSQL/ExceptionConverterTest.php +++ /dev/null @@ -1,67 +0,0 @@ - [ - [7, null, 'SQLSTATE[08006]'], - ], - ForeignKeyConstraintViolationException::class => [ - [0, '23503'], - ], - InvalidFieldNameException::class => [ - [0, '42703'], - ], - NonUniqueFieldNameException::class => [ - [0, '42702'], - ], - NotNullConstraintViolationException::class => [ - [0, '23502'], - ], - SyntaxErrorException::class => [ - [0, '42601'], - ], - TableExistsException::class => [ - [0, '42P07'], - ], - TableNotFoundException::class => [ - [0, '42P01'], - ], - UniqueConstraintViolationException::class => [ - [0, '23505'], - ], - DeadlockException::class => [ - [0, '40001'], - [0, '40P01'], - ], - ]; - } -} diff --git a/tests/Driver/API/SQLite/ExceptionConverterTest.php b/tests/Driver/API/SQLite/ExceptionConverterTest.php deleted file mode 100644 index 35b4c0a575d..00000000000 --- a/tests/Driver/API/SQLite/ExceptionConverterTest.php +++ /dev/null @@ -1,68 +0,0 @@ - [ - [0, null, 'unable to open database file'], - ], - InvalidFieldNameException::class => [ - [0, null, 'has no column named'], - ], - NonUniqueFieldNameException::class => [ - [0, null, 'ambiguous column name'], - ], - NotNullConstraintViolationException::class => [ - [0, null, 'may not be NULL'], - ], - ReadOnlyException::class => [ - [0, null, 'attempt to write a readonly database'], - ], - SyntaxErrorException::class => [ - [0, null, 'syntax error'], - ], - TableExistsException::class => [ - [0, null, 'already exists'], - ], - TableNotFoundException::class => [ - [0, null, 'no such table:'], - ], - UniqueConstraintViolationException::class => [ - [0, null, 'must be unique'], - [0, null, 'is not unique'], - [0, null, 'are not unique'], - ], - LockWaitTimeoutException::class => [ - [0, null, 'database is locked'], - ], - ]; - } -}