Skip to content

Commit

Permalink
Merge pull request #6558 from simPod/expect-any
Browse files Browse the repository at this point in the history
test: remove ->expects(self::any())
  • Loading branch information
greg0ire authored Oct 20, 2024
2 parents dcf8c2d + eeb2e5c commit 9fca0ee
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
22 changes: 11 additions & 11 deletions tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private function getExecuteStatementMockConnection(): Connection
{
$driverMock = $this->createMock(Driver::class);

$driverMock->expects(self::any())
$driverMock
->method('connect')
->willReturn(
$this->createMock(DriverConnection::class),
Expand Down Expand Up @@ -184,7 +184,7 @@ public function testTransactionBeginDispatchEvent(): void
{
$eventManager = new EventManager();
$driverMock = $this->createMock(Driver::class);
$driverMock->expects(self::any())
$driverMock
->method('connect')
->willReturn(
$this->createMock(DriverConnection::class),
Expand All @@ -210,7 +210,7 @@ public function testTransactionCommitDispatchEvent(): void
{
$eventManager = new EventManager();
$driverMock = $this->createMock(Driver::class);
$driverMock->expects(self::any())
$driverMock
->method('connect')
->willReturn(
$this->createMock(DriverConnection::class),
Expand All @@ -237,7 +237,7 @@ public function testTransactionCommitEventNotCalledAfterRollBack(): void
{
$eventManager = new EventManager();
$driverMock = $this->createMock(Driver::class);
$driverMock->expects(self::any())
$driverMock
->method('connect')
->willReturn(
$this->createMock(DriverConnection::class),
Expand Down Expand Up @@ -273,7 +273,7 @@ public function testTransactionRollBackDispatchEvent(): void
{
$eventManager = new EventManager();
$driverMock = $this->createMock(Driver::class);
$driverMock->expects(self::any())
$driverMock
->method('connect')
->willReturn(
$this->createMock(DriverConnection::class),
Expand Down Expand Up @@ -307,7 +307,7 @@ public function testEventManagerPassedToPlatform(): void
->with($eventManager);

$driver = $this->createMock(Driver::class);
$driver->expects(self::any())
$driver
->method('getDatabasePlatform')
->willReturn($platform);

Expand Down Expand Up @@ -380,7 +380,7 @@ public function testSetAutoCommit(): void
public function testConnectStartsTransactionInNoAutoCommitMode(): void
{
$driverMock = $this->createMock(Driver::class);
$driverMock->expects(self::any())
$driverMock
->method('connect')
->willReturn(
$this->createMock(DriverConnection::class),
Expand All @@ -399,7 +399,7 @@ public function testConnectStartsTransactionInNoAutoCommitMode(): void
public function testCommitStartsTransactionInNoAutoCommitMode(): void
{
$driverMock = $this->createMock(Driver::class);
$driverMock->expects(self::any())
$driverMock
->method('connect')
->willReturn(
$this->createMock(DriverConnection::class),
Expand All @@ -421,7 +421,7 @@ public function testCommitReturn(bool $expectedResult): void
->method('commit')->willReturn($expectedResult);

$driverMock = $this->createMock(Driver::class);
$driverMock->expects(self::any())
$driverMock
->method('connect')
->willReturn($driverConnection);

Expand All @@ -442,7 +442,7 @@ public static function resultProvider(): array
public function testRollBackStartsTransactionInNoAutoCommitMode(): void
{
$driverMock = $this->createMock(Driver::class);
$driverMock->expects(self::any())
$driverMock
->method('connect')
->willReturn(
$this->createMock(DriverConnection::class),
Expand All @@ -459,7 +459,7 @@ public function testRollBackStartsTransactionInNoAutoCommitMode(): void
public function testSwitchingAutoCommitModeCommitsAllCurrentTransactions(): void
{
$driverMock = $this->createMock(Driver::class);
$driverMock->expects(self::any())
$driverMock
->method('connect')
->willReturn(
$this->createMock(DriverConnection::class),
Expand Down
2 changes: 1 addition & 1 deletion tests/Query/Expression/ExpressionBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected function setUp(): void

$this->expr = new ExpressionBuilder($conn);

$conn->expects(self::any())
$conn
->method('getExpressionBuilder')
->willReturn($this->expr);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Schema/Visitor/DropSchemaSqlCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ private function getStubKeyConstraint(string $name): ForeignKeyConstraint
{
$constraint = $this->createMock(ForeignKeyConstraint::class);

$constraint->expects(self::any())
$constraint
->method('getName')
->willReturn($name);

$constraint->expects(self::any())
$constraint
->method('getForeignColumns')
->willReturn([]);

$constraint->expects(self::any())
$constraint
->method('getColumns')
->willReturn([]);

Expand Down
4 changes: 2 additions & 2 deletions tests/StatementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ protected function setUp(): void
->getMock();

$this->configuration = $this->createMock(Configuration::class);
$this->conn->expects(self::any())
$this->conn
->method('getConfiguration')
->willReturn($this->configuration);

$this->conn->expects(self::any())
$this->conn
->method('getDriver')
->willReturn($driver);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Types/DateImmutableTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function testConvertsDateStringToPHPValue(): void

public function testResetTimeFractionsWhenConvertingToPHPValue(): void
{
$this->platform->expects(self::any())
$this->platform
->method('getDateFormatString')
->willReturn('Y-m-d');

Expand Down
2 changes: 1 addition & 1 deletion tests/Types/DateTimeImmutableTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function testConvertsDateTimeStringToPHPValue(): void

public function testConvertsDateTimeStringWithMicrosecondsToPHPValue(): void
{
$this->platform->expects(self::any())
$this->platform
->method('getDateTimeFormatString')
->willReturn('Y-m-d H:i:s');

Expand Down
2 changes: 1 addition & 1 deletion tests/Types/GuidTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testNativeGuidSupport(): void
{
self::assertTrue($this->type->requiresSQLCommentHint($this->platform));

$this->platform->expects(self::any())
$this->platform
->method('hasNativeGuidType')
->willReturn(true);

Expand Down
2 changes: 1 addition & 1 deletion tests/Types/TimeImmutableTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function testConvertsTimeStringToPHPValue(): void

public function testResetDateFractionsWhenConvertingToPHPValue(): void
{
$this->platform->expects(self::any())
$this->platform
->method('getTimeFormatString')
->willReturn('H:i:s');

Expand Down

0 comments on commit 9fca0ee

Please sign in to comment.