Skip to content

Commit

Permalink
[11.x] apply our new Pint rule to the /tests directory (#54325)
Browse files Browse the repository at this point in the history
* apply our new pint rule to the `/tests` directory

I originally omitted these files to keep the PR smaller, but adding back now for consistent styling throughout repo. these are purely indentation whitespace changes.

the `bad-syntax-strategy.php` file is not valid PHP so we need to omit it, or it throws a Pint error.

* indentation fixes
  • Loading branch information
browner12 authored Jan 23, 2025
1 parent d7c6b8d commit 79b44b1
Show file tree
Hide file tree
Showing 30 changed files with 331 additions and 331 deletions.
4 changes: 2 additions & 2 deletions pint.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
},
"whitespace_after_comma_in_array": true
},
"exclude": [
"tests"
"notPath": [
"tests/Foundation/fixtures/bad-syntax-strategy.php"
]
}
16 changes: 8 additions & 8 deletions tests/Broadcasting/AblyBroadcasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testAuthCallValidAuthenticationResponseWithPrivateChannelWhenCal
});

$this->broadcaster->shouldReceive('validAuthenticationResponse')
->once();
->once();

$this->broadcaster->auth(
$this->getMockRequestWithUserForChannel('private-test')
Expand Down Expand Up @@ -82,7 +82,7 @@ public function testAuthCallValidAuthenticationResponseWithPresenceChannelWhenCa
});

$this->broadcaster->shouldReceive('validAuthenticationResponse')
->once();
->once();

$this->broadcaster->auth(
$this->getMockRequestWithUserForChannel('presence-test')
Expand Down Expand Up @@ -125,17 +125,17 @@ protected function getMockRequestWithUserForChannel($channel)
$request->shouldReceive('all')->andReturn(['channel_name' => $channel, 'socket_id' => 'abcd.1234']);

$request->shouldReceive('input')
->with('callback', false)
->andReturn(false);
->with('callback', false)
->andReturn(false);

$user = m::mock('User');
$user->shouldReceive('getAuthIdentifierForBroadcasting')
->andReturn(42);
->andReturn(42);
$user->shouldReceive('getAuthIdentifier')
->andReturn(42);
->andReturn(42);

$request->shouldReceive('user')
->andReturn($user);
->andReturn($user);

return $request;
}
Expand All @@ -150,7 +150,7 @@ protected function getMockRequestWithoutUserForChannel($channel)
$request->shouldReceive('all')->andReturn(['channel_name' => $channel]);

$request->shouldReceive('user')
->andReturn(null);
->andReturn(null);

return $request;
}
Expand Down
48 changes: 24 additions & 24 deletions tests/Broadcasting/BroadcasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ public function testRetrieveUserWithoutGuard()

$request = m::mock(Request::class);
$request->shouldReceive('user')
->once()
->withNoArgs()
->andReturn(new DummyUser);
->once()
->withNoArgs()
->andReturn(new DummyUser);

$this->assertInstanceOf(
DummyUser::class,
Expand All @@ -224,9 +224,9 @@ public function testRetrieveUserWithOneGuardUsingAStringForSpecifyingGuard()

$request = m::mock(Request::class);
$request->shouldReceive('user')
->once()
->with('myguard')
->andReturn(new DummyUser);
->once()
->with('myguard')
->andReturn(new DummyUser);

$this->assertInstanceOf(
DummyUser::class,
Expand All @@ -245,14 +245,14 @@ public function testRetrieveUserWithMultipleGuardsAndRespectGuardsOrder()

$request = m::mock(Request::class);
$request->shouldReceive('user')
->once()
->with('myguard1')
->andReturn(null);
->once()
->with('myguard1')
->andReturn(null);
$request->shouldReceive('user')
->twice()
->with('myguard2')
->andReturn(new DummyUser)
->ordered('user');
->twice()
->with('myguard2')
->andReturn(new DummyUser)
->ordered('user');

$this->assertInstanceOf(
DummyUser::class,
Expand All @@ -273,11 +273,11 @@ public function testRetrieveUserDontUseDefaultGuardWhenOneGuardSpecified()

$request = m::mock(Request::class);
$request->shouldReceive('user')
->once()
->with('myguard')
->andReturn(null);
->once()
->with('myguard')
->andReturn(null);
$request->shouldNotReceive('user')
->withNoArgs();
->withNoArgs();

$this->broadcaster->retrieveUser($request, 'somechannel');
}
Expand All @@ -290,15 +290,15 @@ public function testRetrieveUserDontUseDefaultGuardWhenMultipleGuardsSpecified()

$request = m::mock(Request::class);
$request->shouldReceive('user')
->once()
->with('myguard1')
->andReturn(null);
->once()
->with('myguard1')
->andReturn(null);
$request->shouldReceive('user')
->once()
->with('myguard2')
->andReturn(null);
->once()
->with('myguard2')
->andReturn(null);
$request->shouldNotReceive('user')
->withNoArgs();
->withNoArgs();

$this->broadcaster->retrieveUser($request, 'somechannel');
}
Expand Down
24 changes: 12 additions & 12 deletions tests/Broadcasting/PusherBroadcasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testAuthCallValidAuthenticationResponseWithPrivateChannelWhenCal
});

$this->broadcaster->shouldReceive('validAuthenticationResponse')
->once();
->once();

$this->broadcaster->auth(
$this->getMockRequestWithUserForChannel('private-test')
Expand Down Expand Up @@ -73,7 +73,7 @@ public function testAuthCallValidAuthenticationResponseWithPresenceChannelWhenCa
});

$this->broadcaster->shouldReceive('validAuthenticationResponse')
->once();
->once();

$this->broadcaster->auth(
$this->getMockRequestWithUserForChannel('presence-test')
Expand Down Expand Up @@ -115,8 +115,8 @@ public function testValidAuthenticationResponseCallPusherSocketAuthMethodWithPri
];

$this->pusher->shouldReceive('socket_auth')
->once()
->andReturn(json_encode($data));
->once()
->andReturn(json_encode($data));

$this->assertEquals(
$data,
Expand All @@ -137,8 +137,8 @@ public function testValidAuthenticationResponseCallPusherPresenceAuthMethodWithP
];

$this->pusher->shouldReceive('presence_auth')
->once()
->andReturn(json_encode($data));
->once()
->andReturn(json_encode($data));

$this->assertEquals(
$data,
Expand Down Expand Up @@ -181,17 +181,17 @@ protected function getMockRequestWithUserForChannel($channel)
$request->shouldReceive('all')->andReturn(['channel_name' => $channel, 'socket_id' => 'abcd.1234']);

$request->shouldReceive('input')
->with('callback', false)
->andReturn(false);
->with('callback', false)
->andReturn(false);

$user = m::mock('User');
$user->shouldReceive('getAuthIdentifierForBroadcasting')
->andReturn(42);
->andReturn(42);
$user->shouldReceive('getAuthIdentifier')
->andReturn(42);
->andReturn(42);

$request->shouldReceive('user')
->andReturn($user);
->andReturn($user);

return $request;
}
Expand All @@ -206,7 +206,7 @@ protected function getMockRequestWithoutUserForChannel($channel)
$request->shouldReceive('all')->andReturn(['channel_name' => $channel]);

$request->shouldReceive('user')
->andReturn(null);
->andReturn(null);

return $request;
}
Expand Down
12 changes: 6 additions & 6 deletions tests/Broadcasting/RedisBroadcasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testAuthCallValidAuthenticationResponseWithPrivateChannelWhenCal
});

$this->broadcaster->shouldReceive('validAuthenticationResponse')
->once();
->once();

$this->broadcaster->auth(
$this->getMockRequestWithUserForChannel('private-test')
Expand Down Expand Up @@ -82,7 +82,7 @@ public function testAuthCallValidAuthenticationResponseWithPresenceChannelWhenCa
});

$this->broadcaster->shouldReceive('validAuthenticationResponse')
->once();
->once();

$this->broadcaster->auth(
$this->getMockRequestWithUserForChannel('presence-test')
Expand Down Expand Up @@ -172,12 +172,12 @@ protected function getMockRequestWithUserForChannel($channel)

$user = m::mock('User');
$user->shouldReceive('getAuthIdentifierForBroadcasting')
->andReturn(42);
->andReturn(42);
$user->shouldReceive('getAuthIdentifier')
->andReturn(42);
->andReturn(42);

$request->shouldReceive('user')
->andReturn($user);
->andReturn($user);

return $request;
}
Expand All @@ -192,7 +192,7 @@ protected function getMockRequestWithoutUserForChannel($channel)
$request->shouldReceive('all')->andReturn(['channel_name' => $channel]);

$request->shouldReceive('user')
->andReturn(null);
->andReturn(null);

return $request;
}
Expand Down
56 changes: 28 additions & 28 deletions tests/Bus/BusBatchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public function test_jobs_can_be_added_to_the_batch()
};

$queue->shouldReceive('connection')->once()
->with('test-connection')
->andReturn($connection = m::mock(stdClass::class));
->with('test-connection')
->andReturn($connection = m::mock(stdClass::class));

$connection->shouldReceive('bulk')->once()->with(m::on(function ($args) use ($job, $secondJob) {
return
Expand Down Expand Up @@ -191,8 +191,8 @@ public function test_successful_jobs_can_be_recorded()
};

$queue->shouldReceive('connection')->once()
->with('test-connection')
->andReturn($connection = m::mock(stdClass::class));
->with('test-connection')
->andReturn($connection = m::mock(stdClass::class));

$connection->shouldReceive('bulk')->once();

Expand Down Expand Up @@ -231,8 +231,8 @@ public function test_failed_jobs_can_be_recorded_while_not_allowing_failures()
};

$queue->shouldReceive('connection')->once()
->with('test-connection')
->andReturn($connection = m::mock(stdClass::class));
->with('test-connection')
->andReturn($connection = m::mock(stdClass::class));

$connection->shouldReceive('bulk')->once();

Expand Down Expand Up @@ -273,8 +273,8 @@ public function test_failed_jobs_can_be_recorded_while_allowing_failures()
};

$queue->shouldReceive('connection')->once()
->with('test-connection')
->andReturn($connection = m::mock(stdClass::class));
->with('test-connection')
->andReturn($connection = m::mock(stdClass::class));

$connection->shouldReceive('bulk')->once();

Expand Down Expand Up @@ -472,26 +472,26 @@ protected function createTestBatch($queue, $allowFailures = false)
$repository = new DatabaseBatchRepository(new BatchFactory($queue), DB::connection(), 'job_batches');

$pendingBatch = (new PendingBatch(new Container, collect()))
->progress(function (Batch $batch) {
$_SERVER['__progress.batch'] = $batch;
$_SERVER['__progress.count']++;
})
->then(function (Batch $batch) {
$_SERVER['__then.batch'] = $batch;
$_SERVER['__then.count']++;
})
->catch(function (Batch $batch, $e) {
$_SERVER['__catch.batch'] = $batch;
$_SERVER['__catch.exception'] = $e;
$_SERVER['__catch.count']++;
})
->finally(function (Batch $batch) {
$_SERVER['__finally.batch'] = $batch;
$_SERVER['__finally.count']++;
})
->allowFailures($allowFailures)
->onConnection('test-connection')
->onQueue('test-queue');
->progress(function (Batch $batch) {
$_SERVER['__progress.batch'] = $batch;
$_SERVER['__progress.count']++;
})
->then(function (Batch $batch) {
$_SERVER['__then.batch'] = $batch;
$_SERVER['__then.count']++;
})
->catch(function (Batch $batch, $e) {
$_SERVER['__catch.batch'] = $batch;
$_SERVER['__catch.exception'] = $e;
$_SERVER['__catch.count']++;
})
->finally(function (Batch $batch) {
$_SERVER['__finally.batch'] = $batch;
$_SERVER['__finally.count']++;
})
->allowFailures($allowFailures)
->onConnection('test-connection')
->onQueue('test-queue');

return $repository->store($pendingBatch);
}
Expand Down
18 changes: 9 additions & 9 deletions tests/Console/View/ComponentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ public function testConfirm()
$output = m::mock(OutputStyle::class);

$output->shouldReceive('confirm')
->with('Question?', false)
->once()
->andReturnTrue();
->with('Question?', false)
->once()
->andReturnTrue();

$result = with(new Components\Confirm($output))->render('Question?');
$this->assertTrue($result);

$output->shouldReceive('confirm')
->with('Question?', true)
->once()
->andReturnTrue();
->with('Question?', true)
->once()
->andReturnTrue();

$result = with(new Components\Confirm($output))->render('Question?', true);
$this->assertTrue($result);
Expand All @@ -96,9 +96,9 @@ public function testChoice()
$output = m::mock(OutputStyle::class);

$output->shouldReceive('askQuestion')
->with(m::type(ChoiceQuestion::class))
->once()
->andReturn('a');
->with(m::type(ChoiceQuestion::class))
->once()
->andReturn('a');

$result = with(new Components\Choice($output))->render('Question?', ['a', 'b']);
$this->assertSame('a', $result);
Expand Down
Loading

0 comments on commit 79b44b1

Please sign in to comment.