/** * AbstractDepartment constructor. */ public function __construct() { $this->data['current_shift'] = Shift::current(); $this->data['current_shift_produced_meters'] = $this->getCurrentShiftProducedMeters(); $this->data['current_shift_set_up_minutes'] = $this->getCurrentShiftSetUpMinutes(); $this->data['current_shift_up_time_minutes'] = $this->getCurrentShiftUpTimeMinutes(); $this->data['current_shift_target_meters'] = $this->getCurrentShiftTargetMeters(); }
/** * @test */ public function it_has_a_previous_shift() { $this->createShiftStartingAt(6, 720); $this->createShiftStartingAt(18, 720); $shift = App\Models\Shift::current(); $shift->setRelativeTime(Carbon::now()->setTime(8, 0)); $previousShift = $shift->previous_shift; $this->assertInstanceOf(App\Models\Shift::class, $previousShift); $this->assertEquals(Carbon::now()->subDay()->setTime(18, 0), $previousShift->starting_time); $this->assertEquals(Carbon::now()->setTime(6, 0), $previousShift->ending_time); }