(.*?)~s', $html, $block);
expect($block[1])->not->toContain('
![]()
published()->create(['title' => ['en' => 'Alimony guide', 'ar' => 'دليل النفقة']]);
Post::factory()->published()->create(['title' => ['en' => 'Contracts', 'ar' => 'العقود']]);
app()->setLocale('en');
Volt::test('pages.posts.index')->set('search', 'Alimony')
->assertSee('Alimony guide')->assertDontSee('Contracts')
->assertSee(__('posts.search_results', ['count' => 1, 'query' => 'Alimony']))
->assertSee(__('posts.clear_search'))
->set('search', 'zzzz')->assertSee(__('posts.no_results', ['query' => 'zzzz']));
});
test('empty index shows the no posts message', function () {
Volt::test('pages.posts.index')->assertSee(__('posts.no_posts'));
});
test('pagination is wrapped and styled when there are more than ten posts', function () {
Post::factory()->published()->count(12)->create();
expect($this->get('/posts')->assertOk()->getContent())->toContain('pagination-wrap');
});
test('a published post shows meta, h1, body and a back link; unpublished is 404', function () {
$post = Post::factory()->published()->create();
$html = $this->get(route('posts.show', $post))->assertOk()->getContent();
expect($html)->toContain('class="meta"')->toContain('site-prose')->toContain(route('posts.index'))->toContain(__('posts.back_to_posts'));
expect(substr_count($html, '
toBe(1);
$draft = Post::factory()->draft()->create();
$this->get(route('posts.show', $draft))->assertNotFound();
});
test('legal pages show title, sanitised content and the last updated line', function () {
Page::factory()->terms()->create(['content_en' => '
Hello
', 'content_ar' => '
مرحبا
']);
$html = $this->withSession(['locale' => 'en'])->get('/page/terms')->assertOk()->getContent();
expect($html)->toContain('Terms of Service')->toContain('Hello')->not->toContain('