Kanban / timesheet update
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Modules\TimeTracking\Application\UseCases\CancelWeekApproval;
|
||||
use App\Modules\TimeTracking\Application\UseCases\RemoveTimeEntry;
|
||||
use App\Modules\TimeTracking\Application\UseCases\SetDayHours;
|
||||
use App\Modules\TimeTracking\Application\UseCases\UpdateTimeEntry;
|
||||
use App\Modules\TimeTracking\Domain\Exceptions\BillingNotesMissing;
|
||||
use App\Modules\TimeTracking\Domain\Exceptions\TimeApproved;
|
||||
use Tests\Fakes\FakeClock;
|
||||
use Tests\Fakes\FakeTaskQueries;
|
||||
@@ -34,6 +35,12 @@ beforeEach(function () {
|
||||
$this->setDayHours->execute(10, 1, '2026-11-29', '2');
|
||||
$this->setDayHours->execute(10, 1, '2026-11-30', '3');
|
||||
$this->setDayHours->execute(11, 1, '2026-11-23', '5');
|
||||
|
||||
// Every entry has its billing note, which the approval requires.
|
||||
foreach ($this->entries->entries as $entry) {
|
||||
$entry->describe(null, 'Suunnittelu', null);
|
||||
$this->entries->save($entry);
|
||||
}
|
||||
});
|
||||
|
||||
it('approves the user\'s unapproved hours of the week only', function () {
|
||||
@@ -76,3 +83,10 @@ it('cancels the approval of a week so the hours can be changed again', function
|
||||
|
||||
expect($this->entries->findForDay(10, 1, new DateTimeImmutable('2026-11-23'))?->hours()->format())->toBe('5');
|
||||
});
|
||||
|
||||
it('refuses to approve a week while an entry has no billing note', function () {
|
||||
$this->setDayHours->execute(10, 2, '2026-11-24', '1');
|
||||
|
||||
expect(fn () => $this->approveWeek->execute(10, '2026-11-23', approverId: 99))->toThrow(BillingNotesMissing::class);
|
||||
expect(array_filter($this->entries->entries, fn ($entry) => $entry->isApproved()))->toBeEmpty();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user