Made test coverage for PageBuilder controllers and models
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
use App\Models\Page;
|
||||
use App\Models\User;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Page>
|
||||
*/
|
||||
class PageFactory extends Factory
|
||||
{
|
||||
protected $model = Page::class;
|
||||
|
||||
public function definition(): array {
|
||||
return [
|
||||
'user_id' => User::factory(),
|
||||
'title' => $this->faker->sentence,
|
||||
'slug' => $this->faker->slug,
|
||||
'content' => ['blocks' => []],
|
||||
'is_published' => $this->faker->boolean,
|
||||
'main' => false,
|
||||
'linked' => false,
|
||||
'linkorder' => $this->faker->numberBetween(1, 10),
|
||||
'visibility' => 'public',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
use App\Models\PageRevision;
|
||||
use App\Models\Page;
|
||||
use App\Models\User;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\PageRevision>
|
||||
*/
|
||||
class PageRevisionFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array {
|
||||
return [
|
||||
'page_id' => Page::factory(),
|
||||
'user_id' => User::factory(),
|
||||
'version' => 1,
|
||||
'content' => ['blocks' => []],
|
||||
'title' => $this->faker->sentence,
|
||||
'slug' => $this->faker->slug,
|
||||
'label' => $this->faker->randomElement(['auto-save', 'manual-save', 'published', 'restored']),
|
||||
'active' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user