Fix random shifts test
This commit is contained in:
parent
ff1edaad10
commit
b10264d6ef
|
@ -50,8 +50,9 @@ class ShiftsController extends BaseController
|
||||||
->collect()
|
->collect()
|
||||||
// Prefer soon starting shifts
|
// Prefer soon starting shifts
|
||||||
->groupBy('start')
|
->groupBy('start')
|
||||||
|
// Get first starting shifts
|
||||||
->first()
|
->first()
|
||||||
// Select one at random
|
// Select one of them at random
|
||||||
->random();
|
->random();
|
||||||
|
|
||||||
return $this->redirect->to($this->url->to('/shifts', ['action' => 'view', 'shift_id' => $randomShift->id]));
|
return $this->redirect->to($this->url->to('/shifts', ['action' => 'view', 'shift_id' => $randomShift->id]));
|
||||||
|
|
|
@ -57,7 +57,7 @@ class ShiftsControllerTest extends ControllerTest
|
||||||
$otherUser = User::factory()->create();
|
$otherUser = User::factory()->create();
|
||||||
[$userAngelType, $otherAngelType] = AngelType::factory(2)->create();
|
[$userAngelType, $otherAngelType] = AngelType::factory(2)->create();
|
||||||
[$possibleShift1, $possibleShift2, $otherAngelTypeShift, $alreadySubscribedShift] = Shift::factory(4)
|
[$possibleShift1, $possibleShift2, $otherAngelTypeShift, $alreadySubscribedShift] = Shift::factory(4)
|
||||||
->create(['start' => $start]);
|
->create(['start' => $start, 'end' => $start->addHours(2)]);
|
||||||
$this->user->userAngelTypes()->attach($userAngelType, ['confirm_user_id' => $this->user->id]);
|
$this->user->userAngelTypes()->attach($userAngelType, ['confirm_user_id' => $this->user->id]);
|
||||||
NeededAngelType::factory()->create([
|
NeededAngelType::factory()->create([
|
||||||
'shift_id' => $possibleShift1->id,
|
'shift_id' => $possibleShift1->id,
|
||||||
|
|
Loading…
Reference in New Issue