First commit
This commit is contained in:
commit
7cf3558ba7
12933 changed files with 1180047 additions and 0 deletions
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace FluxCms\Components\Tests\Feature\Backend;
|
||||
|
||||
use Livewire\Livewire;
|
||||
use FluxCms\Core\Models\BlogPost;
|
||||
use FluxCms\Components\Livewire\Backend\BlogEditor;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Orchestra\Testbench\TestCase;
|
||||
|
||||
class BlogEditorTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_can_render_blog_editor()
|
||||
{
|
||||
$post = BlogPost::factory()->create();
|
||||
Livewire::test(BlogEditor::class, ['post' => $post])
|
||||
->assertSee($post->title);
|
||||
}
|
||||
|
||||
public function test_can_update_post_and_sync_tags()
|
||||
{
|
||||
$post = BlogPost::factory()->create();
|
||||
$post->attachTag('Old Tag');
|
||||
|
||||
Livewire::test(BlogEditor::class, ['post' => $post])
|
||||
->set('post.title', 'Updated Title')
|
||||
->set('tags', 'new tag 1, new tag 2')
|
||||
->call('save');
|
||||
|
||||
$post->refresh();
|
||||
|
||||
$this->assertEquals('Updated Title', $post->title);
|
||||
$this->assertCount(2, $post->tags);
|
||||
$this->assertEquals(['new tag 1', 'new tag 2'], $post->tags->pluck('name')->toArray());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue