getDefaultProperties(); expect($defaults['model'] ?? null)->toBe(TextWidget::class); expect($defaults['recordTitleAttribute'] ?? null)->toBe('title'); }); it('defines the expected pages', function () { $pages = EntryResource::getPages(); expect(array_keys($pages))->toEqual(['index', 'create', 'view', 'edit']); }); it('accepts new record when entered via the form schema', function () { $data = [ 'title' => 'Test Entry', 'description' => 'This is a test entry.', 'content' => '
This is the content of the test entry.
', ]; $entry = new TextWidget; $entry->fill($data); expect($entry->title)->toBe('Test Entry'); }); it('deletes a record correctly', function () { $entry = TextWidget::create([ 'title' => 'Test Entry to Delete', 'description' => 'This is a test entry.', 'content' => 'This is the content of the test entry.
', ]); $entryId = $entry->id; $entry->delete(); $deletedEntry = TextWidget::find($entryId); expect($deletedEntry)->toBeNull(); });