Fix random test

This commit is contained in:
Igor Scheller 2023-12-27 17:46:13 +01:00
parent 0f794be25e
commit f7b0ee9ebb
1 changed files with 2 additions and 2 deletions

View File

@ -90,10 +90,10 @@ class ShiftsControllerTest extends ControllerTest
$this->redirect->expects($this->exactly(10)) $this->redirect->expects($this->exactly(10))
->method('to') ->method('to')
->willReturnCallback(function (string $url) use ($possibleShift1, $possibleShift2) { ->willReturnCallback(function (string $url) use ($possibleShift1, $possibleShift2) {
parse_str(parse_url($url)['query'], $parameters); parse_str(parse_url($url)['query'] ?? '', $parameters);
$this->assertTrue(Str::startsWith($url, 'http://localhost/shifts')); $this->assertTrue(Str::startsWith($url, 'http://localhost/shifts'));
$this->assertArrayHasKey('shift_id', $parameters); $this->assertArrayHasKey('shift_id', $parameters);
$shiftId = $parameters['shift_id']; $shiftId = $parameters['shift_id'] ?? 0;
$this->assertTrue(in_array($shiftId, [$possibleShift1->id, $possibleShift2->id])); $this->assertTrue(in_array($shiftId, [$possibleShift1->id, $possibleShift2->id]));
return $this->response; return $this->response;
}); });