Files
zemailnator/database/factories/BlogFactory.php
idevakk 68ef391c5d test: achieve 100% test coverage with comprehensive test suite fixes
- Fix Laravel bootstrap issues in TestCase setup
  - Add missing database factories (Setting, PremiumEmail, ActivationKey, etc.)
  - Convert Pest tests to PHPUnit style for compatibility
  - Fix model relationships and boolean casts
  - Add missing Filament resource actions and filters
  - Fix form validation and test data mismatches
  - Resolve assertion parameter order issues
  - Add proper configuration for test views
  - Fix searchable columns and table sorting
  - Simplify complex filter assertions for stability
2025-11-13 09:11:14 -08:00

40 lines
1.1 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Category;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Blog>
*/
class BlogFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$title = fake()->sentence();
return [
'post' => $title,
'slug' => Str::slug($title),
'content' => fake()->paragraphs(3, true),
'meta' => [
'description' => fake()->sentence(),
'keywords' => implode(',', fake()->words(5)),
],
'custom_header' => fake()->optional()->sentence(),
'post_image' => fake()->optional()->imageUrl(),
'is_published' => fake()->boolean(80), // 80% chance of being published
'category_id' => Category::factory(),
'created_at' => now(),
'updated_at' => now(),
];
}
}