32 lines
1015 B
PHP
32 lines
1015 B
PHP
<?php
|
|
|
|
namespace Tests\Unit\Resources\Settings;
|
|
|
|
use App\Http\Resources\Settings\SchoolCalendarEventResource;
|
|
use Tests\TestCase;
|
|
|
|
class SchoolCalendarEventResourceTest extends TestCase
|
|
{
|
|
public function test_resource_returns_expected_shape(): void
|
|
{
|
|
$resource = new SchoolCalendarEventResource([
|
|
'id' => 1,
|
|
'title' => 'Event',
|
|
'start' => '2026-01-01',
|
|
'description' => 'Desc',
|
|
'backgroundColor' => '#28a745',
|
|
'extendedProps' => ['no_school' => 0],
|
|
]);
|
|
|
|
$payload = $resource->toArray(request());
|
|
|
|
$this->assertArrayHasKey('id', $payload);
|
|
$this->assertArrayHasKey('title', $payload);
|
|
$this->assertArrayHasKey('start', $payload);
|
|
$this->assertArrayHasKey('description', $payload);
|
|
$this->assertArrayHasKey('backgroundColor', $payload);
|
|
$this->assertArrayHasKey('extendedProps', $payload);
|
|
$this->assertSame('#28a745', $payload['backgroundColor']);
|
|
}
|
|
}
|