55 lines
1.6 KiB
PHP
55 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Tests\Service\Season;
|
|
|
|
use App\Config\SeasonTask;
|
|
use App\Entity\SeasonAssignment;
|
|
use App\Entity\SeasonAssignmentTask;
|
|
use App\Entity\Upload;
|
|
use App\Service\Season\SeasonChecklistBuilder;
|
|
use App\Service\Season\SeasonTaskDeadlineResolver;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* The row hands out what it was given, not what the library holds right now - that is what keeps
|
|
* a finished assignment from being rewritten when next season's file is deposited.
|
|
*/
|
|
class SeasonChecklistBuilderTest extends TestCase
|
|
{
|
|
public function testTheRowHandsOutItsOwnDocument(): void
|
|
{
|
|
$document = new Upload();
|
|
|
|
$seasonAssignment = new SeasonAssignment();
|
|
$seasonAssignment->addTask(
|
|
(new SeasonAssignmentTask())
|
|
->setTaskKey(SeasonTask::MASTER_DATA->value)
|
|
->setDocument($document)
|
|
);
|
|
|
|
$builder = new SeasonChecklistBuilder($this->createStub(SeasonTaskDeadlineResolver::class));
|
|
|
|
$rows = $builder->build($seasonAssignment);
|
|
|
|
$this->assertCount(1, $rows);
|
|
$this->assertSame($document, $rows[0]['document']);
|
|
}
|
|
|
|
public function testARowWithoutADocumentIsBuiltAllTheSame(): void
|
|
{
|
|
$seasonAssignment = new SeasonAssignment();
|
|
$seasonAssignment->addTask(
|
|
(new SeasonAssignmentTask())->setTaskKey(SeasonTask::MASTER_DATA->value)
|
|
);
|
|
|
|
$builder = new SeasonChecklistBuilder($this->createStub(SeasonTaskDeadlineResolver::class));
|
|
|
|
$rows = $builder->build($seasonAssignment);
|
|
|
|
$this->assertCount(1, $rows);
|
|
$this->assertNull($rows[0]['document']);
|
|
}
|
|
}
|