admin widget zu dokploy geswitched, viele übersetzungen im Frontend vervollständigt und Anlässe-Seiten mit ChatGPT ausgebaut
This commit is contained in:
66
tests/Feature/Marketing/BlogIndexTest.php
Normal file
66
tests/Feature/Marketing/BlogIndexTest.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Marketing;
|
||||
|
||||
use App\Models\BlogCategory;
|
||||
use App\Models\BlogPost;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Testing\Fluent\AssertableJson;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\TestCase;
|
||||
|
||||
class BlogIndexTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_blog_index_returns_html_excerpts(): void
|
||||
{
|
||||
$category = BlogCategory::query()->create([
|
||||
'slug' => 'blog',
|
||||
'name' => [
|
||||
'de' => 'Blog',
|
||||
'en' => 'Blog',
|
||||
],
|
||||
'description' => [
|
||||
'de' => 'Hochzeitsblog',
|
||||
'en' => 'Wedding blog',
|
||||
],
|
||||
'is_visible' => true,
|
||||
]);
|
||||
|
||||
BlogPost::query()->create([
|
||||
'blog_category_id' => $category->id,
|
||||
'slug' => 'markdown-vorschau',
|
||||
'title' => [
|
||||
'de' => 'Markdown Vorschau',
|
||||
'en' => 'Markdown Preview',
|
||||
],
|
||||
'excerpt' => [
|
||||
'de' => '**Fette** Vorschau für Gäste',
|
||||
'en' => '**Bold** preview for guests',
|
||||
],
|
||||
'content' => [
|
||||
'de' => '## Inhalt',
|
||||
'en' => '## Content',
|
||||
],
|
||||
'is_published' => true,
|
||||
'published_at' => Carbon::now()->subDay(),
|
||||
]);
|
||||
|
||||
$response = $this->get('/de/blog');
|
||||
|
||||
$response->assertOk();
|
||||
|
||||
$response->assertInertia(fn (Assert $page) => $page
|
||||
->component('marketing/Blog')
|
||||
->has('posts.data', 1, fn (AssertableJson $post) => $post
|
||||
->where('excerpt', '**Fette** Vorschau für Gäste')
|
||||
->where('excerpt_html', fn ($value) => is_string($value) && str_contains($value, '<strong>Fette</strong>'))
|
||||
->etc()
|
||||
)
|
||||
->where('posts.links.0.label', __('marketing.blog.pagination.previous', [], 'de'))
|
||||
->where('posts.links.2.label', __('marketing.blog.pagination.next', [], 'de'))
|
||||
);
|
||||
}
|
||||
}
|
||||
101
tests/Feature/Marketing/BlogShowTest.php
Normal file
101
tests/Feature/Marketing/BlogShowTest.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Marketing;
|
||||
|
||||
use App\Models\BlogCategory;
|
||||
use App\Models\BlogPost;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\TestCase;
|
||||
|
||||
class BlogShowTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_blog_show_returns_headings_and_adjacent_posts(): void
|
||||
{
|
||||
$category = BlogCategory::query()->create([
|
||||
'slug' => 'blog',
|
||||
'name' => [
|
||||
'de' => 'Blog',
|
||||
'en' => 'Blog',
|
||||
],
|
||||
'description' => [
|
||||
'de' => 'Hochzeitsblog',
|
||||
'en' => 'Wedding blog',
|
||||
],
|
||||
'is_visible' => true,
|
||||
]);
|
||||
|
||||
$older = BlogPost::query()->create([
|
||||
'blog_category_id' => $category->id,
|
||||
'slug' => 'older-story',
|
||||
'title' => [
|
||||
'de' => 'Ältere Story',
|
||||
'en' => 'Older Story',
|
||||
],
|
||||
'excerpt' => [
|
||||
'de' => '**Alt**',
|
||||
'en' => '**Old**',
|
||||
],
|
||||
'content' => [
|
||||
'de' => '## Start\nÄlterer Inhalt',
|
||||
'en' => '## Start\nOlder content',
|
||||
],
|
||||
'is_published' => true,
|
||||
'published_at' => Carbon::parse('2024-01-01'),
|
||||
]);
|
||||
|
||||
$current = BlogPost::query()->create([
|
||||
'blog_category_id' => $category->id,
|
||||
'slug' => 'spotlight-story',
|
||||
'title' => [
|
||||
'de' => 'Spotlight Story',
|
||||
'en' => 'Spotlight Story',
|
||||
],
|
||||
'excerpt' => [
|
||||
'de' => 'Zusammenfassung',
|
||||
'en' => 'Summary',
|
||||
],
|
||||
'content' => [
|
||||
'de' => "## Einleitung\nWillkommen\n### Schritte\nLos geht's",
|
||||
'en' => "## Intro\nWelcome\n### Steps\nLet's go",
|
||||
],
|
||||
'is_published' => true,
|
||||
'published_at' => Carbon::parse('2024-02-01'),
|
||||
]);
|
||||
|
||||
$newer = BlogPost::query()->create([
|
||||
'blog_category_id' => $category->id,
|
||||
'slug' => 'new-story',
|
||||
'title' => [
|
||||
'de' => 'Neue Story',
|
||||
'en' => 'New Story',
|
||||
],
|
||||
'excerpt' => [
|
||||
'de' => 'Neu',
|
||||
'en' => 'New',
|
||||
],
|
||||
'content' => [
|
||||
'de' => '## Vorschau\nNeuer Inhalt',
|
||||
'en' => '## Preview\nNew content',
|
||||
],
|
||||
'is_published' => true,
|
||||
'published_at' => Carbon::parse('2024-03-01'),
|
||||
]);
|
||||
|
||||
$response = $this->get('/de/blog/'.$current->slug);
|
||||
|
||||
$response->assertOk();
|
||||
|
||||
$response->assertInertia(fn (Assert $page) => $page
|
||||
->component('marketing/BlogShow')
|
||||
->where('post.previous_post.slug', $older->slug)
|
||||
->where('post.next_post.slug', $newer->slug)
|
||||
->where('post.headings.0.text', 'Einleitung')
|
||||
->where('post.headings.0.slug', fn ($slug) => is_string($slug) && str_contains($slug, 'einleitung'))
|
||||
->where('post.content_html', fn ($html) => is_string($html) && str_contains($html, 'id="einleitung"'))
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user