diff --git a/tests/lib/DB/Exception/DbalExceptionTest.php b/tests/lib/DB/Exception/DbalExceptionTest.php index 470beff9080..ec9a1f9716c 100644 --- a/tests/lib/DB/Exception/DbalExceptionTest.php +++ b/tests/lib/DB/Exception/DbalExceptionTest.php @@ -7,7 +7,6 @@ declare(strict_types=1); */ namespace Test\DB\Exception; -use Doctrine\DBAL\ConnectionException; use Doctrine\DBAL\Driver\Exception as TheDriverException; use Doctrine\DBAL\Exception\ConstraintViolationException; use Doctrine\DBAL\Exception\DatabaseObjectExistsException; @@ -15,9 +14,10 @@ use Doctrine\DBAL\Exception\DatabaseObjectNotFoundException; use Doctrine\DBAL\Exception\DeadlockException; use Doctrine\DBAL\Exception\DriverException; use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException; -use Doctrine\DBAL\Exception\InvalidArgumentException; use Doctrine\DBAL\Exception\InvalidFieldNameException; +use Doctrine\DBAL\Exception\InvalidWrapperClass; use Doctrine\DBAL\Exception\LockWaitTimeoutException; +use Doctrine\DBAL\Exception\NoActiveTransaction; use Doctrine\DBAL\Exception\NonUniqueFieldNameException; use Doctrine\DBAL\Exception\NotNullConstraintViolationException; use Doctrine\DBAL\Exception\ServerException; @@ -63,12 +63,12 @@ class DbalExceptionTest extends \Test\TestCase { } public function testConnectionException(): void { - $result = DbalException::wrap(ConnectionException::noActiveTransaction()); + $result = DbalException::wrap(NoActiveTransaction::new()); $this->assertSame(DbalException::REASON_CONNECTION_LOST, $result->getReason()); } public function testInvalidArgumentException(): void { - $result = DbalException::wrap(InvalidArgumentException::fromEmptyCriteria()); + $result = DbalException::wrap(InvalidWrapperClass::new('A')); $this->assertSame(DbalException::REASON_INVALID_ARGUMENT, $result->getReason()); } } diff --git a/tests/lib/DB/MigrationsTest.php b/tests/lib/DB/MigrationsTest.php index 6cd489258bf..05dbc13e372 100644 --- a/tests/lib/DB/MigrationsTest.php +++ b/tests/lib/DB/MigrationsTest.php @@ -11,10 +11,10 @@ namespace Test\DB; use Doctrine\DBAL\Platforms\OraclePlatform; use Doctrine\DBAL\Platforms\PostgreSqlPlatform; use Doctrine\DBAL\Schema\Column; +use Doctrine\DBAL\Schema\Exception\TableDoesNotExist; use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\Schema; -use Doctrine\DBAL\Schema\SchemaException; use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Types\Type; @@ -100,7 +100,7 @@ class MigrationsTest extends \Test\TestCase { ->method('migrateToSchema'); $wrappedSchema = $this->createMock(Schema::class); - $wrappedSchema->expects($this->exactly(2)) + $wrappedSchema->expects($this->any()) ->method('getTables') ->willReturn([]); $wrappedSchema->expects($this->exactly(2)) @@ -273,7 +273,7 @@ class MigrationsTest extends \Test\TestCase { $sourceSchema = $this->createMock(Schema::class); $sourceSchema->expects($this->any()) ->method('getTable') - ->willThrowException(new SchemaException()); + ->willThrowException(TableDoesNotExist::new('a')); $sourceSchema->expects($this->any()) ->method('hasSequence') ->willReturn(false); @@ -316,7 +316,7 @@ class MigrationsTest extends \Test\TestCase { $sourceSchema = $this->createMock(Schema::class); $sourceSchema->expects($this->any()) ->method('getTable') - ->willThrowException(new SchemaException()); + ->willThrowException(TableDoesNotExist::new('a')); $sourceSchema->expects($this->any()) ->method('hasSequence') ->willReturn(false); @@ -369,7 +369,7 @@ class MigrationsTest extends \Test\TestCase { $sourceSchema = $this->createMock(Schema::class); $sourceSchema->expects($this->any()) ->method('getTable') - ->willThrowException(new SchemaException()); + ->willThrowException(TableDoesNotExist::new('a')); $sourceSchema->expects($this->any()) ->method('hasSequence') ->willReturn(false); @@ -394,7 +394,7 @@ class MigrationsTest extends \Test\TestCase { $sourceSchema = $this->createMock(Schema::class); $sourceSchema->expects($this->any()) ->method('getTable') - ->willThrowException(new SchemaException()); + ->willThrowException(TableDoesNotExist::new('a')); $sourceSchema->expects($this->any()) ->method('hasSequence') ->willReturn(false); @@ -447,7 +447,7 @@ class MigrationsTest extends \Test\TestCase { $sourceSchema = $this->createMock(Schema::class); $sourceSchema->expects($this->any()) ->method('getTable') - ->willThrowException(new SchemaException()); + ->willThrowException(TableDoesNotExist::new('a')); $sourceSchema->expects($this->any()) ->method('hasSequence') ->willReturn(false); @@ -490,7 +490,7 @@ class MigrationsTest extends \Test\TestCase { $sourceSchema = $this->createMock(Schema::class); $sourceSchema->expects($this->any()) ->method('getTable') - ->willThrowException(new SchemaException()); + ->willThrowException(TableDoesNotExist::new('a')); $sourceSchema->expects($this->any()) ->method('hasSequence') ->willReturn(false); @@ -524,7 +524,7 @@ class MigrationsTest extends \Test\TestCase { $sourceSchema = $this->createMock(Schema::class); $sourceSchema->expects($this->any()) ->method('getTable') - ->willThrowException(new SchemaException()); + ->willThrowException(TableDoesNotExist::new('a')); $sourceSchema->expects($this->any()) ->method('hasSequence') ->willReturn(false); @@ -561,7 +561,7 @@ class MigrationsTest extends \Test\TestCase { $sourceSchema = $this->createMock(Schema::class); $sourceSchema->expects($this->any()) ->method('getTable') - ->willThrowException(new SchemaException()); + ->willThrowException(TableDoesNotExist::new('a')); $sourceSchema->expects($this->any()) ->method('hasSequence') ->willReturn(false); @@ -601,7 +601,7 @@ class MigrationsTest extends \Test\TestCase { $sourceSchema = $this->createMock(Schema::class); $sourceSchema->expects($this->any()) ->method('getTable') - ->willThrowException(new SchemaException()); + ->willThrowException(TableDoesNotExist::new('a')); $sourceSchema->expects($this->any()) ->method('hasSequence') ->willReturn(false); @@ -642,7 +642,7 @@ class MigrationsTest extends \Test\TestCase { $sourceSchema = $this->createMock(Schema::class); $sourceSchema->expects($this->any()) ->method('getTable') - ->willThrowException(new SchemaException()); + ->willThrowException(TableDoesNotExist::new('a')); $sourceSchema->expects($this->any()) ->method('hasSequence') ->willReturn(false); @@ -670,7 +670,7 @@ class MigrationsTest extends \Test\TestCase { $sourceSchema = $this->createMock(Schema::class); $sourceSchema->expects($this->any()) ->method('getTable') - ->willThrowException(new SchemaException()); + ->willThrowException(TableDoesNotExist::new('a')); $sourceSchema->expects($this->any()) ->method('hasSequence') ->willReturn(false); @@ -710,7 +710,7 @@ class MigrationsTest extends \Test\TestCase { $sourceSchema = $this->createMock(Schema::class); $sourceSchema->expects($this->any()) ->method('getTable') - ->willThrowException(new SchemaException()); + ->willThrowException(TableDoesNotExist::new('a')); $sourceSchema->expects($this->any()) ->method('hasSequence') ->willReturn(false); @@ -750,7 +750,7 @@ class MigrationsTest extends \Test\TestCase { $sourceSchema = $this->createMock(Schema::class); $sourceSchema->expects($this->any()) ->method('getTable') - ->willThrowException(new SchemaException()); + ->willThrowException(TableDoesNotExist::new('a')); $sourceSchema->expects($this->any()) ->method('hasSequence') ->willReturn(false);