Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fritz-c/filament-builder-test-bug
https://github.com/fritz-c/filament-builder-test-bug
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/fritz-c/filament-builder-test-bug
- Owner: fritz-c
- Created: 2023-12-07T19:36:38.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2023-12-07T19:39:52.000Z (11 months ago)
- Last Synced: 2023-12-07T20:32:24.765Z (11 months ago)
- Language: PHP
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Filament builder test bug
## Setup and reproduction
```sh
cp .env.example .env
touch database/database.sqlite
composer install
php artisan migrate:fresh --seed
php artisan test
```## Issue description
When testing resources that use the Builder component, the `fillForm` method can throw an exception (`Undefined array key "type"`) if the `data` comes before the `type` key in the json array.
Expected:
`fillForm` should work regardless of the order of the keys in the builder items.```php
// This one works
it('works with type first', function () {
livewire(CreateArticle::class)
->fillForm(['items' => [[
'type' => 'note',
'data' => ['body' => 'hi'],
]]])
->call('create')
->assertHasNoFormErrors();
});// This one fails
it('works with type last', function () {
livewire(CreateArticle::class)
->fillForm(['items' => [[
'data' => ['body' => 'hi'],
'type' => 'note',
]]])
->call('create')
->assertHasNoFormErrors();
});
```