Skip to content

Commit

Permalink
Forward compatibility with PHPUnit 9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Jun 14, 2020
1 parent d200523 commit 2a4eff1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static function executeDataProvider(): iterable
public function testConvertNonTerminatedLiteral(string $sql, string $message): void
{
$this->expectException(OCI8Exception::class);
$this->expectExceptionMessageRegExp($message);
$this->expectExceptionMessageMatches($message);
OCI8Statement::convertPositionalToNamedPlaceholders($sql);
}

Expand Down
15 changes: 0 additions & 15 deletions tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,6 @@ public function testVisitsVisitor(): void
->method('acceptTable')
->with($schema->getTable('bla.bloo'));

$visitor->expects($this->exactly(2))
->method('acceptTable');

$visitor->expects($this->at(3))
->method('acceptSequence')
->with($schema->getSequence('moo'));
Expand All @@ -397,9 +394,6 @@ public function testVisitsVisitor(): void
->method('acceptSequence')
->with($schema->getSequence('war'));

$visitor->expects($this->exactly(2))
->method('acceptSequence');

self::assertNull($schema->visit($visitor));
}

Expand Down Expand Up @@ -436,9 +430,6 @@ public function testVisitsNamespaceVisitor(): void
->method('acceptNamespace')
->with('bla');

$visitor->expects($this->exactly(3))
->method('acceptNamespace');

$visitor->expects($this->at(4))
->method('acceptTable')
->with($schema->getTable('baz'));
Expand All @@ -447,9 +438,6 @@ public function testVisitsNamespaceVisitor(): void
->method('acceptTable')
->with($schema->getTable('bla.bloo'));

$visitor->expects($this->exactly(2))
->method('acceptTable');

$visitor->expects($this->at(6))
->method('acceptSequence')
->with($schema->getSequence('moo'));
Expand All @@ -458,9 +446,6 @@ public function testVisitsNamespaceVisitor(): void
->method('acceptSequence')
->with($schema->getSequence('war'));

$visitor->expects($this->exactly(2))
->method('acceptSequence');

self::assertNull($schema->visit($visitor));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ public function testGetQueriesUsesAcceptedForeignKeys(): void

$collector = new DropSchemaSqlCollector($platform);

$platform->expects($this->exactly(2))
->method('getDropForeignKeySQL');

$platform->expects($this->at(0))
->method('getDropForeignKeySQL')
->with($keyConstraintOne, $tableOne);
Expand Down
22 changes: 11 additions & 11 deletions tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ protected function setUp(): void
$this->commandTester = new CommandTester($this->command);

$this->connectionMock = $this->createMock(Connection::class);
$this->connectionMock->method('fetchAllAssociative')
->willReturn([[1]]);
$this->connectionMock->method('executeUpdate')
->willReturn(42);

$helperSet = ConsoleRunner::createHelperSet($this->connectionMock);
$this->command->setHelperSet($helperSet);
Expand Down Expand Up @@ -97,21 +93,25 @@ public function testUpdateStatementsPrintsAffectedLines(): void
private function expectConnectionExecuteUpdate(): void
{
$this->connectionMock
->expects($this->exactly(1))
->method('executeUpdate');
->expects($this->once())
->method('executeUpdate')
->willReturn(42);

$this->connectionMock
->expects($this->exactly(0))
->expects($this->never())
->method('fetchAllAssociative');
}

private function expectConnectionFetchAllAssociative(): void
{
$this->connectionMock
->expects($this->exactly(0))
->method('executeUpdate');
->expects($this->once())
->method('fetchAllAssociative')
->willReturn([[1]]);

$this->connectionMock
->expects($this->exactly(1))
->method('fetchAllAssociative');
->expects($this->never())
->method('executeUpdate');
}

public function testStatementsWithFetchResultPrintsResult(): void
Expand Down

0 comments on commit 2a4eff1

Please sign in to comment.