Add an editorial calendar to the panel
A month of publications, scheduled dates, content coming off the site, and calls opening and closing, each linked to its form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
61
tests/Feature/Panel/EditorialCalendarTest.php
Normal file
61
tests/Feature/Panel/EditorialCalendarTest.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Panel;
|
||||
|
||||
use App\Enums\CallStatus;
|
||||
use App\Filament\Pages\EditorialCalendar;
|
||||
use App\Models\Call;
|
||||
use App\Models\Page;
|
||||
use Database\Seeders\RolePermissionSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Livewire\Livewire;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Tests\FakesPireon;
|
||||
use Tests\TestCase;
|
||||
|
||||
class EditorialCalendarTest extends TestCase
|
||||
{
|
||||
use FakesPireon, RefreshDatabase;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->seed(RolePermissionSeeder::class);
|
||||
$this->travelTo('2026-10-15 10:00:00');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function the_month_shows_what_goes_live_comes_off_opens_and_closes(): void
|
||||
{
|
||||
$this->actingAs($this->userWithRoles('editor'));
|
||||
|
||||
Page::factory()->published()->create(['title' => ['es' => 'Ya publicada'], 'published_at' => '2026-10-02 09:00']);
|
||||
Page::factory()->published()->create(['title' => ['es' => 'Programada'], 'published_at' => '2026-10-20 09:00']);
|
||||
Page::factory()->draft()->create(['title' => ['es' => 'Borrador con fecha'], 'published_at' => '2026-10-21 09:00']);
|
||||
Call::factory()->create(['title' => ['es' => 'Backend'], 'status' => CallStatus::Open, 'closes_at' => '2026-10-30']);
|
||||
Page::factory()->published()->create(['title' => ['es' => 'Otro mes'], 'published_at' => '2026-12-01 09:00']);
|
||||
|
||||
Livewire::withQueryParams(['month' => '2026-10'])
|
||||
->test(EditorialCalendar::class)
|
||||
->assertSee('Ya publicada')
|
||||
->assertSee('Programada')
|
||||
->assertSee('Backend')
|
||||
->assertDontSee('Borrador con fecha')
|
||||
->assertDontSee('Otro mes')
|
||||
->call('next')
|
||||
->assertSet('month', '2026-11')
|
||||
->call('today')
|
||||
->assertSet('month', '2026-10');
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function the_page_opens(): void
|
||||
{
|
||||
$this->actingAs($this->userWithRoles('writer'));
|
||||
|
||||
$this->get(EditorialCalendar::getUrl())->assertOk();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user