fix: correctly calculate due dates for contract and invoice uploads
This commit is contained in:
@@ -47,6 +47,19 @@ class DispositionTest extends TestCase
|
||||
$this->assertFalse($disposition->isContractDue(self::CONTRACT_DEADLINE_DAYS));
|
||||
}
|
||||
|
||||
/**
|
||||
* A short-notice assignment can end before the normal $deadlineDays window would even
|
||||
* start (assignment ends in 4 days, but the normal deadline is 5 days out). Left uncapped,
|
||||
* dueDateFrom > dueDateTo made isStarted() and isEnded() equal at every instant, so this
|
||||
* never returned true.
|
||||
*/
|
||||
public function testTheContractIsDueImmediatelyWhenTheAssignmentEndsBeforeTheNormalDeadline(): void
|
||||
{
|
||||
$disposition = $this->createDisposition(createdAt: 'today', assignmentEndsIn: '+4 days');
|
||||
|
||||
$this->assertTrue($disposition->isContractDue(self::CONTRACT_DEADLINE_DAYS));
|
||||
}
|
||||
|
||||
public function testAnUploadedContractIsNeverDue(): void
|
||||
{
|
||||
$disposition = $this->createDisposition(createdAt: 'today -60 days', assignmentEndsIn: '+30 days');
|
||||
|
||||
Reference in New Issue
Block a user