Made test coverage for PageBuilder controllers and models

This commit is contained in:
2025-05-06 00:13:06 +02:00
parent dd5585c3d1
commit 4ae0edad49
15 changed files with 394 additions and 11 deletions
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace Tests\Unit;
use Tests\TestCase;
use App\Models\PageRevision;
use Illuminate\Foundation\Testing\RefreshDatabase;
class PageRevisionTest extends TestCase
{
use RefreshDatabase;
public function test_page_revision_creation() {
$revision = PageRevision::factory()->create();
$this->assertDatabaseHas('page_revisions', ['id' => $revision->id]);
}
public function test_revision_has_uuid_and_version() {
$revision = PageRevision::factory()->create();
$this->assertNotNull($revision->uuid);
$this->assertGreaterThan(0, $revision->version);
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace Tests\Unit;
use Tests\TestCase;
use App\Models\Page;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
class PageTest extends TestCase
{
use RefreshDatabase;
public function test_page_creation()
{
$page = Page::factory()->create();
$this->assertDatabaseHas('pages', ['id' => $page->id]);
}
public function test_page_has_author_relationship()
{
$page = Page::factory()->create();
$this->assertInstanceOf(User::class, $page->author);
}
}