31 lines
1.2 KiB
PHP
31 lines
1.2 KiB
PHP
|
<?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);
|
||
|
}
|
||
|
}
|