mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
fix(tests): Fix changes in doctrine's Exception handling
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
4c80fdd2bd
commit
5718e8fff5
2 changed files with 19 additions and 19 deletions
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue