Skip to content

Commit

Permalink
Get rid of the usage of InvocationMocker::withConsecutive()
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Jun 13, 2023
1 parent ddba53e commit 9a8b74e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/Schema/ComparatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,16 +633,30 @@ public function testComparesNamespaces(): void
->method('getNamespaces')
->willReturn(['foo', 'bar']);

$matcher = self::exactly(2);

$oldSchema->method('hasNamespace')
->withConsecutive(['bar'], ['baz'])
->willReturnCallback(static function (string $name) use ($matcher): void {
match ($matcher->numberOfInvocations()) {
1 => self::assertEquals('bar', $name),
2 => self::assertEquals('baz', $name),
};
})
->willReturnOnConsecutiveCalls(true, false);

$newSchema->expects(self::once())
->method('getNamespaces')
->willReturn(['bar', 'baz']);

$matcher = self::exactly(2);

$newSchema->method('hasNamespace')
->withConsecutive(['foo'], ['bar'])
->willReturnCallback(static function (string $name) use ($matcher): void {
match ($matcher->numberOfInvocations()) {
1 => self::assertEquals('foo', $name),
2 => self::assertEquals('bar', $name),
};
})
->willReturnOnConsecutiveCalls(false, true);

$diff = $this->comparator->compareSchemas($oldSchema, $newSchema);
Expand Down

0 comments on commit 9a8b74e

Please sign in to comment.