withHeaders(['Accept-Language' => 'es']); Queue::fake(); } #[Test] public function the_frontend_is_given_a_version(): void { $this->getJson('/api/public/v1/site') ->assertOk() ->assertJsonPath('data.content_version', ContentVersion::current()); } #[Test] public function publishing_something_moves_it(): void { $before = ContentVersion::current(); Project::factory()->published()->create(); $this->assertGreaterThan($before, ContentVersion::current()); } #[Test] public function a_draft_nobody_can_see_does_not(): void { Project::factory()->draft()->create(); $before = ContentVersion::current(); Project::query()->first()->update(['title' => ['es' => 'Otro borrador']]); // Editing something invisible invalidates nobody's cache, and bumping // on every keystroke of a half-written page would make the number // meaningless. $this->assertSame($before, ContentVersion::current()); } #[Test] public function taking_something_down_moves_it_too(): void { $page = Page::factory()->create([ 'status' => PageStatus::Published, 'published_at' => now()->subDay(), ]); $before = ContentVersion::current(); $page->update(['status' => PageStatus::Draft]); // Going away is exactly as visible to a reader as arriving. $this->assertGreaterThan($before, ContentVersion::current()); } #[Test] public function deleting_published_work_moves_it(): void { $project = Project::factory()->published()->create(); $before = ContentVersion::current(); $project->delete(); $this->assertGreaterThan($before, ContentVersion::current()); } }