feat(services): add public holidays states infra

This commit is contained in:
2024-08-07 12:58:58 +02:00
parent da77779525
commit 78bb9e6f09
5 changed files with 160 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Services\WorkingDays\PublicHolidays;
use App\Services\WorkingDays\PublicHolidays\PublicHolidaysStateDeterminer;
use App\Services\WorkingDays\PublicHolidays\Storage\PublicHolidaysStorageInterface;
use PHPUnit\Framework\TestCase;
class PublicHolidaysStateDeterminerTest extends TestCase
{
public function testStorageCalledWhenDeterminatePublicHoliday(): void
{
$date = new \DateTimeImmutable('2024-01-01');
$storage = $this->createMock(PublicHolidaysStorageInterface::class);
$storage->expects($this->once())->method('isPublicHoliday')->with('CZ', $date);
$determiner = new PublicHolidaysStateDeterminer($storage, 'CZ');
$determiner->isPublicHoliday($date);
}
public function testStorageCalledWhenStorePublicHoliday(): void
{
$date = new \DateTimeImmutable('2024-01-01');
$storage = $this->createMock(PublicHolidaysStorageInterface::class);
$storage->expects($this->once())->method('storePublicHoliday')->with('CZ', $date);
$determiner = new PublicHolidaysStateDeterminer($storage, 'CZ');
$determiner->storePublicHoliday($date);
}
}