Store contact messages in DB and seed real bilingual blog content
Deploy Backend / deploy (push) Successful in 2m40s

Contact form messages were sent via mailto and the site has no mail
service, so visitors saw a placeholder caveat instead of a working
channel. Add a contact_messages table, a public throttled POST endpoint,
and admin list/mark/delete endpoints, then wire them into the panel.

Replace the faker-generated blog demonstration content with real
English and Persian SEO-oriented articles via RealBlogContentSeeder
(deterministic, bilingual posts with per-language categories and tags,
and cross-linked related posts).
This commit is contained in:
Parsa Aghayi committed 2026-10-02 05:41:05 -04:00
1 parent 16057c06b9
commit d4f41b9c2e
8 files changed
+930

No files matched your search

@@ -0,0 +1,60 @@
<?php
namespace Tests\Feature\Blog;
use App\Models\Blog\Category;
use App\Models\Blog\Post;
use App\Models\Blog\Tag;
use App\Models\User;
use Database\Seeders\Blog\RealBlogContentSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
/**
* The production blog content comes from RealBlogContentSeeder, not from the
* random factories. Guard the seeder against regressions by running it against
* a fresh database and asserting the shape of what it published.
*/
class RealBlogContentSeederTest extends TestCase
{
use RefreshDatabase;
public function test_it_seeds_real_content_in_both_languages(): void
{
$user = User::factory()->create(['id' => 1]);
$this->seed(RealBlogContentSeeder::class);
$this->assertSame(10, Category::count());
$this->assertSame(20, Tag::count());
$this->assertSame(12, Post::count());
$post = Post::where('slug', 'core-web-vitals-practical-guide')->firstOrFail();
$this->assertSame($user->id, $post->author_id);
$this->assertNotNull($post->published_at);
$this->assertStringStartsWith('Core Web Vitals', $post->title);
$this->assertStringNotContainsStringIgnoringCase('lorem', $post->body);
$this->assertStringContainsString('##', $post->body);
$this->assertGreaterThan(0, $post->tags()->count());
$faTwin = Post::where('slug', 'core-web-vitals-practical-guide-fa')->firstOrFail();
$this->assertNotNull($faTwin->published_at);
// English posts and their Persian twins are linked as related posts.
$this->assertTrue(
$post->relatedPosts()->where('related_posts.related_post_id', $faTwin->id)->exists()
);
}
public function test_it_is_safe_to_run_twice(): void
{
User::factory()->create(['id' => 1]);
$this->seed(RealBlogContentSeeder::class);
$this->seed(RealBlogContentSeeder::class);
$this->assertSame(10, Category::count());
$this->assertSame(20, Tag::count());
$this->assertSame(12, Post::count());
}
}