Skip to content

Commit

Permalink
fk test
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Oct 19, 2024
1 parent e6cf572 commit 658e3ac
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions tests/Functional/ForeignKeyConstraintViolationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
use Doctrine\DBAL\Driver\PDO\PgSQL\Driver as PDOPgSQLDriver;
use Doctrine\DBAL\Driver\PgSQL\Driver as PgSQLDriver;
use Doctrine\DBAL\Driver\PgSQL\Exception as PgSQLException;
use Doctrine\DBAL\Exception\DriverException;
use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
use Doctrine\DBAL\Platforms\DB2Platform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Tests\FunctionalTestCase;
Expand Down Expand Up @@ -226,18 +229,18 @@ private function skipIfDeferrableIsNotSupported(): void

private function expectConstraintViolation(bool $deferred): void
{
// if ($this->connection->getDatabasePlatform() instanceof SQLServerPlatform) {
// $this->expectExceptionMessage(sprintf("Violation of UNIQUE KEY constraint '%s'", $this->constraintName));
//
// return;
// }
//
// if ($this->connection->getDatabasePlatform() instanceof DB2Platform) {
// // No concrete message is provided
// $this->expectException(DriverException::class);
//
// return;
// }
if ($this->connection->getDatabasePlatform() instanceof SQLServerPlatform) {
$this->expectExceptionMessage(sprintf("Violation of UNIQUE KEY constraint '%s'", $this->constraintName));

return;
}

if ($this->connection->getDatabasePlatform() instanceof DB2Platform) {
// No concrete message is provided
$this->expectException(DriverException::class);

return;
}

if ($deferred) {
if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) {
Expand Down

0 comments on commit 658e3ac

Please sign in to comment.