test preserved schedule start
This commit is contained in:
parent
db6b41ee42
commit
bcbc2e6ba3
3 changed files with 20 additions and 15 deletions
|
|
@ -558,7 +558,7 @@ class ScheduleEndpointTest extends TestCase
|
|||
->assertJsonCount(2, 'assignments');
|
||||
}
|
||||
|
||||
public function test_it_reschedules_only_unfinished_assignments(): void
|
||||
public function test_it_reschedules_only_unfinished_assignments_without_changing_start_date(): void
|
||||
{
|
||||
$user = $this->createUser('reader@example.com');
|
||||
$set = $this->createSet($user, 'Course');
|
||||
|
|
@ -594,23 +594,24 @@ class ScheduleEndpointTest extends TestCase
|
|||
]);
|
||||
|
||||
$response->assertOk()
|
||||
->assertJsonPath('schedule.startDate', '2026-08-20')
|
||||
->assertJsonPath('schedule.startDate', '2026-08-10')
|
||||
->assertJsonPath('schedule.targetDate', '2026-08-21')
|
||||
->assertJsonCount(12, 'schedule.days')
|
||||
->assertJsonPath('schedule.days.0.date', '2026-08-10')
|
||||
->assertJsonPath(
|
||||
'schedule.days.0.assignments.0.completedAt',
|
||||
'2026-08-15T12:30:45+00:00',
|
||||
)
|
||||
->assertJsonPath('schedule.days.1.date', '2026-08-20')
|
||||
->assertJsonCount(1, 'schedule.days.1.assignments')
|
||||
->assertJsonPath('schedule.days.1.assignments.0.id', 2)
|
||||
->assertJsonPath('schedule.days.2.date', '2026-08-21')
|
||||
->assertJsonCount(2, 'schedule.days.2.assignments')
|
||||
->assertJsonPath('schedule.days.2.assignments.0.id', 3)
|
||||
->assertJsonPath('schedule.days.2.assignments.1.id', 4);
|
||||
->assertJsonPath('schedule.days.10.date', '2026-08-20')
|
||||
->assertJsonCount(1, 'schedule.days.10.assignments')
|
||||
->assertJsonPath('schedule.days.10.assignments.0.id', 2)
|
||||
->assertJsonPath('schedule.days.11.date', '2026-08-21')
|
||||
->assertJsonCount(2, 'schedule.days.11.assignments')
|
||||
->assertJsonPath('schedule.days.11.assignments.0.id', 3)
|
||||
->assertJsonPath('schedule.days.11.assignments.1.id', 4);
|
||||
$this->assertDatabaseHas('schedules', [
|
||||
'id' => 1,
|
||||
'start_date' => '2026-08-20',
|
||||
'start_date' => '2026-08-10',
|
||||
'target_date' => '2026-08-21',
|
||||
]);
|
||||
$this->assertDatabaseHas('schedule_assignments', [
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use Tests\Fakes\FakeScheduleRepository;
|
|||
|
||||
class RescheduleScheduleTest extends TestCase
|
||||
{
|
||||
public function test_it_redistributes_only_unfinished_assignments(): void
|
||||
public function test_it_redistributes_only_unfinished_assignments_without_changing_start_date(): void
|
||||
{
|
||||
$user = $this->user(1, 'reader@example.com');
|
||||
$repository = new FakeScheduleRepository;
|
||||
|
|
@ -42,7 +42,7 @@ class RescheduleScheduleTest extends TestCase
|
|||
),
|
||||
);
|
||||
|
||||
$this->assertSame('2026-08-20', $rescheduled->getStartDate()
|
||||
$this->assertSame('2026-08-10', $rescheduled->getStartDate()
|
||||
->format('Y-m-d'));
|
||||
$this->assertSame('2026-08-21', $rescheduled->getTargetDate()
|
||||
->format('Y-m-d'));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue