Add machines with day-by-day work lists for job tasks
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -70,7 +70,7 @@ beforeEach(function () {
|
||||
$this->updateTask = new UpdateTask($this->jobs, $this->tasks, $checker, $this->planner, $transactions, $this->events);
|
||||
$this->scheduleTask = new ScheduleTask($this->jobs, $this->tasks, $checker, $this->planner, $transactions, $this->events);
|
||||
$this->clearSchedule = new ClearTaskSchedule($this->tasks, $this->planner, $transactions);
|
||||
$this->changeTaskStatus = new ChangeTaskStatus($this->tasks, $transactions);
|
||||
$this->changeTaskStatus = new ChangeTaskStatus($this->tasks, $transactions, $this->events);
|
||||
$this->usage = new FakeTaskUsage;
|
||||
$this->removeTask = new RemoveTask($this->tasks, $this->usage, $transactions, new InMemoryTaskImageRepository, new FakeTaskImageFiles);
|
||||
$this->changeJobStatus = new ChangeJobStatus($this->jobs, $transactions, new FakeClock(new DateTimeImmutable('2026-05-01')));
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use App\Modules\Machines\Domain\Enums\MachineType;
|
||||
use App\Modules\Machines\Domain\Services\QueueOrder;
|
||||
|
||||
it('puts a task after quick sale orders, by priority and then due date', function () {
|
||||
$rows = [
|
||||
['isOrder' => true, 'rank' => 0, 'dueOn' => null],
|
||||
['isOrder' => false, 'rank' => 3, 'dueOn' => '2026-12-01'],
|
||||
['isOrder' => false, 'rank' => 1, 'dueOn' => '2026-11-30'],
|
||||
['isOrder' => false, 'rank' => 1, 'dueOn' => null],
|
||||
];
|
||||
|
||||
expect(QueueOrder::insertionIndex($rows, 4, null))->toBe(1)
|
||||
->and(QueueOrder::insertionIndex($rows, 1, '2026-11-28'))->toBe(2)
|
||||
->and(QueueOrder::insertionIndex($rows, 1, '2026-12-05'))->toBe(3)
|
||||
->and(QueueOrder::insertionIndex($rows, 1, null))->toBe(4)
|
||||
->and(QueueOrder::insertionIndex([], 1, null))->toBe(0);
|
||||
});
|
||||
|
||||
it('suggests the usual counters by machine type', function () {
|
||||
expect(array_column(MachineType::Printer->suggestedCounters(), 'name'))->toBe(['prints', 'printed_area'])
|
||||
->and(array_column(MachineType::Cutter->suggestedCounters(), 'name'))->toBe(['cut_length'])
|
||||
->and(MachineType::Other->suggestedCounters())->toBe([]);
|
||||
});
|
||||
Reference in New Issue
Block a user