Skip to content

Commit b8d0bd6

Browse files
authored
Merge pull request #4079 from morozov/phpunit-9.3-compat
Forward compatibility with PHPUnit 9.3
2 parents 36c8a78 + 4375bd3 commit b8d0bd6

File tree

4 files changed

+27
-48
lines changed

4 files changed

+27
-48
lines changed

tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static function executeDataProvider(): iterable
105105
public function testConvertNonTerminatedLiteral(string $sql, string $message): void
106106
{
107107
$this->expectException(OCI8Exception::class);
108-
$this->expectExceptionMessageRegExp($message);
108+
$this->expectExceptionMessageMatches($message);
109109
OCI8Statement::convertPositionalToNamedPlaceholders($sql);
110110
}
111111

tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -378,27 +378,19 @@ public function testVisitsVisitor(): void
378378
->method('acceptSchema')
379379
->with($schema);
380380

381-
$visitor->expects($this->at(1))
381+
$visitor->expects(self::exactly(2))
382382
->method('acceptTable')
383-
->with($schema->getTable('baz'));
383+
->withConsecutive(
384+
[$schema->getTable('baz')],
385+
[$schema->getTable('bla.bloo')]
386+
);
384387

385-
$visitor->expects($this->at(2))
386-
->method('acceptTable')
387-
->with($schema->getTable('bla.bloo'));
388-
389-
$visitor->expects($this->exactly(2))
390-
->method('acceptTable');
391-
392-
$visitor->expects($this->at(3))
388+
$visitor->expects(self::exactly(2))
393389
->method('acceptSequence')
394-
->with($schema->getSequence('moo'));
395-
396-
$visitor->expects($this->at(4))
397-
->method('acceptSequence')
398-
->with($schema->getSequence('war'));
399-
400-
$visitor->expects($this->exactly(2))
401-
->method('acceptSequence');
390+
->withConsecutive(
391+
[$schema->getSequence('moo')],
392+
[$schema->getSequence('war')]
393+
);
402394

403395
self::assertNull($schema->visit($visitor));
404396
}
@@ -436,9 +428,6 @@ public function testVisitsNamespaceVisitor(): void
436428
->method('acceptNamespace')
437429
->with('bla');
438430

439-
$visitor->expects($this->exactly(3))
440-
->method('acceptNamespace');
441-
442431
$visitor->expects($this->at(4))
443432
->method('acceptTable')
444433
->with($schema->getTable('baz'));
@@ -447,9 +436,6 @@ public function testVisitsNamespaceVisitor(): void
447436
->method('acceptTable')
448437
->with($schema->getTable('bla.bloo'));
449438

450-
$visitor->expects($this->exactly(2))
451-
->method('acceptTable');
452-
453439
$visitor->expects($this->at(6))
454440
->method('acceptSequence')
455441
->with($schema->getSequence('moo'));
@@ -458,9 +444,6 @@ public function testVisitsNamespaceVisitor(): void
458444
->method('acceptSequence')
459445
->with($schema->getSequence('war'));
460446

461-
$visitor->expects($this->exactly(2))
462-
->method('acceptSequence');
463-
464447
self::assertNull($schema->visit($visitor));
465448
}
466449
}

tests/Doctrine/Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,12 @@ public function testGetQueriesUsesAcceptedForeignKeys(): void
2828

2929
$collector = new DropSchemaSqlCollector($platform);
3030

31-
$platform->expects($this->exactly(2))
32-
->method('getDropForeignKeySQL');
33-
34-
$platform->expects($this->at(0))
35-
->method('getDropForeignKeySQL')
36-
->with($keyConstraintOne, $tableOne);
37-
38-
$platform->expects($this->at(1))
31+
$platform->expects(self::exactly(2))
3932
->method('getDropForeignKeySQL')
40-
->with($keyConstraintTwo, $tableTwo);
33+
->withConsecutive(
34+
[$keyConstraintOne, $tableOne],
35+
[$keyConstraintTwo, $tableTwo]
36+
);
4137

4238
$collector->acceptForeignKey($tableOne, $keyConstraintOne);
4339
$collector->acceptForeignKey($tableTwo, $keyConstraintTwo);

tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ protected function setUp(): void
3131
$this->commandTester = new CommandTester($this->command);
3232

3333
$this->connectionMock = $this->createMock(Connection::class);
34-
$this->connectionMock->method('fetchAllAssociative')
35-
->willReturn([[1]]);
36-
$this->connectionMock->method('executeUpdate')
37-
->willReturn(42);
3834

3935
$helperSet = ConsoleRunner::createHelperSet($this->connectionMock);
4036
$this->command->setHelperSet($helperSet);
@@ -97,21 +93,25 @@ public function testUpdateStatementsPrintsAffectedLines(): void
9793
private function expectConnectionExecuteUpdate(): void
9894
{
9995
$this->connectionMock
100-
->expects($this->exactly(1))
101-
->method('executeUpdate');
96+
->expects($this->once())
97+
->method('executeUpdate')
98+
->willReturn(42);
99+
102100
$this->connectionMock
103-
->expects($this->exactly(0))
101+
->expects($this->never())
104102
->method('fetchAllAssociative');
105103
}
106104

107105
private function expectConnectionFetchAllAssociative(): void
108106
{
109107
$this->connectionMock
110-
->expects($this->exactly(0))
111-
->method('executeUpdate');
108+
->expects($this->once())
109+
->method('fetchAllAssociative')
110+
->willReturn([[1]]);
111+
112112
$this->connectionMock
113-
->expects($this->exactly(1))
114-
->method('fetchAllAssociative');
113+
->expects($this->never())
114+
->method('executeUpdate');
115115
}
116116

117117
public function testStatementsWithFetchResultPrintsResult(): void

0 commit comments

Comments
 (0)