Skip to content

Commit 79b44b1

Browse files
authored
[11.x] apply our new Pint rule to the /tests directory (#54325)
* 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
1 parent d7c6b8d commit 79b44b1

30 files changed

+331
-331
lines changed

pint.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
},
125125
"whitespace_after_comma_in_array": true
126126
},
127-
"exclude": [
128-
"tests"
127+
"notPath": [
128+
"tests/Foundation/fixtures/bad-syntax-strategy.php"
129129
]
130130
}

tests/Broadcasting/AblyBroadcasterTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testAuthCallValidAuthenticationResponseWithPrivateChannelWhenCal
4141
});
4242

4343
$this->broadcaster->shouldReceive('validAuthenticationResponse')
44-
->once();
44+
->once();
4545

4646
$this->broadcaster->auth(
4747
$this->getMockRequestWithUserForChannel('private-test')
@@ -82,7 +82,7 @@ public function testAuthCallValidAuthenticationResponseWithPresenceChannelWhenCa
8282
});
8383

8484
$this->broadcaster->shouldReceive('validAuthenticationResponse')
85-
->once();
85+
->once();
8686

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

127127
$request->shouldReceive('input')
128-
->with('callback', false)
129-
->andReturn(false);
128+
->with('callback', false)
129+
->andReturn(false);
130130

131131
$user = m::mock('User');
132132
$user->shouldReceive('getAuthIdentifierForBroadcasting')
133-
->andReturn(42);
133+
->andReturn(42);
134134
$user->shouldReceive('getAuthIdentifier')
135-
->andReturn(42);
135+
->andReturn(42);
136136

137137
$request->shouldReceive('user')
138-
->andReturn($user);
138+
->andReturn($user);
139139

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

152152
$request->shouldReceive('user')
153-
->andReturn(null);
153+
->andReturn(null);
154154

155155
return $request;
156156
}

tests/Broadcasting/BroadcasterTest.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ public function testRetrieveUserWithoutGuard()
206206

207207
$request = m::mock(Request::class);
208208
$request->shouldReceive('user')
209-
->once()
210-
->withNoArgs()
211-
->andReturn(new DummyUser);
209+
->once()
210+
->withNoArgs()
211+
->andReturn(new DummyUser);
212212

213213
$this->assertInstanceOf(
214214
DummyUser::class,
@@ -224,9 +224,9 @@ public function testRetrieveUserWithOneGuardUsingAStringForSpecifyingGuard()
224224

225225
$request = m::mock(Request::class);
226226
$request->shouldReceive('user')
227-
->once()
228-
->with('myguard')
229-
->andReturn(new DummyUser);
227+
->once()
228+
->with('myguard')
229+
->andReturn(new DummyUser);
230230

231231
$this->assertInstanceOf(
232232
DummyUser::class,
@@ -245,14 +245,14 @@ public function testRetrieveUserWithMultipleGuardsAndRespectGuardsOrder()
245245

246246
$request = m::mock(Request::class);
247247
$request->shouldReceive('user')
248-
->once()
249-
->with('myguard1')
250-
->andReturn(null);
248+
->once()
249+
->with('myguard1')
250+
->andReturn(null);
251251
$request->shouldReceive('user')
252-
->twice()
253-
->with('myguard2')
254-
->andReturn(new DummyUser)
255-
->ordered('user');
252+
->twice()
253+
->with('myguard2')
254+
->andReturn(new DummyUser)
255+
->ordered('user');
256256

257257
$this->assertInstanceOf(
258258
DummyUser::class,
@@ -273,11 +273,11 @@ public function testRetrieveUserDontUseDefaultGuardWhenOneGuardSpecified()
273273

274274
$request = m::mock(Request::class);
275275
$request->shouldReceive('user')
276-
->once()
277-
->with('myguard')
278-
->andReturn(null);
276+
->once()
277+
->with('myguard')
278+
->andReturn(null);
279279
$request->shouldNotReceive('user')
280-
->withNoArgs();
280+
->withNoArgs();
281281

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

291291
$request = m::mock(Request::class);
292292
$request->shouldReceive('user')
293-
->once()
294-
->with('myguard1')
295-
->andReturn(null);
293+
->once()
294+
->with('myguard1')
295+
->andReturn(null);
296296
$request->shouldReceive('user')
297-
->once()
298-
->with('myguard2')
299-
->andReturn(null);
297+
->once()
298+
->with('myguard2')
299+
->andReturn(null);
300300
$request->shouldNotReceive('user')
301-
->withNoArgs();
301+
->withNoArgs();
302302

303303
$this->broadcaster->retrieveUser($request, 'somechannel');
304304
}

tests/Broadcasting/PusherBroadcasterTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function testAuthCallValidAuthenticationResponseWithPrivateChannelWhenCal
3232
});
3333

3434
$this->broadcaster->shouldReceive('validAuthenticationResponse')
35-
->once();
35+
->once();
3636

3737
$this->broadcaster->auth(
3838
$this->getMockRequestWithUserForChannel('private-test')
@@ -73,7 +73,7 @@ public function testAuthCallValidAuthenticationResponseWithPresenceChannelWhenCa
7373
});
7474

7575
$this->broadcaster->shouldReceive('validAuthenticationResponse')
76-
->once();
76+
->once();
7777

7878
$this->broadcaster->auth(
7979
$this->getMockRequestWithUserForChannel('presence-test')
@@ -115,8 +115,8 @@ public function testValidAuthenticationResponseCallPusherSocketAuthMethodWithPri
115115
];
116116

117117
$this->pusher->shouldReceive('socket_auth')
118-
->once()
119-
->andReturn(json_encode($data));
118+
->once()
119+
->andReturn(json_encode($data));
120120

121121
$this->assertEquals(
122122
$data,
@@ -137,8 +137,8 @@ public function testValidAuthenticationResponseCallPusherPresenceAuthMethodWithP
137137
];
138138

139139
$this->pusher->shouldReceive('presence_auth')
140-
->once()
141-
->andReturn(json_encode($data));
140+
->once()
141+
->andReturn(json_encode($data));
142142

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

183183
$request->shouldReceive('input')
184-
->with('callback', false)
185-
->andReturn(false);
184+
->with('callback', false)
185+
->andReturn(false);
186186

187187
$user = m::mock('User');
188188
$user->shouldReceive('getAuthIdentifierForBroadcasting')
189-
->andReturn(42);
189+
->andReturn(42);
190190
$user->shouldReceive('getAuthIdentifier')
191-
->andReturn(42);
191+
->andReturn(42);
192192

193193
$request->shouldReceive('user')
194-
->andReturn($user);
194+
->andReturn($user);
195195

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

208208
$request->shouldReceive('user')
209-
->andReturn(null);
209+
->andReturn(null);
210210

211211
return $request;
212212
}

tests/Broadcasting/RedisBroadcasterTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testAuthCallValidAuthenticationResponseWithPrivateChannelWhenCal
4141
});
4242

4343
$this->broadcaster->shouldReceive('validAuthenticationResponse')
44-
->once();
44+
->once();
4545

4646
$this->broadcaster->auth(
4747
$this->getMockRequestWithUserForChannel('private-test')
@@ -82,7 +82,7 @@ public function testAuthCallValidAuthenticationResponseWithPresenceChannelWhenCa
8282
});
8383

8484
$this->broadcaster->shouldReceive('validAuthenticationResponse')
85-
->once();
85+
->once();
8686

8787
$this->broadcaster->auth(
8888
$this->getMockRequestWithUserForChannel('presence-test')
@@ -172,12 +172,12 @@ protected function getMockRequestWithUserForChannel($channel)
172172

173173
$user = m::mock('User');
174174
$user->shouldReceive('getAuthIdentifierForBroadcasting')
175-
->andReturn(42);
175+
->andReturn(42);
176176
$user->shouldReceive('getAuthIdentifier')
177-
->andReturn(42);
177+
->andReturn(42);
178178

179179
$request->shouldReceive('user')
180-
->andReturn($user);
180+
->andReturn($user);
181181

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

194194
$request->shouldReceive('user')
195-
->andReturn(null);
195+
->andReturn(null);
196196

197197
return $request;
198198
}

tests/Bus/BusBatchTest.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ public function test_jobs_can_be_added_to_the_batch()
101101
};
102102

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

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

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

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

@@ -231,8 +231,8 @@ public function test_failed_jobs_can_be_recorded_while_not_allowing_failures()
231231
};
232232

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

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

@@ -273,8 +273,8 @@ public function test_failed_jobs_can_be_recorded_while_allowing_failures()
273273
};
274274

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

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

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

474474
$pendingBatch = (new PendingBatch(new Container, collect()))
475-
->progress(function (Batch $batch) {
476-
$_SERVER['__progress.batch'] = $batch;
477-
$_SERVER['__progress.count']++;
478-
})
479-
->then(function (Batch $batch) {
480-
$_SERVER['__then.batch'] = $batch;
481-
$_SERVER['__then.count']++;
482-
})
483-
->catch(function (Batch $batch, $e) {
484-
$_SERVER['__catch.batch'] = $batch;
485-
$_SERVER['__catch.exception'] = $e;
486-
$_SERVER['__catch.count']++;
487-
})
488-
->finally(function (Batch $batch) {
489-
$_SERVER['__finally.batch'] = $batch;
490-
$_SERVER['__finally.count']++;
491-
})
492-
->allowFailures($allowFailures)
493-
->onConnection('test-connection')
494-
->onQueue('test-queue');
475+
->progress(function (Batch $batch) {
476+
$_SERVER['__progress.batch'] = $batch;
477+
$_SERVER['__progress.count']++;
478+
})
479+
->then(function (Batch $batch) {
480+
$_SERVER['__then.batch'] = $batch;
481+
$_SERVER['__then.count']++;
482+
})
483+
->catch(function (Batch $batch, $e) {
484+
$_SERVER['__catch.batch'] = $batch;
485+
$_SERVER['__catch.exception'] = $e;
486+
$_SERVER['__catch.count']++;
487+
})
488+
->finally(function (Batch $batch) {
489+
$_SERVER['__finally.batch'] = $batch;
490+
$_SERVER['__finally.count']++;
491+
})
492+
->allowFailures($allowFailures)
493+
->onConnection('test-connection')
494+
->onQueue('test-queue');
495495

496496
return $repository->store($pendingBatch);
497497
}

tests/Console/View/ComponentsTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ public function testConfirm()
7575
$output = m::mock(OutputStyle::class);
7676

7777
$output->shouldReceive('confirm')
78-
->with('Question?', false)
79-
->once()
80-
->andReturnTrue();
78+
->with('Question?', false)
79+
->once()
80+
->andReturnTrue();
8181

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

8585
$output->shouldReceive('confirm')
86-
->with('Question?', true)
87-
->once()
88-
->andReturnTrue();
86+
->with('Question?', true)
87+
->once()
88+
->andReturnTrue();
8989

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

9898
$output->shouldReceive('askQuestion')
99-
->with(m::type(ChoiceQuestion::class))
100-
->once()
101-
->andReturn('a');
99+
->with(m::type(ChoiceQuestion::class))
100+
->once()
101+
->andReturn('a');
102102

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

0 commit comments

Comments
 (0)