Implemented a block editor for changing the layout of the page
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\PageBlock;
|
||||
use App\Models\PreregistrationPage;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
@@ -19,20 +20,19 @@ class StorePreregistrationPageTest extends TestCase
|
||||
|
||||
$response = $this->actingAs($user)->post(route('admin.pages.store'), [
|
||||
'title' => 'Summer Fest',
|
||||
'heading' => 'Register',
|
||||
'intro_text' => null,
|
||||
'thank_you_message' => null,
|
||||
'expired_message' => null,
|
||||
'ticketshop_url' => null,
|
||||
'start_date' => '2026-06-01T10:00',
|
||||
'end_date' => '2026-06-30T18:00',
|
||||
'phone_enabled' => false,
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
$response->assertRedirect(route('admin.pages.index'));
|
||||
$this->assertDatabaseCount('preregistration_pages', 1);
|
||||
$this->assertSame('Summer Fest', PreregistrationPage::query()->first()?->title);
|
||||
$page = PreregistrationPage::query()->first();
|
||||
$response->assertRedirect(route('admin.pages.edit', $page));
|
||||
$this->assertSame('Summer Fest', $page?->title);
|
||||
$this->assertGreaterThanOrEqual(4, PageBlock::query()->where('preregistration_page_id', $page?->id)->count());
|
||||
}
|
||||
|
||||
public function test_validation_failure_redirects_back_with_input(): void
|
||||
@@ -41,13 +41,11 @@ class StorePreregistrationPageTest extends TestCase
|
||||
|
||||
$response = $this->actingAs($user)->from(route('admin.pages.create'))->post(route('admin.pages.store'), [
|
||||
'title' => '',
|
||||
'heading' => 'H',
|
||||
'start_date' => '2026-06-30T10:00',
|
||||
'end_date' => '2026-06-01T10:00',
|
||||
]);
|
||||
|
||||
$response->assertRedirect(route('admin.pages.create'));
|
||||
$response->assertSessionHasErrors('title');
|
||||
$response->assertSessionHasInput('heading', 'H');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user