Skip to content

Commit

Permalink
Fix: tests autoloader
Browse files Browse the repository at this point in the history
  • Loading branch information
awcodes committed Oct 1, 2023
1 parent b947e8a commit 648102c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 24 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
},
"autoload": {
"files": [
"src/helpers.php",
"tests/helpers.php"
"src/helpers.php"
],
"psr-4": {
"FilamentTiptapEditor\\": "src/",
Expand Down
13 changes: 0 additions & 13 deletions tests/helpers.php

This file was deleted.

16 changes: 7 additions & 9 deletions tests/src/FormsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use FilamentTiptapEditor\Tests\Models\Page;
use FilamentTiptapEditor\Tests\Fixtures\Livewire;
use FilamentTiptapEditor\Tests\Resources\PageResource;
use FilamentTiptapEditor\Tests\Fixtures\Livewire as LivewireFixture;
use FilamentTiptapEditor\Tests\Resources\PageResource\Pages\CreatePage;
use FilamentTiptapEditor\Tests\Resources\PageResource\Pages\EditPage;
use FilamentTiptapEditor\TiptapEditor;
use Illuminate\Contracts\View\View;

use function FilamentTiptapEditor\Tests\livewire;
use Livewire\Livewire;

it('has editor field', function() {
livewire(TestComponentWithForm::class)
Livewire::test(TestComponentWithForm::class)
->assertFormFieldExists('html_content')
->assertFormFieldExists('json_content')
->assertFormFieldExists('text_content');
Expand All @@ -22,7 +20,7 @@
it('has proper html', function() {
$page = Page::factory()->make();

livewire(TestComponentWithForm::class)
Livewire::test(TestComponentWithForm::class)
->fillForm($page->toArray())
->assertFormSet([
'html_content' => $page->html_content,
Expand All @@ -34,7 +32,7 @@
it('creates proper data', function() {
$page = Page::factory()->make();

livewire(CreatePage::class)
Livewire::test(CreatePage::class)
->fillForm([
'title' => $page->title,
'html_content' => $page->html_content,
Expand All @@ -54,7 +52,7 @@
$page = Page::factory()->create();
$newData = Page::factory()->make();

livewire(EditPage::class, [
Livewire::test(EditPage::class, [
'record' => $page->getRouteKey(),
])
->fillForm([
Expand All @@ -70,7 +68,7 @@
->json_content->toBe($newData->json_content);
});

class TestComponentWithForm extends Livewire
class TestComponentWithForm extends LivewireFixture
{
public function form(Form $form): Form
{
Expand Down

0 comments on commit 648102c

Please sign in to comment.