Forward compatibility with PHPUnit 9.3

parent d2005239
...@@ -105,7 +105,7 @@ class OCI8StatementTest extends DbalTestCase ...@@ -105,7 +105,7 @@ class OCI8StatementTest extends DbalTestCase
public function testConvertNonTerminatedLiteral(string $sql, string $message): void public function testConvertNonTerminatedLiteral(string $sql, string $message): void
{ {
$this->expectException(OCI8Exception::class); $this->expectException(OCI8Exception::class);
$this->expectExceptionMessageRegExp($message); $this->expectExceptionMessageMatches($message);
OCI8Statement::convertPositionalToNamedPlaceholders($sql); OCI8Statement::convertPositionalToNamedPlaceholders($sql);
} }
......
...@@ -378,27 +378,19 @@ class SchemaTest extends TestCase ...@@ -378,27 +378,19 @@ class SchemaTest extends TestCase
->method('acceptSchema') ->method('acceptSchema')
->with($schema); ->with($schema);
$visitor->expects($this->at(1)) $visitor->expects(self::exactly(2))
->method('acceptTable') ->method('acceptTable')
->with($schema->getTable('baz')); ->withConsecutive(
[$schema->getTable('baz')],
[$schema->getTable('bla.bloo')]
);
$visitor->expects($this->at(2)) $visitor->expects(self::exactly(2))
->method('acceptTable')
->with($schema->getTable('bla.bloo'));
$visitor->expects($this->exactly(2))
->method('acceptTable');
$visitor->expects($this->at(3))
->method('acceptSequence') ->method('acceptSequence')
->with($schema->getSequence('moo')); ->withConsecutive(
[$schema->getSequence('moo')],
$visitor->expects($this->at(4)) [$schema->getSequence('war')]
->method('acceptSequence') );
->with($schema->getSequence('war'));
$visitor->expects($this->exactly(2))
->method('acceptSequence');
self::assertNull($schema->visit($visitor)); self::assertNull($schema->visit($visitor));
} }
...@@ -436,9 +428,6 @@ class SchemaTest extends TestCase ...@@ -436,9 +428,6 @@ class SchemaTest extends TestCase
->method('acceptNamespace') ->method('acceptNamespace')
->with('bla'); ->with('bla');
$visitor->expects($this->exactly(3))
->method('acceptNamespace');
$visitor->expects($this->at(4)) $visitor->expects($this->at(4))
->method('acceptTable') ->method('acceptTable')
->with($schema->getTable('baz')); ->with($schema->getTable('baz'));
...@@ -447,9 +436,6 @@ class SchemaTest extends TestCase ...@@ -447,9 +436,6 @@ class SchemaTest extends TestCase
->method('acceptTable') ->method('acceptTable')
->with($schema->getTable('bla.bloo')); ->with($schema->getTable('bla.bloo'));
$visitor->expects($this->exactly(2))
->method('acceptTable');
$visitor->expects($this->at(6)) $visitor->expects($this->at(6))
->method('acceptSequence') ->method('acceptSequence')
->with($schema->getSequence('moo')); ->with($schema->getSequence('moo'));
...@@ -458,9 +444,6 @@ class SchemaTest extends TestCase ...@@ -458,9 +444,6 @@ class SchemaTest extends TestCase
->method('acceptSequence') ->method('acceptSequence')
->with($schema->getSequence('war')); ->with($schema->getSequence('war'));
$visitor->expects($this->exactly(2))
->method('acceptSequence');
self::assertNull($schema->visit($visitor)); self::assertNull($schema->visit($visitor));
} }
} }
...@@ -28,16 +28,12 @@ class DropSchemaSqlCollectorTest extends TestCase ...@@ -28,16 +28,12 @@ class DropSchemaSqlCollectorTest extends TestCase
$collector = new DropSchemaSqlCollector($platform); $collector = new DropSchemaSqlCollector($platform);
$platform->expects($this->exactly(2)) $platform->expects(self::exactly(2))
->method('getDropForeignKeySQL');
$platform->expects($this->at(0))
->method('getDropForeignKeySQL')
->with($keyConstraintOne, $tableOne);
$platform->expects($this->at(1))
->method('getDropForeignKeySQL') ->method('getDropForeignKeySQL')
->with($keyConstraintTwo, $tableTwo); ->withConsecutive(
[$keyConstraintOne, $tableOne],
[$keyConstraintTwo, $tableTwo]
);
$collector->acceptForeignKey($tableOne, $keyConstraintOne); $collector->acceptForeignKey($tableOne, $keyConstraintOne);
$collector->acceptForeignKey($tableTwo, $keyConstraintTwo); $collector->acceptForeignKey($tableTwo, $keyConstraintTwo);
......
...@@ -31,10 +31,6 @@ class RunSqlCommandTest extends TestCase ...@@ -31,10 +31,6 @@ class RunSqlCommandTest extends TestCase
$this->commandTester = new CommandTester($this->command); $this->commandTester = new CommandTester($this->command);
$this->connectionMock = $this->createMock(Connection::class); $this->connectionMock = $this->createMock(Connection::class);
$this->connectionMock->method('fetchAllAssociative')
->willReturn([[1]]);
$this->connectionMock->method('executeUpdate')
->willReturn(42);
$helperSet = ConsoleRunner::createHelperSet($this->connectionMock); $helperSet = ConsoleRunner::createHelperSet($this->connectionMock);
$this->command->setHelperSet($helperSet); $this->command->setHelperSet($helperSet);
...@@ -97,21 +93,25 @@ class RunSqlCommandTest extends TestCase ...@@ -97,21 +93,25 @@ class RunSqlCommandTest extends TestCase
private function expectConnectionExecuteUpdate(): void private function expectConnectionExecuteUpdate(): void
{ {
$this->connectionMock $this->connectionMock
->expects($this->exactly(1)) ->expects($this->once())
->method('executeUpdate'); ->method('executeUpdate')
->willReturn(42);
$this->connectionMock $this->connectionMock
->expects($this->exactly(0)) ->expects($this->never())
->method('fetchAllAssociative'); ->method('fetchAllAssociative');
} }
private function expectConnectionFetchAllAssociative(): void private function expectConnectionFetchAllAssociative(): void
{ {
$this->connectionMock $this->connectionMock
->expects($this->exactly(0)) ->expects($this->once())
->method('executeUpdate'); ->method('fetchAllAssociative')
->willReturn([[1]]);
$this->connectionMock $this->connectionMock
->expects($this->exactly(1)) ->expects($this->never())
->method('fetchAllAssociative'); ->method('executeUpdate');
} }
public function testStatementsWithFetchResultPrintsResult(): void public function testStatementsWithFetchResultPrintsResult(): void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment