30 lines
811 B
PHP
30 lines
811 B
PHP
<?php
|
|
|
|
namespace Tests\Unit\Services\Attendance;
|
|
|
|
use App\Services\Attendance\AttendanceAutoPublishService;
|
|
use DateTimeImmutable;
|
|
use Tests\TestCase;
|
|
|
|
class AttendanceAutoPublishServiceTest extends TestCase
|
|
{
|
|
public function test_second_sunday_after_end_of_day(): void
|
|
{
|
|
$service = new AttendanceAutoPublishService;
|
|
|
|
$result = $service->secondSundayAfterEndOfDay('2025-02-03', 'UTC');
|
|
|
|
$this->assertSame('2025-02-16 23:59:59', $result);
|
|
}
|
|
|
|
public function test_second_sunday_backward_date(): void
|
|
{
|
|
$service = new AttendanceAutoPublishService;
|
|
$now = new DateTimeImmutable('2025-02-16 10:00:00', new \DateTimeZone('UTC'));
|
|
|
|
$result = $service->secondSundayBackwardDate($now, 'UTC');
|
|
|
|
$this->assertSame('2025-02-02', $result);
|
|
}
|
|
}
|