Switch bio to be stored in database
This commit is contained in:
parent
f51a740858
commit
bdb69df52d
14 changed files with 219 additions and 38 deletions
67
tests/Feature/Admin/BioTest.php
Normal file
67
tests/Feature/Admin/BioTest.php
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Admin;
|
||||
|
||||
use App\Models\Bio;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class BioTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/** @test */
|
||||
public function adminBiosPageLoads(): void
|
||||
{
|
||||
$user = User::factory()->make();
|
||||
|
||||
$response = $this->actingAs($user)
|
||||
->get('/admin/bio');
|
||||
$response->assertSeeText('Edit bio');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function adminCanCreateBio(): void
|
||||
{
|
||||
$user = User::factory()->make();
|
||||
|
||||
$this->actingAs($user)
|
||||
->post('/admin/bio', [
|
||||
'_method' => 'PUT',
|
||||
'content' => 'Bio content',
|
||||
]);
|
||||
$this->assertDatabaseHas('bios', ['content' => 'Bio content']);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function adminCanLoadExistingBio(): void
|
||||
{
|
||||
$user = User::factory()->make();
|
||||
$bio = Bio::factory()->create([
|
||||
'content' => 'This is <em>my</em> bio. It uses <strong>HTML</strong>.',
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($user)
|
||||
->get('/admin/bio');
|
||||
$response->assertSeeText('This is <em>my</em> bio. It uses <strong>HTML</strong>.');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function adminCanEditBio(): void
|
||||
{
|
||||
$user = User::factory()->make();
|
||||
$bio = Bio::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->post('/admin/bio', [
|
||||
'_method' => 'PUT',
|
||||
'content' => 'This bio has been edited',
|
||||
]);
|
||||
$this->assertDatabaseHas('bios', [
|
||||
'content' => 'This bio has been edited',
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue