feat: assignments with disabled formalities
addresses #869dnvm8c
This commit is contained in:
@@ -92,17 +92,77 @@ class DispositionTest extends TestCase
|
||||
$this->assertTrue($disposition->isInvoiceDue(self::INVOICE_DEADLINE_DAYS));
|
||||
}
|
||||
|
||||
private function createDisposition(string $createdAt, string $assignmentEndsIn): Disposition
|
||||
/**
|
||||
* A skip-formalities assignment has no contract step at all, so a placement on one starts
|
||||
* where a signed and checked contract would otherwise have put it.
|
||||
*/
|
||||
public function testAPlacementOnASkipFormalitiesAssignmentIsConfirmedRightAway(): void
|
||||
{
|
||||
$disposition = $this->createDisposition(
|
||||
createdAt: 'today',
|
||||
assignmentEndsIn: '+30 days',
|
||||
skipFormalities: true,
|
||||
);
|
||||
|
||||
$this->assertSame(Disposition::STATUS_CONFIRMED, $disposition->getStatus());
|
||||
$this->assertTrue($disposition->isSkipFormalities());
|
||||
}
|
||||
|
||||
public function testAPlacementOnANormalAssignmentStillStartsAsNew(): void
|
||||
{
|
||||
$disposition = $this->createDisposition(createdAt: 'today', assignmentEndsIn: '+30 days');
|
||||
|
||||
$this->assertSame(Disposition::STATUS_NEW, $disposition->getStatus());
|
||||
$this->assertFalse($disposition->isSkipFormalities());
|
||||
}
|
||||
|
||||
/**
|
||||
* Both dates are chosen so the unflagged disposition would be due - what is pinned here is
|
||||
* that the flag wins over the period maths, not that the period happens to be closed.
|
||||
*/
|
||||
public function testNoDocumentIsEverDueOnASkipFormalitiesAssignment(): void
|
||||
{
|
||||
$disposition = $this->createDisposition(
|
||||
createdAt: 'today -60 days',
|
||||
assignmentEndsIn: '-1 day',
|
||||
skipFormalities: true,
|
||||
);
|
||||
|
||||
$this->assertFalse($disposition->isContractDue(self::CONTRACT_DEADLINE_DAYS));
|
||||
$this->assertFalse($disposition->isInvoiceDue(self::INVOICE_DEADLINE_DAYS));
|
||||
}
|
||||
|
||||
public function testARejectedContractIsNotReportedOnASkipFormalitiesAssignment(): void
|
||||
{
|
||||
$disposition = $this->createDisposition(
|
||||
createdAt: 'today -60 days',
|
||||
assignmentEndsIn: '+30 days',
|
||||
skipFormalities: true,
|
||||
);
|
||||
$disposition->addDocument(
|
||||
(new Upload())->setType(Upload::TYPE_CONTRACT)->setStatus(Upload::STATUS_REJECTED)
|
||||
);
|
||||
|
||||
$this->assertFalse($disposition->isContractRejected());
|
||||
}
|
||||
|
||||
private function createDisposition(
|
||||
string $createdAt,
|
||||
string $assignmentEndsIn,
|
||||
bool $skipFormalities = false,
|
||||
): Disposition {
|
||||
$destination = (new Destination())
|
||||
->setProduct('Skireise')
|
||||
->setDateFrom(new \DateTimeImmutable($assignmentEndsIn.' -7 days'))
|
||||
->setDateTo(new \DateTimeImmutable($assignmentEndsIn))
|
||||
;
|
||||
|
||||
$disposition = new Disposition(
|
||||
new Application((new Assignment())->setDestination($destination), new Teamer())
|
||||
);
|
||||
$assignment = (new Assignment())
|
||||
->setDestination($destination)
|
||||
->setSkipFormalities($skipFormalities)
|
||||
;
|
||||
|
||||
$disposition = new Disposition(new Application($assignment, new Teamer()));
|
||||
|
||||
return $disposition->setCreatedAt(new \DateTimeImmutable($createdAt));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user