diff --git a/docs-assets/app/app/Exceptions/Handler.php b/docs-assets/app/app/Exceptions/Handler.php index 56c7afdb96..0a029220bc 100644 --- a/docs-assets/app/app/Exceptions/Handler.php +++ b/docs-assets/app/app/Exceptions/Handler.php @@ -42,7 +42,7 @@ class Handler extends ExceptionHandler */ public function register(): void { - $this->reportable(function (Throwable $e) { + $this->reportable(function (Throwable $e): void { // }); } diff --git a/docs-assets/app/app/Livewire/ActionsDemo.php b/docs-assets/app/app/Livewire/ActionsDemo.php index 8010e9cb12..2de8dc8daf 100644 --- a/docs-assets/app/app/Livewire/ActionsDemo.php +++ b/docs-assets/app/app/Livewire/ActionsDemo.php @@ -137,7 +137,7 @@ class ActionsDemo extends Component implements HasActions, HasSchemas { return Action::make('modalForm') ->label('Update author') - ->form([ + ->schema([ Select::make('authorId') ->label('Author') ->required(), @@ -174,7 +174,7 @@ class ActionsDemo extends Component implements HasActions, HasSchemas { return Action::make('slideOver') ->label('Update author') - ->form([ + ->schema([ Select::make('authorId') ->label('Author') ->required(), diff --git a/docs-assets/app/app/Livewire/Forms/FieldsDemo.php b/docs-assets/app/app/Livewire/Forms/FieldsDemo.php index 16f81d2077..82a37c99f1 100644 --- a/docs-assets/app/app/Livewire/Forms/FieldsDemo.php +++ b/docs-assets/app/app/Livewire/Forms/FieldsDemo.php @@ -48,7 +48,7 @@ class FieldsDemo extends Component implements HasActions, HasSchemas { return $form ->statePath('data') - ->schema([ + ->components([ Group::make() ->id('simple') ->extraAttributes([ diff --git a/docs-assets/app/app/Livewire/Forms/GettingStartedDemo.php b/docs-assets/app/app/Livewire/Forms/GettingStartedDemo.php index 0422553ec9..65e57074f7 100644 --- a/docs-assets/app/app/Livewire/Forms/GettingStartedDemo.php +++ b/docs-assets/app/app/Livewire/Forms/GettingStartedDemo.php @@ -31,7 +31,7 @@ class GettingStartedDemo extends Component implements HasActions, HasSchemas { return $form ->statePath('data') - ->schema([ + ->components([ Group::make() ->id('fields') ->extraAttributes([ diff --git a/docs-assets/app/app/Livewire/Infolists/EntriesDemo.php b/docs-assets/app/app/Livewire/Infolists/EntriesDemo.php index b6b0455e75..674fd37870 100644 --- a/docs-assets/app/app/Livewire/Infolists/EntriesDemo.php +++ b/docs-assets/app/app/Livewire/Infolists/EntriesDemo.php @@ -28,7 +28,7 @@ class EntriesDemo extends Component implements HasSchemas public function infolist(Schema $infolist): Schema { return $infolist - ->schema([ + ->components([ Group::make() ->id('simple') ->extraAttributes([ diff --git a/docs-assets/app/app/Livewire/Schema/LayoutDemo.php b/docs-assets/app/app/Livewire/Schema/LayoutDemo.php index 1f6bea3254..3cb7fb05d5 100644 --- a/docs-assets/app/app/Livewire/Schema/LayoutDemo.php +++ b/docs-assets/app/app/Livewire/Schema/LayoutDemo.php @@ -45,7 +45,7 @@ class LayoutDemo extends Component implements HasActions, HasSchemas { return $form ->statePath('data') - ->schema([ + ->components([ Group::make() ->id('fieldset') ->extraAttributes([ diff --git a/docs-assets/app/app/Livewire/TablesDemo.php b/docs-assets/app/app/Livewire/TablesDemo.php index 3c42fae3b5..34908776b2 100644 --- a/docs-assets/app/app/Livewire/TablesDemo.php +++ b/docs-assets/app/app/Livewire/TablesDemo.php @@ -173,13 +173,13 @@ class TablesDemo extends Component implements HasSchemas, HasTable return $this->gettingStartedFilters($table) ->actions([ Action::make('feature') - ->action(function (Post $record) { + ->action(function (Post $record): void { $record->is_featured = true; $record->save(); }) ->hidden(fn (Post $record): bool => $record->is_featured), Action::make('unfeature') - ->action(function (Post $record) { + ->action(function (Post $record): void { $record->is_featured = false; $record->save(); }) diff --git a/docs-assets/app/app/Providers/Filament/configure.php b/docs-assets/app/app/Providers/Filament/configure.php index a10a5cfff0..9416946b0c 100644 --- a/docs-assets/app/app/Providers/Filament/configure.php +++ b/docs-assets/app/app/Providers/Filament/configure.php @@ -2,6 +2,6 @@ use Filament\Panel; -return function (Panel $panel) { +return function (Panel $panel): void { // }; diff --git a/docs-assets/app/app/Providers/RouteServiceProvider.php b/docs-assets/app/app/Providers/RouteServiceProvider.php index bc4910996c..c832df98f1 100644 --- a/docs-assets/app/app/Providers/RouteServiceProvider.php +++ b/docs-assets/app/app/Providers/RouteServiceProvider.php @@ -26,7 +26,7 @@ class RouteServiceProvider extends ServiceProvider { $this->configureRateLimiting(); - $this->routes(function () { + $this->routes(function (): void { Route::middleware('api') ->prefix('api') ->group(base_path('routes/api.php')); diff --git a/docs-assets/app/database/migrations/2014_10_12_000000_create_users_table.php b/docs-assets/app/database/migrations/2014_10_12_000000_create_users_table.php index 17fa6b6d6c..83a546e621 100644 --- a/docs-assets/app/database/migrations/2014_10_12_000000_create_users_table.php +++ b/docs-assets/app/database/migrations/2014_10_12_000000_create_users_table.php @@ -11,7 +11,7 @@ return new class extends Migration */ public function up(): void { - Schema::create('users', function (Blueprint $table) { + Schema::create('users', function (Blueprint $table): void { $table->id(); $table->string('name'); $table->string('email')->unique(); diff --git a/docs-assets/app/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php b/docs-assets/app/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php index 81a7229b08..cb68c9ba9e 100644 --- a/docs-assets/app/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php +++ b/docs-assets/app/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php @@ -11,7 +11,7 @@ return new class extends Migration */ public function up(): void { - Schema::create('password_reset_tokens', function (Blueprint $table) { + Schema::create('password_reset_tokens', function (Blueprint $table): void { $table->string('email')->primary(); $table->string('token'); $table->timestamp('created_at')->nullable(); diff --git a/docs-assets/app/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/docs-assets/app/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index 249da8171a..3128b95166 100644 --- a/docs-assets/app/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/docs-assets/app/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -11,7 +11,7 @@ return new class extends Migration */ public function up(): void { - Schema::create('failed_jobs', function (Blueprint $table) { + Schema::create('failed_jobs', function (Blueprint $table): void { $table->id(); $table->string('uuid')->unique(); $table->text('connection'); diff --git a/docs-assets/app/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/docs-assets/app/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php index e828ad8189..07c8c0e780 100644 --- a/docs-assets/app/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/docs-assets/app/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php @@ -11,7 +11,7 @@ return new class extends Migration */ public function up(): void { - Schema::create('personal_access_tokens', function (Blueprint $table) { + Schema::create('personal_access_tokens', function (Blueprint $table): void { $table->id(); $table->morphs('tokenable'); $table->string('name'); diff --git a/docs-assets/app/database/migrations/2023_07_02_122748_create_notifications_table.php b/docs-assets/app/database/migrations/2023_07_02_122748_create_notifications_table.php index d73803223d..cf94c7c448 100644 --- a/docs-assets/app/database/migrations/2023_07_02_122748_create_notifications_table.php +++ b/docs-assets/app/database/migrations/2023_07_02_122748_create_notifications_table.php @@ -11,7 +11,7 @@ return new class extends Migration */ public function up(): void { - Schema::create('notifications', function (Blueprint $table) { + Schema::create('notifications', function (Blueprint $table): void { $table->uuid('id')->primary(); $table->string('type'); $table->morphs('notifiable'); diff --git a/docs-assets/app/database/migrations/2023_07_02_140625_create_posts_table.php b/docs-assets/app/database/migrations/2023_07_02_140625_create_posts_table.php index be5afdb137..622f436ea9 100644 --- a/docs-assets/app/database/migrations/2023_07_02_140625_create_posts_table.php +++ b/docs-assets/app/database/migrations/2023_07_02_140625_create_posts_table.php @@ -11,7 +11,7 @@ return new class extends Migration */ public function up(): void { - Schema::create('posts', function (Blueprint $table) { + Schema::create('posts', function (Blueprint $table): void { $table->id(); $table->foreignId('author_id')->nullable()->constrained('users')->nullOnDelete(); $table->boolean('is_featured')->nullable(); diff --git a/docs-assets/app/routes/console.php b/docs-assets/app/routes/console.php index e05f4c9a1b..35b675eb76 100644 --- a/docs-assets/app/routes/console.php +++ b/docs-assets/app/routes/console.php @@ -14,6 +14,6 @@ use Illuminate\Support\Facades\Artisan; | */ -Artisan::command('inspire', function () { +Artisan::command('inspire', function (): void { $this->comment(Inspiring::quote()); })->purpose('Display an inspiring quote'); diff --git a/docs-assets/app/routes/web.php b/docs-assets/app/routes/web.php index 033742cf72..1ebadd3969 100644 --- a/docs-assets/app/routes/web.php +++ b/docs-assets/app/routes/web.php @@ -39,21 +39,21 @@ Route::get('/actions', ActionsDemo::class); Route::get('/notifications', NotificationsDemo::class); Route::get('/tables', TablesDemo::class); -Route::group(['prefix' => 'forms'], function () { +Route::group(['prefix' => 'forms'], function (): void { Route::get('fields', FieldsDemo::class); Route::get('getting-started', GettingStartedDemo::class); }); -Route::prefix('infolists')->group(function () { +Route::prefix('infolists')->group(function (): void { Route::get('entries', EntriesDemo::class); }); -Route::prefix('schemas')->group(function () { +Route::prefix('schemas')->group(function (): void { Route::get('layout', LayoutDemo::class); }); -Route::prefix('panels')->group(function () { - Route::prefix('navigation')->group(function () { +Route::prefix('panels')->group(function (): void { + Route::prefix('navigation')->group(function (): void { Route::get('user-menu-customization', UserMenuCustomization::class); Route::get('disabled-navigation', DisabledNavigation::class); Route::get('active-icon', ActiveIcon::class); diff --git a/rector.php b/rector.php index 2f77d36b86..29a8dd4744 100644 --- a/rector.php +++ b/rector.php @@ -4,7 +4,9 @@ use Rector\Config\RectorConfig; return RectorConfig::configure() ->withPaths([ + __DIR__ . '/docs-assets/app', __DIR__ . '/packages', + __DIR__ . '/tests', ]) ->withTypeCoverageLevel(0) ->withDeadCodeLevel(0) diff --git a/tests/database/migrations/modify_users_table.php b/tests/database/migrations/modify_users_table.php index a97d33f158..7a4e692009 100644 --- a/tests/database/migrations/modify_users_table.php +++ b/tests/database/migrations/modify_users_table.php @@ -11,8 +11,8 @@ return new class extends Migration */ public function up(): void { - Schema::table('users', function (Blueprint $table) { - $table->after('password', function (Blueprint $table) { + Schema::table('users', function (Blueprint $table): void { + $table->after('password', function (Blueprint $table): void { $table->json('json')->nullable(); $table->string('email_code_authentication_secret')->nullable(); $table->string('google_two_factor_authentication_secret')->nullable(); @@ -26,7 +26,7 @@ return new class extends Migration */ public function down(): void { - Schema::table('users', function (Blueprint $table) { + Schema::table('users', function (Blueprint $table): void { $table->dropColumn([ 'email_code_authentication_secret', 'google_two_factor_authentication_secret', diff --git a/tests/src/Actions/ActionTest.php b/tests/src/Actions/ActionTest.php index 5bd4239c78..f09f230c8a 100644 --- a/tests/src/Actions/ActionTest.php +++ b/tests/src/Actions/ActionTest.php @@ -12,13 +12,13 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can call an action', function () { +it('can call an action', function (): void { livewire(Actions::class) ->callAction('simple') ->assertDispatched('simple-called'); }); -it('can call an action with data', function () { +it('can call an action with data', function (): void { livewire(Actions::class) ->callAction('data', data: [ 'payload' => $payload = Str::random(), @@ -29,7 +29,7 @@ it('can call an action with data', function () { ]); }); -it('can validate an action\'s data', function () { +it('can validate an action\'s data', function (): void { livewire(Actions::class) ->callAction('data', data: [ 'payload' => null, @@ -38,7 +38,7 @@ it('can validate an action\'s data', function () { ->assertNotDispatched('data-called'); }); -it('can access form data in before hook', function () { +it('can access form data in before hook', function (): void { livewire(Actions::class) ->callAction('before-hook-data', data: [ 'payload' => $payload = Str::random(), @@ -49,7 +49,7 @@ it('can access form data in before hook', function () { ]); }); -it('can set default action data when mounted', function () { +it('can set default action data when mounted', function (): void { livewire(Actions::class) ->mountAction('data') ->assertActionDataSet([ @@ -57,7 +57,7 @@ it('can set default action data when mounted', function () { ]); }); -it('can call a nested action registered in the modal footer', function () { +it('can call a nested action registered in the modal footer', function (): void { livewire(Actions::class) ->callAction([ 'parent', @@ -74,7 +74,7 @@ it('can call a nested action registered in the modal footer', function () { ->assertDispatched('parent-called', foo: $foo); }); -it('can call a manually modal registered nested action', function () { +it('can call a manually modal registered nested action', function (): void { livewire(Actions::class) ->callAction([ 'parent', @@ -91,7 +91,7 @@ it('can call a manually modal registered nested action', function () { ->assertDispatched('parent-called', foo: $foo); }); -it('can call a nested action registered on a schema component', function () { +it('can call a nested action registered on a schema component', function (): void { livewire(Actions::class) ->callAction([ 'parent', @@ -108,7 +108,7 @@ it('can call a nested action registered on a schema component', function () { ->assertDispatched('parent-called', foo: $foo); }); -it('can cancel a parent action when calling a nested action', function () { +it('can cancel a parent action when calling a nested action', function (): void { livewire(Actions::class) ->callAction([ 'parent', @@ -121,7 +121,7 @@ it('can cancel a parent action when calling a nested action', function () { ->assertNotDispatched('parent-called'); }); -it('can mount an action with arguments', function () { +it('can mount an action with arguments', function (): void { livewire(Actions::class) ->mountAction('arguments', arguments: [ 'payload' => $payload = Str::random(), @@ -132,7 +132,7 @@ it('can mount an action with arguments', function () { ]); }); -it('can mount a nested action with parent arguments', function () { +it('can mount a nested action with parent arguments', function (): void { livewire(Actions::class) ->mountAction([ TestAction::make('arguments')->arguments(['payload' => Str::random()]), @@ -149,7 +149,7 @@ it('can mount a nested action with parent arguments', function () { ->assertDispatched('nested-called', arguments: []); }); -it('can mount a nested action with nested arguments', function () { +it('can mount a nested action with nested arguments', function (): void { livewire(Actions::class) ->mountAction([ 'arguments', @@ -170,7 +170,7 @@ it('can mount a nested action with nested arguments', function () { ]); }); -it('can get the raw data from parent actions', function () { +it('can get the raw data from parent actions', function (): void { livewire(Actions::class) ->mountAction('parent') ->setActionData([ @@ -186,7 +186,7 @@ it('can get the raw data from parent actions', function () { ->assertDispatched('data-test-called', foo: $foo, bar: $bar, baz: $baz); }); -it('can get the arguments from parent actions', function () { +it('can get the arguments from parent actions', function (): void { livewire(Actions::class) ->callAction([ TestAction::make('parent')->arguments([ @@ -202,7 +202,7 @@ it('can get the arguments from parent actions', function () { ->assertDispatched('arguments-test-called', foo: $foo, bar: $bar, baz: $baz); }); -it('can call an action with arguments', function () { +it('can call an action with arguments', function (): void { livewire(Actions::class) ->callAction('arguments', arguments: [ 'payload' => $payload = Str::random(), @@ -212,14 +212,14 @@ it('can call an action with arguments', function () { ]); }); -it('can call an action and halt', function () { +it('can call an action and halt', function (): void { livewire(Actions::class) ->callAction('halt') ->assertDispatched('halt-called') ->assertActionHalted('halt'); }); -it('can hide an action', function () { +it('can hide an action', function (): void { livewire(Actions::class) ->assertActionVisible('visible') ->assertActionHidden('hidden') @@ -229,49 +229,49 @@ it('can hide an action', function () { ->assertActionDoesNotExist('hidden', fn (Action $action): bool => $action->isVisible()); }); -it('can disable an action', function () { +it('can disable an action', function (): void { livewire(Actions::class) ->assertActionEnabled('enabled') ->assertActionDisabled('disabled'); }); -it('can have an icon', function () { +it('can have an icon', function (): void { livewire(Actions::class) ->assertActionHasIcon('hasIcon', Heroicon::PencilSquare) ->assertActionDoesNotHaveIcon('hasIcon', Heroicon::Trash); }); -it('can have a label', function () { +it('can have a label', function (): void { livewire(Actions::class) ->assertActionHasLabel('hasLabel', 'My Action') ->assertActionDoesNotHaveLabel('hasLabel', 'My Other Action'); }); -it('can have a color', function () { +it('can have a color', function (): void { livewire(Actions::class) ->assertActionHasColor('hasColor', 'primary') ->assertActionDoesNotHaveColor('hasColor', 'gray'); }); -it('can have a URL', function () { +it('can have a URL', function (): void { livewire(Actions::class) ->assertActionHasUrl('url', 'https://filamentphp.com') ->assertActionDoesNotHaveUrl('url', 'https://google.com'); }); -it('can open a URL in a new tab', function () { +it('can open a URL in a new tab', function (): void { livewire(Actions::class) ->assertActionShouldOpenUrlInNewTab('urlInNewTab') ->assertActionShouldNotOpenUrlInNewTab('urlNotInNewTab'); }); -it('can state whether a page action exists', function () { +it('can state whether a page action exists', function (): void { livewire(Actions::class) ->assertActionExists('exists') ->assertActionDoesNotExist('doesNotExist'); }); -it('can show a notification', function () { +it('can show a notification', function (): void { livewire(Actions::class) ->callAction('shows-notification') ->assertNotified(); @@ -289,7 +289,7 @@ it('can show a notification', function () { ); }); -it('will raise an exception if a notification was not sent checking notification object', function () { +it('will raise an exception if a notification was not sent checking notification object', function (): void { $this->expectException('PHPUnit\Framework\ExpectationFailedException'); $this->expectExceptionMessage('A notification was not sent'); @@ -302,7 +302,7 @@ it('will raise an exception if a notification was not sent checking notification ); }); -it('will raise an exception if a notification was not sent checking notification title', function () { +it('will raise an exception if a notification was not sent checking notification title', function (): void { $this->expectException('PHPUnit\Framework\ExpectationFailedException'); $this->expectExceptionMessage('A notification was not sent'); @@ -311,7 +311,7 @@ it('will raise an exception if a notification was not sent checking notification ->assertNotified('A notification'); }); -it('can assert that a notification without an ID was sent', function () { +it('can assert that a notification without an ID was sent', function (): void { livewire(Actions::class) ->callAction('shows-notification') ->assertNotified(); @@ -329,7 +329,7 @@ it('can assert that a notification without an ID was sent', function () { ); }); -it('can assert that a notification with an ID was sent', function () { +it('can assert that a notification with an ID was sent', function (): void { livewire(Actions::class) ->callAction('shows-notification-with-id') ->assertNotified(); @@ -347,7 +347,7 @@ it('can assert that a notification with an ID was sent', function () { ); }); -it('will raise an exception if a notification was sent checking with a different notification title', function () { +it('will raise an exception if a notification was sent checking with a different notification title', function (): void { $this->expectException('PHPUnit\Framework\ExpectationFailedException'); $this->expectExceptionMessage('Failed asserting that two arrays are identical.'); @@ -360,7 +360,7 @@ it('will raise an exception if a notification was sent checking with a different ); }); -it('will raise an exception if a notification is not sent but a previous notification was sent', function () { +it('will raise an exception if a notification is not sent but a previous notification was sent', function (): void { livewire(Actions::class) ->callAction('shows-notification-with-id') ->assertNotified( @@ -381,7 +381,7 @@ it('will raise an exception if a notification is not sent but a previous notific ); }); -test('can assert that notifications are sent in any order', function () { +test('can assert that notifications are sent in any order', function (): void { livewire(Actions::class) ->callAction('two-notifications') ->assertNotified('Second notification'); @@ -398,7 +398,7 @@ test('can assert that notifications are sent in any order', function () { ->assertNotified('Third notification'); }); -it('will assert that a notification was not sent', function () { +it('will assert that a notification was not sent', function (): void { livewire(Actions::class) ->callAction('does-not-show-notification') diff --git a/tests/src/Actions/RateLimitingTest.php b/tests/src/Actions/RateLimitingTest.php index 5a94db0e63..681f4220ce 100644 --- a/tests/src/Actions/RateLimitingTest.php +++ b/tests/src/Actions/RateLimitingTest.php @@ -7,7 +7,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can rate limit an action', function () { +it('can rate limit an action', function (): void { livewire(Actions::class) ->callAction('rate-limited') ->assertDispatched('rate-limited-called') diff --git a/tests/src/Fixtures/Livewire/Actions.php b/tests/src/Fixtures/Livewire/Actions.php index b6590cd074..db70f5c3b7 100644 --- a/tests/src/Fixtures/Livewire/Actions.php +++ b/tests/src/Fixtures/Livewire/Actions.php @@ -28,25 +28,25 @@ class Actions extends Component implements HasActions, HasSchemas public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ TextInput::make('textInput') ->registerActions([ Action::make('setValue') - ->form([ + ->schema([ TextInput::make('value') ->default('foo') ->required(), ]) - ->action(function (TextInput $component, array $data) { + ->action(function (TextInput $component, array $data): void { $component->state($data['value']); }), Action::make('setValueFromArguments') - ->action(function (TextInput $component, array $arguments) { + ->action(function (TextInput $component, array $arguments): void { $component->state($arguments['value']); }), Action::make('halt') ->requiresConfirmation() - ->action(function (Action $action) { + ->action(function (Action $action): void { $action->halt(); }), Action::make('hidden') diff --git a/tests/src/Fixtures/Livewire/InfolistActions.php b/tests/src/Fixtures/Livewire/InfolistActions.php index 68fa9d334f..53250a334b 100644 --- a/tests/src/Fixtures/Livewire/InfolistActions.php +++ b/tests/src/Fixtures/Livewire/InfolistActions.php @@ -23,26 +23,26 @@ class InfolistActions extends Component implements HasActions, HasSchemas { return $infolist ->constantState([]) - ->schema([ + ->components([ TextEntry::make('textEntry') ->registerActions([ Action::make('setValue') - ->form([ + ->schema([ TextInput::make('value') ->default('foo') ->required(), ]) - ->action(function (array $data) { + ->action(function (array $data): void { $this->dispatch('foo', $data['value']); }), Action::make('setValueFromArguments') ->requiresConfirmation() - ->action(function (array $arguments) { + ->action(function (array $arguments): void { $this->dispatch('foo', $arguments['value']); }), Action::make('halt') ->requiresConfirmation() - ->action(function (Action $action) { + ->action(function (Action $action): void { $action->halt(); }), Action::make('hidden') diff --git a/tests/src/Fixtures/Livewire/PostsTable.php b/tests/src/Fixtures/Livewire/PostsTable.php index 16216f2652..72aff99c01 100644 --- a/tests/src/Fixtures/Livewire/PostsTable.php +++ b/tests/src/Fixtures/Livewire/PostsTable.php @@ -140,20 +140,20 @@ class PostsTable extends Component implements HasActions, HasSchemas, Tables\Con ->headerActions([ Action::make('data') ->mountUsing(fn (Schema $form) => $form->fill(['foo' => 'bar'])) - ->form([ + ->schema([ TextInput::make('payload')->required(), ]) - ->action(function (array $data) { + ->action(function (array $data): void { $this->dispatch('data-called', data: $data); }), Action::make('arguments') ->requiresConfirmation() - ->action(function (array $arguments) { + ->action(function (array $arguments): void { $this->dispatch('arguments-called', arguments: $arguments); }), Action::make('halt') ->requiresConfirmation() - ->action(function (Action $action) { + ->action(function (Action $action): void { $this->dispatch('halt-called'); $action->halt(); @@ -195,11 +195,11 @@ class PostsTable extends Component implements HasActions, HasSchemas, Tables\Con RestoreAction::make(), ReplicateAction::make() ->mutateRecordDataUsing(function (array $data): array { - $data['title'] = $data['title'] . ' (Copy)'; + $data['title'] .= ' (Copy)'; return $data; }) - ->form([ + ->schema([ TextInput::make('title') ->required(), ]), @@ -223,7 +223,7 @@ class PostsTable extends Component implements HasActions, HasSchemas, Tables\Con ->cancelParentActions(), ]), ]) - ->action(function (array $data, Post $record) { + ->action(function (array $data, Post $record): void { $this->dispatch('parent-called', foo: $data['foo'], recordKey: $record->getKey()); }) ->extraModalFooterActions([ @@ -266,7 +266,7 @@ class PostsTable extends Component implements HasActions, HasSchemas, Tables\Con ->cancelParentActions(), ]), ]) - ->action(function (array $data, Post $record) { + ->action(function (array $data, Post $record): void { $this->dispatch('grouped-parent-called', foo: $data['foo'], recordKey: $record->getKey()); }) ->extraModalFooterActions([ @@ -291,20 +291,20 @@ class PostsTable extends Component implements HasActions, HasSchemas, Tables\Con DeleteBulkAction::make(), BulkAction::make('data') ->mountUsing(fn (Schema $form) => $form->fill(['foo' => 'bar'])) - ->form([ + ->schema([ TextInput::make('payload')->required(), ]) - ->action(function (array $data) { + ->action(function (array $data): void { $this->dispatch('data-called', data: $data); }), BulkAction::make('arguments') ->requiresConfirmation() - ->action(function (array $arguments) { + ->action(function (array $arguments): void { $this->dispatch('arguments-called', arguments: $arguments); }), BulkAction::make('halt') ->requiresConfirmation() - ->action(function (BulkAction $action) { + ->action(function (BulkAction $action): void { $this->dispatch('halt-called'); $action->halt(); diff --git a/tests/src/Fixtures/Pages/Actions.php b/tests/src/Fixtures/Pages/Actions.php index b5992e9620..cf6943dfe6 100644 --- a/tests/src/Fixtures/Pages/Actions.php +++ b/tests/src/Fixtures/Pages/Actions.php @@ -17,33 +17,33 @@ class Actions extends Page { return [ Action::make('simple') - ->action(function () { + ->action(function (): void { $this->dispatch('simple-called'); }), Action::make('data') ->mountUsing(fn (Schema $form) => $form->fill(['foo' => 'bar'])) - ->form([ + ->schema([ TextInput::make('payload')->required(), ]) - ->action(function (array $data) { + ->action(function (array $data): void { $this->dispatch('data-called', data: $data); }), Action::make('before-hook-data') - ->form([ + ->schema([ TextInput::make('payload')->required(), ]) - ->before(function (Action $action) { + ->before(function (Action $action): void { $this->dispatch('before-hook-called', data: $action->getFormData()); }), Action::make('arguments') ->requiresConfirmation() - ->action(function (array $arguments) { + ->action(function (array $arguments): void { $this->dispatch('arguments-called', arguments: $arguments); }) ->extraModalFooterActions(fn (): array => [ Action::make('nested') ->requiresConfirmation() - ->action(function (array $arguments) { + ->action(function (array $arguments): void { $this->dispatch('nested-called', arguments: $arguments); }), ]), @@ -67,7 +67,7 @@ class Actions extends Page ->cancelParentActions(), ]), ]) - ->action(function (array $data) { + ->action(function (array $data): void { $this->dispatch('parent-called', foo: $data['foo']); }) ->extraModalFooterActions([ @@ -97,7 +97,7 @@ class Actions extends Page baz: $mountedActions[2]->getRawFormData()['baz'], )), Action::make('testArguments') - ->action(function (array $mountedActions) { + ->action(function (array $mountedActions): void { $this->dispatch( 'arguments-test-called', foo: $mountedActions[0]->getArguments()['foo'], @@ -110,7 +110,7 @@ class Actions extends Page ]), Action::make('halt') ->requiresConfirmation() - ->action(function (Action $action) { + ->action(function (Action $action): void { $this->dispatch('halt-called'); $action->halt(); @@ -135,7 +135,7 @@ class Actions extends Page Action::make('urlNotInNewTab') ->url('https://filamentphp.com', false), Action::make('shows-notification') - ->action(function () { + ->action(function (): void { Notification::make() ->title('A notification') ->success() @@ -143,14 +143,14 @@ class Actions extends Page }), Action::make('does-not-show-notification'), Action::make('shows-notification-with-id') - ->action(function () { + ->action(function (): void { Notification::make('notification_with_id') ->title('A notification') ->success() ->send(); }), Action::make('two-notifications') - ->action(function () { + ->action(function (): void { Notification::make('first_notification') ->title('First notification') ->success() diff --git a/tests/src/Fixtures/Pages/Settings.php b/tests/src/Fixtures/Pages/Settings.php index 0b32245b75..9033329b17 100644 --- a/tests/src/Fixtures/Pages/Settings.php +++ b/tests/src/Fixtures/Pages/Settings.php @@ -34,7 +34,7 @@ class Settings extends Page public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ TextInput::make('name')->required(), ]); } diff --git a/tests/src/Fixtures/Resources/Posts/PostResource.php b/tests/src/Fixtures/Resources/Posts/PostResource.php index 7897b0f466..33886b7289 100644 --- a/tests/src/Fixtures/Resources/Posts/PostResource.php +++ b/tests/src/Fixtures/Resources/Posts/PostResource.php @@ -31,7 +31,7 @@ class PostResource extends Resource public static function form(Schema $form): Schema { return $form - ->schema([ + ->components([ Forms\Components\TextInput::make('title')->required(), Forms\Components\MarkdownEditor::make('content'), Forms\Components\Select::make('author_id') diff --git a/tests/src/Fixtures/Resources/Users/UserResource.php b/tests/src/Fixtures/Resources/Users/UserResource.php index aa73290ada..513b6b8ad5 100644 --- a/tests/src/Fixtures/Resources/Users/UserResource.php +++ b/tests/src/Fixtures/Resources/Users/UserResource.php @@ -27,7 +27,7 @@ class UserResource extends Resource public static function form(Schema $form): Schema { return $form - ->schema([ + ->components([ Forms\Components\TextInput::make('name')->required(), Forms\Components\TextInput::make('email')->required(), ]); diff --git a/tests/src/Forms/ActionTest.php b/tests/src/Forms/ActionTest.php index a8e7936d4b..a252089efd 100644 --- a/tests/src/Forms/ActionTest.php +++ b/tests/src/Forms/ActionTest.php @@ -12,7 +12,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can register actions', function () { +it('can register actions', function (): void { $action = Action::make($actionName = Str::random()); $component = TextInput::make('name') @@ -22,7 +22,7 @@ it('can register actions', function () { ->toBe($action); }); -it('can auto-register actions from affixes', function () { +it('can auto-register actions from affixes', function (): void { $component = TextInput::make('name') ->prefixAction( $prefixAction = Action::make($prefixActionName = Str::random()), @@ -36,7 +36,7 @@ it('can auto-register actions from affixes', function () { ->getAction($suffixActionName)->toBe($suffixAction); }); -it('can call an action with data', function () { +it('can call an action with data', function (): void { livewire(Actions::class) ->callAction(TestAction::make('setValue')->schemaComponent('form.textInput'), data: [ 'value' => $value = Str::random(), @@ -50,7 +50,7 @@ it('can call an action with data', function () { ->assertFormSet(['textInput' => $value]); }); -it('can validate an action\'s data', function () { +it('can validate an action\'s data', function (): void { livewire(Actions::class) ->callAction(TestAction::make('setValue')->schemaComponent('form.textInput'), data: [ 'value' => null, @@ -66,7 +66,7 @@ it('can validate an action\'s data', function () { ->assertFormSet(['textInput' => null]); }); -it('can set default action data when mounted', function () { +it('can set default action data when mounted', function (): void { livewire(Actions::class) ->mountAction(TestAction::make('setValue')->schemaComponent('form.textInput')) ->assertActionDataSet([ @@ -80,7 +80,7 @@ it('can set default action data when mounted', function () { ]); }); -it('can call an action with arguments', function () { +it('can call an action with arguments', function (): void { livewire(Actions::class) ->callAction(TestAction::make('setValueFromArguments')->schemaComponent('form.textInput')->arguments([ 'value' => $value = Str::random(), @@ -94,7 +94,7 @@ it('can call an action with arguments', function () { ->assertFormSet(['textInput' => $value]); }); -it('can call an action and halt', function () { +it('can call an action and halt', function (): void { livewire(Actions::class) ->callAction(TestAction::make('halt')->schemaComponent('form.textInput')) ->assertActionHalted(TestAction::make('halt')->schemaComponent('form.textInput')); @@ -104,7 +104,7 @@ it('can call an action and halt', function () { ->assertFormComponentActionHalted('textInput', 'halt'); }); -it('can hide an action', function () { +it('can hide an action', function (): void { livewire(Actions::class) ->assertActionHidden(TestAction::make('hidden')->schemaComponent('form.textInput')) ->assertActionVisible(TestAction::make('visible')->schemaComponent('form.textInput')) @@ -118,7 +118,7 @@ it('can hide an action', function () { ->assertFormComponentActionHidden('textInput', 'hidden'); }); -it('can disable an action', function () { +it('can disable an action', function (): void { livewire(Actions::class) ->assertActionDisabled(TestAction::make('disabled')->schemaComponent('form.textInput')) ->assertActionEnabled(TestAction::make('enabled')->schemaComponent('form.textInput')); @@ -128,7 +128,7 @@ it('can disable an action', function () { ->assertFormComponentActionDisabled('textInput', 'disabled'); }); -it('can have an icon', function () { +it('can have an icon', function (): void { livewire(Actions::class) ->assertActionHasIcon(TestAction::make('hasIcon')->schemaComponent('form.textInput'), Heroicon::PencilSquare) ->assertActionDoesNotHaveIcon(TestAction::make('hasIcon')->schemaComponent('form.textInput'), Heroicon::Trash); @@ -138,7 +138,7 @@ it('can have an icon', function () { ->assertFormComponentActionDoesNotHaveIcon('textInput', 'hasIcon', Heroicon::Trash); }); -it('can have a label', function () { +it('can have a label', function (): void { livewire(Actions::class) ->assertActionHasLabel(TestAction::make('hasLabel')->schemaComponent('form.textInput'), 'My Action') ->assertActionDoesNotHaveLabel(TestAction::make('hasLabel')->schemaComponent('form.textInput'), 'My Other Action'); @@ -148,7 +148,7 @@ it('can have a label', function () { ->assertFormComponentActionDoesNotHaveLabel('textInput', 'hasLabel', 'My Other Action'); }); -it('can have a color', function () { +it('can have a color', function (): void { livewire(Actions::class) ->assertActionHasColor(TestAction::make('hasColor')->schemaComponent('form.textInput'), 'primary') ->assertActionDoesNotHaveColor(TestAction::make('hasColor')->schemaComponent('form.textInput'), 'gray'); @@ -158,7 +158,7 @@ it('can have a color', function () { ->assertFormComponentActionDoesNotHaveColor('textInput', 'hasColor', 'gray'); }); -it('can have a URL', function () { +it('can have a URL', function (): void { livewire(Actions::class) ->assertActionHasUrl(TestAction::make('url')->schemaComponent('form.textInput'), 'https://filamentphp.com') ->assertActionDoesNotHaveUrl(TestAction::make('url')->schemaComponent('form.textInput'), 'https://google.com'); @@ -168,7 +168,7 @@ it('can have a URL', function () { ->assertFormComponentActionDoesNotHaveUrl('textInput', 'url', 'https://google.com'); }); -it('can open a URL in a new tab', function () { +it('can open a URL in a new tab', function (): void { livewire(Actions::class) ->assertActionShouldOpenUrlInNewTab(TestAction::make('urlInNewTab')->schemaComponent('form.textInput')) ->assertActionShouldNotOpenUrlInNewTab(TestAction::make('urlNotInNewTab')->schemaComponent('form.textInput')); @@ -178,7 +178,7 @@ it('can open a URL in a new tab', function () { ->assertFormComponentActionShouldNotOpenUrlInNewTab('textInput', 'urlNotInNewTab'); }); -it('can state whether a form component action exists', function () { +it('can state whether a form component action exists', function (): void { livewire(Actions::class) ->assertActionExists(TestAction::make('exists')->schemaComponent('form.textInput')) ->assertActionDoesNotExist(TestAction::make('doesNotExist')->schemaComponent('form.textInput')); diff --git a/tests/src/Forms/ComponentContainerTest.php b/tests/src/Forms/ComponentContainerTest.php index 11bd8e73cb..781d8e8b35 100644 --- a/tests/src/Forms/ComponentContainerTest.php +++ b/tests/src/Forms/ComponentContainerTest.php @@ -12,14 +12,14 @@ use Illuminate\Support\Str; uses(TestCase::class); -it('belongs to Livewire component', function () { +it('belongs to Livewire component', function (): void { $schema = Schema::make($livewire = Livewire::make()); expect($schema) ->getLivewire()->toBe($livewire); }); -it('has components', function () { +it('has components', function (): void { $components = []; foreach (range(1, $count = rand(2, 10)) as $i) { @@ -39,7 +39,7 @@ it('has components', function () { ); }); -it('has dynamic components', function () { +it('has dynamic components', function (): void { $components = []; foreach (range(1, $count = rand(2, 10)) as $i) { @@ -59,7 +59,7 @@ it('has dynamic components', function () { ); }); -it('belongs to parent component', function () { +it('belongs to parent component', function (): void { $schema = Schema::make(Livewire::make()) ->parentComponent($component = new Component); @@ -67,7 +67,7 @@ it('belongs to parent component', function () { ->getParentComponent()->toBe($component); }); -it('can return a component by name and callback', function () { +it('can return a component by name and callback', function (): void { $schema = Schema::make(Livewire::make()) ->components([ $input = Field::make($statePath = Str::random()), @@ -78,7 +78,7 @@ it('can return a component by name and callback', function () { ->getComponent(fn (Component $component) => $component->getName() === $statePath)->toBe($input); }); -it('can return a flat array of components', function () { +it('can return a flat array of components', function (): void { $schema = Schema::make(Livewire::make()) ->components([ $fieldset = Fieldset::make(Str::random()) @@ -98,7 +98,7 @@ it('can return a flat array of components', function () { ]); }); -it('can return a flat array of components with hidden components', function () { +it('can return a flat array of components with hidden components', function (): void { $schema = Schema::make(Livewire::make()) ->components([ $fieldset = Fieldset::make(Str::random()) @@ -119,7 +119,7 @@ it('can return a flat array of components with hidden components', function () { ]); }); -it('can return a flat array of fields', function () { +it('can return a flat array of fields', function (): void { $schema = Schema::make(Livewire::make()) ->components([ Fieldset::make(Str::random()) @@ -138,7 +138,7 @@ it('can return a flat array of fields', function () { ]); }); -it('can return a flat array of fields with hidden fields', function () { +it('can return a flat array of fields with hidden fields', function (): void { $schema = Schema::make(Livewire::make()) ->components([ Fieldset::make(Str::random()) @@ -158,7 +158,7 @@ it('can return a flat array of fields with hidden fields', function () { ]); }); -it('can return a flat array of fields with nested path keys', function () { +it('can return a flat array of fields with nested path keys', function (): void { $schema = Schema::make(Livewire::make()) ->components([ Fieldset::make(Str::random()) @@ -178,7 +178,7 @@ it('can return a flat array of fields with nested path keys', function () { ]); }); -it('can return a flat array of fields with absolute path keys', function () { +it('can return a flat array of fields with absolute path keys', function (): void { $schema = Schema::make(Livewire::make()) ->components([ Fieldset::make(Str::random()) diff --git a/tests/src/Forms/Components/FileUploadTest.php b/tests/src/Forms/Components/FileUploadTest.php index a03fe08f53..dd26b10b13 100644 --- a/tests/src/Forms/Components/FileUploadTest.php +++ b/tests/src/Forms/Components/FileUploadTest.php @@ -12,7 +12,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('UploadedFile should be converted to TemporaryUploadedFile', function () { +it('UploadedFile should be converted to TemporaryUploadedFile', function (): void { try { livewire(TestComponentWithFileUpload::class) ->fillForm([ @@ -22,7 +22,7 @@ it('UploadedFile should be converted to TemporaryUploadedFile', function () { UploadedFile::fake()->image('multiple-file2.jpg'), ], ]) - ->assertFormSet(function (array $data) { + ->assertFormSet(function (array $data): void { expect($data['single-file'][0])->toBeInstanceOf(TemporaryUploadedFile::class) ->and($data['multiple-files'][0])->toBeInstanceOf(TemporaryUploadedFile::class) ->and($data['multiple-files'][1])->toBeInstanceOf(TemporaryUploadedFile::class); @@ -37,7 +37,7 @@ class TestComponentWithFileUpload extends Livewire public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ FileUpload::make('single-file'), FileUpload::make('multiple-files')->multiple(), ]) diff --git a/tests/src/Forms/Components/RepeaterTest.php b/tests/src/Forms/Components/RepeaterTest.php index 96cd67c869..6a5d5a822d 100644 --- a/tests/src/Forms/Components/RepeaterTest.php +++ b/tests/src/Forms/Components/RepeaterTest.php @@ -15,7 +15,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can fill and assert data in a repeater', function (array $data) { +it('can fill and assert data in a repeater', function (array $data): void { $undoRepeaterFake = Repeater::fake(); try { @@ -111,7 +111,7 @@ it('can fill and assert data in a repeater', function (array $data) { ]], ]); -it('can remove items from a repeater', function () { +it('can remove items from a repeater', function (): void { $undoRepeaterFake = Repeater::fake(); livewire(TestComponentWithRepeater::class) @@ -146,7 +146,7 @@ it('can remove items from a repeater', function () { $undoRepeaterFake(); }); -it('loads a relationship', function () { +it('loads a relationship', function (): void { $user = User::factory() ->has(Post::factory()->count(3)) ->create(); @@ -167,7 +167,7 @@ it('loads a relationship', function () { ->toBe(3); }); -it('throws an exception for a missing relationship', function () { +it('throws an exception for a missing relationship', function (): void { $componentContainer = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -185,7 +185,7 @@ class TestComponentWithRepeater extends Livewire public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ Repeater::make('normal') ->itemLabel(function (array $state) { return $state['title'] . $state['category']; diff --git a/tests/src/Forms/ComputedPropertyTest.php b/tests/src/Forms/ComputedPropertyTest.php index d572836d2c..4ffee9f96d 100644 --- a/tests/src/Forms/ComputedPropertyTest.php +++ b/tests/src/Forms/ComputedPropertyTest.php @@ -8,7 +8,7 @@ use Pest\Expectation; uses(TestCase::class); -test('computed properties used to generate form schema can be accessed before caching forms', function () { +test('computed properties used to generate form schema can be accessed before caching forms', function (): void { expect(ComputedPropertySchema::make()) ->getSchemaArray() ->toBeArray() @@ -22,7 +22,7 @@ class ComputedPropertySchema extends Livewire public function form(Schema $form): Schema { return $form - ->schema($this->schema); + ->components($this->schema); } public function getSchemaProperty() diff --git a/tests/src/Forms/FieldTest.php b/tests/src/Forms/FieldTest.php index a080e8bfc7..a6b5bf709f 100644 --- a/tests/src/Forms/FieldTest.php +++ b/tests/src/Forms/FieldTest.php @@ -9,7 +9,7 @@ use Illuminate\Support\Str; uses(TestCase::class); -it('sets its state path from its name', function () { +it('sets its state path from its name', function (): void { $field = (new Field($name = Str::random())) ->container(Schema::make(Livewire::make())); @@ -17,7 +17,7 @@ it('sets its state path from its name', function () { ->getStatePath()->toBe($name); }); -it('sets its fallback label from its name', function () { +it('sets its fallback label from its name', function (): void { $field = (new Field($name = Str::random())) ->container(Schema::make(Livewire::make())); @@ -31,14 +31,14 @@ it('sets its fallback label from its name', function () { ); }); -it('can be instantiated with a default name', function () { +it('can be instantiated with a default name', function (): void { $field = IdField::make(); expect($field->getName()) ->toBe('id'); }); -it('can ignore the default name if another is specified', function () { +it('can ignore the default name if another is specified', function (): void { $field = IdField::make('identifier'); expect($field->getName()) diff --git a/tests/src/Forms/FormsTest.php b/tests/src/Forms/FormsTest.php index d583d1b0f3..793dc9015f 100644 --- a/tests/src/Forms/FormsTest.php +++ b/tests/src/Forms/FormsTest.php @@ -11,18 +11,18 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('has a form with the default name \'form\'', function () { +it('has a form with the default name \'form\'', function (): void { livewire(TestComponentWithForm::class) ->assertFormExists(); }); -it('can have forms with non-default names', function () { +it('can have forms with non-default names', function (): void { livewire(TestComponentWithMultipleForms::class) ->assertFormExists('fooForm') ->assertFormExists('barForm'); }); -it('has fields', function () { +it('has fields', function (): void { livewire(TestComponentWithForm::class) ->assertFormFieldExists('title') ->assertFormFieldExists('nested.input') @@ -31,12 +31,12 @@ it('has fields', function () { }); }); -it('does not have fields', function () { +it('does not have fields', function (): void { livewire(TestComponentWithForm::class) ->assertFormFieldDoesNotExist('not-such-field'); }); -it('has fields on multiple forms', function () { +it('has fields on multiple forms', function (): void { livewire(TestComponentWithMultipleForms::class) ->assertFormFieldExists('title', 'fooForm') ->assertFormFieldExists('title', 'barForm') @@ -45,57 +45,57 @@ it('has fields on multiple forms', function () { }); }); -it('can fill fields on multiple forms', function () { +it('can fill fields on multiple forms', function (): void { livewire(TestComponentWithMultipleForms::class) ->fillForm(['title' => 'value'], 'fooForm') ->assertFormSet(['title' => 'value'], 'fooForm'); }); -it('can have disabled fields', function () { +it('can have disabled fields', function (): void { livewire(TestComponentWithForm::class) ->assertFormFieldDisabled('disabled'); }); -it('can have disabled fields on multiple forms', function () { +it('can have disabled fields on multiple forms', function (): void { livewire(TestComponentWithMultipleForms::class) ->assertFormFieldDisabled('disabled', 'fooForm') ->assertFormFieldDisabled('disabled', 'barForm'); }); -it('can have enabled fields', function () { +it('can have enabled fields', function (): void { livewire(TestComponentWithForm::class) ->assertFormFieldEnabled('enabled'); }); -it('can have enabled fields on multiple forms', function () { +it('can have enabled fields on multiple forms', function (): void { livewire(TestComponentWithMultipleForms::class) ->assertFormFieldEnabled('enabled', 'fooForm') ->assertFormFieldEnabled('enabled', 'barForm'); }); -it('can have hidden fields', function () { +it('can have hidden fields', function (): void { livewire(TestComponentWithForm::class) ->assertFormFieldHidden('hidden'); }); -it('can have hidden fields on multiple forms', function () { +it('can have hidden fields on multiple forms', function (): void { livewire(TestComponentWithMultipleForms::class) ->assertFormFieldHidden('hidden', 'fooForm') ->assertFormFieldHidden('hidden', 'barForm'); }); -it('can have visible fields', function () { +it('can have visible fields', function (): void { livewire(TestComponentWithForm::class) ->assertFormFieldVisible('visible'); }); -it('can have visible fields on multiple forms', function () { +it('can have visible fields on multiple forms', function (): void { livewire(TestComponentWithMultipleForms::class) ->assertFormFieldVisible('visible', 'fooForm') ->assertFormFieldVisible('visible', 'barForm'); }); -it('has layout components', function () { +it('has layout components', function (): void { livewire(TestComponentWithForm::class) ->assertFormComponentExists('section') ->assertFormComponentExists('section.nested.section') @@ -104,12 +104,12 @@ it('has layout components', function () { }); }); -it('does not have layout components', function () { +it('does not have layout components', function (): void { livewire(TestComponentWithForm::class) ->assertFormComponentDoesNotExist('no-such-section'); }); -it('can go to next wizard step on multiple forms', function () { +it('can go to next wizard step on multiple forms', function (): void { livewire(TestComponentWithMultipleWizardForms::class) ->assertHasNoFormErrors(formName: 'fooForm') ->assertHasNoFormErrors(formName: 'barForm') @@ -125,7 +125,7 @@ class TestComponentWithForm extends Livewire public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ TextInput::make('title'), TextInput::make('nested.input'), @@ -170,14 +170,14 @@ class TestComponentWithMultipleForms extends Livewire public function fooForm(Schema $form): Schema { return $form - ->schema($this->getSchemaForForms()) + ->components($this->getSchemaForForms()) ->statePath('data'); } public function barForm(Schema $form): Schema { return $form - ->schema($this->getSchemaForForms()) + ->components($this->getSchemaForForms()) ->statePath('data'); } @@ -222,14 +222,14 @@ class TestComponentWithMultipleWizardForms extends Livewire public function fooForm(Schema $form): Schema { return $form - ->schema($this->getSchemaForForms()) + ->components($this->getSchemaForForms()) ->statePath('fooData'); } public function barForm(Schema $form): Schema { return $form - ->schema($this->getSchemaForForms()) + ->components($this->getSchemaForForms()) ->statePath('barData'); } diff --git a/tests/src/Forms/GridTest.php b/tests/src/Forms/GridTest.php index e86bab0a7d..4809b13d88 100644 --- a/tests/src/Forms/GridTest.php +++ b/tests/src/Forms/GridTest.php @@ -7,7 +7,7 @@ use Filament\Tests\TestCase; uses(TestCase::class); -test('can get number of container columns at all breakpoints', function () { +test('can get number of container columns at all breakpoints', function (): void { $schema = Schema::make(Livewire::make()) ->columns([ 'default' => $defaultColumns = rand(1, 12), @@ -28,7 +28,7 @@ test('can get number of container columns at all breakpoints', function () { ->toHaveKey('2xl', $columnsAt2xl); }); -test('can get number of container columns at one breakpoint', function () { +test('can get number of container columns at one breakpoint', function (): void { $schema = Schema::make(Livewire::make()) ->columns([ '2xl' => $columnsAt2xl = rand(1, 12), @@ -38,7 +38,7 @@ test('can get number of container columns at one breakpoint', function () { ->getColumns('2xl')->toBe($columnsAt2xl); }); -test('can get number of container columns from parent component', function () { +test('can get number of container columns from parent component', function (): void { $schema = Schema::make(Livewire::make()) ->parentComponent((new Component)->columns([ 'default' => $defaultColumns = rand(1, 12), @@ -59,7 +59,7 @@ test('can get number of container columns from parent component', function () { ->toHaveKey('2xl', $columnsAt2xl); }); -test('can set number of container columns at `lg` breakpoint', function () { +test('can set number of container columns at `lg` breakpoint', function (): void { $schema = Schema::make(Livewire::make()) ->columns($columnsAtLg = rand(1, 12)); @@ -67,7 +67,7 @@ test('can set number of container columns at `lg` breakpoint', function () { ->getColumns('lg')->toBe($columnsAtLg); }); -test('can get component column span at all breakpoints', function () { +test('can get component column span at all breakpoints', function (): void { $component = (new Component) ->container(Schema::make(Livewire::make())) ->columnSpan([ @@ -89,7 +89,7 @@ test('can get component column span at all breakpoints', function () { ->toHaveKey('2xl', $spanAt2xl); }); -test('can get component column span at one breakpoint', function () { +test('can get component column span at one breakpoint', function (): void { $component = (new Component) ->container(Schema::make(Livewire::make())) ->columnSpan([ @@ -100,7 +100,7 @@ test('can get component column span at one breakpoint', function () { ->getColumnSpan('2xl')->toBe($spanAt2xl); }); -test('can set component column span at `default` breakpoint', function () { +test('can set component column span at `default` breakpoint', function (): void { $component = (new Component) ->container(Schema::make(Livewire::make())) ->columnSpan($defaultSpan = rand(1, 12)); diff --git a/tests/src/Forms/HiddenComponentsTest.php b/tests/src/Forms/HiddenComponentsTest.php index 2cd32013b4..fc6fae7479 100644 --- a/tests/src/Forms/HiddenComponentsTest.php +++ b/tests/src/Forms/HiddenComponentsTest.php @@ -9,7 +9,7 @@ use Illuminate\Support\Str; uses(TestCase::class); -test('components can be hidden', function () { +test('components can be hidden', function (): void { $component = (new Component) ->container(Schema::make(Livewire::make())) ->hidden(); @@ -18,7 +18,7 @@ test('components can be hidden', function () { ->isHidden()->toBeTrue(); }); -test('components can be hidden based on condition', function () { +test('components can be hidden based on condition', function (): void { $statePath = Str::random(); $schema = Schema::make(Livewire::make()) @@ -77,7 +77,7 @@ test('components can be hidden based on condition', function () { ->toHaveLength(1); }); -test('hidden components are not returned from container', function () { +test('hidden components are not returned from container', function (): void { $components = []; foreach (range(1, $visibleCount = rand(2, 10)) as $i) { @@ -102,7 +102,7 @@ test('hidden components are not returned from container', function () { ); }); -test('components can be hidden based on Livewire component', function () { +test('components can be hidden based on Livewire component', function (): void { $components = Schema::make(Foo::make()) ->components([ TextInput::make('foo') @@ -139,7 +139,7 @@ test('components can be hidden based on Livewire component', function () { ->toHaveLength(0); }); -test('components can be visible based on Livewire component', function () { +test('components can be visible based on Livewire component', function (): void { $components = Schema::make(Foo::make()) ->components([ TextInput::make('foo') diff --git a/tests/src/Forms/ModelTest.php b/tests/src/Forms/ModelTest.php index 899ae90225..e522c582db 100644 --- a/tests/src/Forms/ModelTest.php +++ b/tests/src/Forms/ModelTest.php @@ -9,7 +9,7 @@ use Filament\Tests\TestCase; uses(TestCase::class); -test('containers can store a record', function () { +test('containers can store a record', function (): void { $schema = Schema::make(Livewire::make()) ->model($record = new Post); @@ -17,7 +17,7 @@ test('containers can store a record', function () { ->getRecord()->toBe($record); }); -test('containers can get their model class', function () { +test('containers can get their model class', function (): void { $schema = Schema::make(Livewire::make()) ->model($model = Post::class); @@ -30,7 +30,7 @@ test('containers can get their model class', function () { ->getModel()->toBe($model); }); -test('containers can get an instance of their model', function () { +test('containers can get an instance of their model', function (): void { $schema = Schema::make(Livewire::make()) ->model($modelInstance = new Post); @@ -43,7 +43,7 @@ test('containers can get an instance of their model', function () { ->getModelInstance()->toBeInstanceOf($model); }); -test('components can store a record', function () { +test('components can store a record', function (): void { $component = (new Component) ->container(Schema::make(Livewire::make())) ->model($record = new Post); @@ -52,7 +52,7 @@ test('components can store a record', function () { ->getRecord()->toBe($record); }); -test('components can get their model class', function () { +test('components can get their model class', function (): void { $component = (new Component) ->container(Schema::make(Livewire::make())) ->model($model = Post::class); @@ -61,7 +61,7 @@ test('components can get their model class', function () { ->getModel()->toBe($model); }); -test('components can get an instance of their model', function () { +test('components can get an instance of their model', function (): void { $component = (new Component) ->container(Schema::make(Livewire::make())) ->model($model = Post::class); @@ -70,7 +70,7 @@ test('components can get an instance of their model', function () { ->getModelInstance()->toBeInstanceOf($model); }); -test('components can inherit their container record', function () { +test('components can inherit their container record', function (): void { $component = (new Component) ->container( Schema::make(Livewire::make()) @@ -81,7 +81,7 @@ test('components can inherit their container record', function () { ->getRecord()->toBe($record); }); -test('components can inherit their container model class', function () { +test('components can inherit their container model class', function (): void { $component = (new Component) ->container( Schema::make(Livewire::make()) @@ -93,7 +93,7 @@ test('components can inherit their container model class', function () { ->getModelInstance()->toBeInstanceOf($model); }); -test('components do not inherit their container record if they have their own model defined', function () { +test('components do not inherit their container record if they have their own model defined', function (): void { $component = (new Component) ->container( Schema::make(Livewire::make()) diff --git a/tests/src/Forms/RelationshipsTest.php b/tests/src/Forms/RelationshipsTest.php index edc2e0b521..6e418459ef 100644 --- a/tests/src/Forms/RelationshipsTest.php +++ b/tests/src/Forms/RelationshipsTest.php @@ -9,11 +9,11 @@ use Illuminate\Support\Str; uses(TestCase::class); -test('fields can save relationships', function () { +test('fields can save relationships', function (): void { $numberOfRelationshipsSaved = 0; $isFieldVisible = true; - $saveRelationshipsUsing = function () use (&$numberOfRelationshipsSaved) { + $saveRelationshipsUsing = function () use (&$numberOfRelationshipsSaved): void { $numberOfRelationshipsSaved++; }; @@ -49,11 +49,11 @@ test('fields can save relationships', function () { ->toBe(2); }); -test('hidden fields can save relationships when requested', function () { +test('hidden fields can save relationships when requested', function (): void { $numberOfRelationshipsSaved = 0; $shouldSaveRelationships = true; - $saveRelationshipsUsing = function () use (&$numberOfRelationshipsSaved) { + $saveRelationshipsUsing = function () use (&$numberOfRelationshipsSaved): void { $numberOfRelationshipsSaved++; }; diff --git a/tests/src/Forms/StateBindingModifiersTest.php b/tests/src/Forms/StateBindingModifiersTest.php index fd9c6476e5..724f49b608 100644 --- a/tests/src/Forms/StateBindingModifiersTest.php +++ b/tests/src/Forms/StateBindingModifiersTest.php @@ -9,7 +9,7 @@ use Illuminate\Support\Str; uses(TestCase::class); -test('fields can have state binding modifiers', function () { +test('fields can have state binding modifiers', function (): void { $field = (new Field(Str::random())) ->container(Schema::make(Livewire::make())) ->stateBindingModifiers($modifiers = [Str::random(), Str::random()]); @@ -27,14 +27,14 @@ test('fields can have state binding modifiers', function () { ); }); -test('component state binding is deferred by default', function () { +test('component state binding is deferred by default', function (): void { $component = (new Component)->container(Schema::make(Livewire::make())); expect($component) ->getStateBindingModifiers()->toBe([]); }); -test('component state binding can be live', function () { +test('component state binding can be live', function (): void { $component = (new Component) ->container(Schema::make(Livewire::make())) ->live(); @@ -43,7 +43,7 @@ test('component state binding can be live', function () { ->getStateBindingModifiers()->toBe(['live']); }); -test('component state binding can be triggered on blur', function () { +test('component state binding can be triggered on blur', function (): void { $component = (new Component) ->container(Schema::make(Livewire::make())) ->live(onBlur: true); @@ -52,7 +52,7 @@ test('component state binding can be triggered on blur', function () { ->getStateBindingModifiers()->toBe(['blur']); }); -test('component state binding can be debounced', function () { +test('component state binding can be debounced', function (): void { $component = (new Component) ->container(Schema::make(Livewire::make())) ->live(debounce: '750ms'); @@ -61,7 +61,7 @@ test('component state binding can be debounced', function () { ->getStateBindingModifiers()->toBe(['live', 'debounce', '750ms']); }); -test('components inherit their state binding modifiers', function () { +test('components inherit their state binding modifiers', function (): void { $component = (new Component) ->container( Schema::make(Livewire::make()) diff --git a/tests/src/Forms/StateTest.php b/tests/src/Forms/StateTest.php index a829b96fe4..cc9489179c 100644 --- a/tests/src/Forms/StateTest.php +++ b/tests/src/Forms/StateTest.php @@ -14,7 +14,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -test('container has state path', function () { +test('container has state path', function (): void { $schema = Schema::make(Livewire::make()) ->statePath($schemaStatePath = Str::random()); @@ -22,7 +22,7 @@ test('container has state path', function () { ->getStatePath()->toBe($schemaStatePath); }); -test('container has state path and inherits state path from parent component', function () { +test('container has state path and inherits state path from parent component', function (): void { $schema = Schema::make(Livewire::make()) ->parentComponent( (new Component) @@ -35,7 +35,7 @@ test('container has state path and inherits state path from parent component', f ->getStatePath()->toBe("{$parentComponentStatePath}.{$schemaStatePath}"); }); -test('component has state path', function () { +test('component has state path', function (): void { $component = (new Component) ->container(Schema::make(Livewire::make())) ->statePath($componentStatePath = Str::random()); @@ -44,7 +44,7 @@ test('component has state path', function () { ->getStatePath()->toBe($componentStatePath); }); -test('component inherits state path from container', function () { +test('component inherits state path from container', function (): void { $component = (new Component) ->container( Schema::make(Livewire::make()) @@ -55,7 +55,7 @@ test('component inherits state path from container', function () { ->getStatePath()->toBe($schemaStatePath); }); -test('component has state path and inherits state path from container', function () { +test('component has state path and inherits state path from container', function (): void { $component = (new Component) ->container( Schema::make(Livewire::make()) @@ -67,7 +67,7 @@ test('component has state path and inherits state path from container', function ->getStatePath()->toBe("{$schemaStatePath}.{$componentStatePath}"); }); -test('state can be hydrated from array', function () { +test('state can be hydrated from array', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -80,7 +80,7 @@ test('state can be hydrated from array', function () { ->getData()->toBe([$statePath => $state]); }); -test('hydrating array state can overwrite existing state', function () { +test('hydrating array state can overwrite existing state', function (): void { $statePath = Str::random(); Schema::make( @@ -100,7 +100,7 @@ test('hydrating array state can overwrite existing state', function () { ->getData()->toBe([$statePath => null]); }); -test('state can be hydrated from defaults', function () { +test('state can be hydrated from defaults', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -114,7 +114,7 @@ test('state can be hydrated from defaults', function () { ->getData()->toBe([$statePath => $state]); }); -test('hydrating default state can overwrite existing state', function () { +test('hydrating default state can overwrite existing state', function (): void { $statePath = Str::random(); Schema::make( @@ -134,7 +134,7 @@ test('hydrating default state can overwrite existing state', function () { ->getData()->toBe([$statePath => null]); }); -test('child component state is not lost by hydrating parent component', function () { +test('child component state is not lost by hydrating parent component', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -152,7 +152,7 @@ test('child component state is not lost by hydrating parent component', function ->getData()->toBe([$parentStatePath => [$statePath => $state]]); }); -test('child component state is not lost by hydrating parent component defaults', function () { +test('child component state is not lost by hydrating parent component defaults', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -171,7 +171,7 @@ test('child component state is not lost by hydrating parent component defaults', ->getData()->toBe([$parentStatePath => [$statePath => $state]]); }); -test('child component state can be hydrated by parent component defaults', function () { +test('child component state can be hydrated by parent component defaults', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -189,7 +189,7 @@ test('child component state can be hydrated by parent component defaults', funct ->getData()->toBe([$parentStatePath => [$statePath => $state]]); }); -test('child component defaults are overwritten by parent component defaults', function () { +test('child component defaults are overwritten by parent component defaults', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -208,7 +208,7 @@ test('child component defaults are overwritten by parent component defaults', fu ->getData()->toBe([$parentStatePath => [$statePath => $state]]); }); -test('missing child component state can be filled with null', function () { +test('missing child component state can be filled with null', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -225,7 +225,7 @@ test('missing child component state can be filled with null', function () { ->getData()->toBe([$parentStatePath => [$statePath => null]]); }); -test('missing hidden child component state can be filled with null', function () { +test('missing hidden child component state can be filled with null', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -241,7 +241,7 @@ test('missing hidden child component state can be filled with null', function () ->getData()->toBe([$statePath => null]); }); -test('custom logic can be executed after state is hydrated', function () { +test('custom logic can be executed after state is hydrated', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -255,7 +255,7 @@ test('custom logic can be executed after state is hydrated', function () { ->getData()->toBe([$statePath => strrev($value)]); }); -test('state can be hydrated partially', function () { +test('state can be hydrated partially', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -280,7 +280,7 @@ test('state can be hydrated partially', function () { ]); }); -test('child state can be hydrated partially', function () { +test('child state can be hydrated partially', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -315,7 +315,7 @@ test('child state can be hydrated partially', function () { ]); }); -test('custom logic can be executed after state hydrated partially, only for components that are hydrated partially', function () { +test('custom logic can be executed after state hydrated partially, only for components that are hydrated partially', function (): void { $schema = Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -349,7 +349,7 @@ test('custom logic can be executed after state hydrated partially, only for comp ]); }); -test('custom logic can be executed after state is updated', function () { +test('custom logic can be executed after state is updated', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -364,7 +364,7 @@ test('custom logic can be executed after state is updated', function () { ->getData()->toBe([$statePath => strrev($state)]); }); -test('custom logic can be executed after nested state is updated', function () { +test('custom logic can be executed after nested state is updated', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -379,7 +379,7 @@ test('custom logic can be executed after nested state is updated', function () { ->getData()->toBe([$statePath => [strrev($state)]]); }); -test('custom logic can be executed after child component state is updated', function () { +test('custom logic can be executed after child component state is updated', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -398,7 +398,7 @@ test('custom logic can be executed after child component state is updated', func ->getData()->toBe([$statePath => [$childComponentStatePath => strrev($state)]]); }); -test('custom logic can be executed only once after nested state is updated', function () { +test('custom logic can be executed only once after nested state is updated', function (): void { $calls = 0; Schema::make($livewire = Livewire::make()) @@ -406,7 +406,7 @@ test('custom logic can be executed only once after nested state is updated', fun ->components([ (new Component) ->statePath($statePath = Str::random()) - ->afterStateUpdated(function () use (&$calls) { + ->afterStateUpdated(function () use (&$calls): void { $calls++; }), ]) @@ -416,7 +416,7 @@ test('custom logic can be executed only once after nested state is updated', fun expect($calls)->toEqual(1); }); -test('custom logic can be executed more than once after nested state is updated if the state changes', function () { +test('custom logic can be executed more than once after nested state is updated if the state changes', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -432,7 +432,7 @@ test('custom logic can be executed more than once after nested state is updated ->getData()->toBe([$statePath => [2]]); }); -test('custom logic on parent component can be executed after child component state is updated', function () { +test('custom logic on parent component can be executed after child component state is updated', function (): void { Schema::make($livewire = Livewire::make()) ->statePath('data') ->components([ @@ -453,7 +453,7 @@ test('custom logic on parent component can be executed after child component sta ->getData()->toBe([$statePath => [$childComponentStatePath => strrev($state)]]); }); -test('state can be dehydrated', function () { +test('state can be dehydrated', function (): void { $schema = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -469,7 +469,7 @@ test('state can be dehydrated', function () { ]); }); -test('state can be dehydrated using custom logic', function () { +test('state can be dehydrated using custom logic', function (): void { $schema = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -486,7 +486,7 @@ test('state can be dehydrated using custom logic', function () { ]); }); -test('custom logic can be executed before state is dehydrated', function () { +test('custom logic can be executed before state is dehydrated', function (): void { $schema = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -505,7 +505,7 @@ test('custom logic can be executed before state is dehydrated', function () { ]); }); -test('components can be excluded from state dehydration', function () { +test('components can be excluded from state dehydration', function (): void { $schema = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -520,7 +520,7 @@ test('components can be excluded from state dehydration', function () { ->dehydrateState()->toBe([]); }); -test('components can be excluded from state dehydration if their parent component is', function () { +test('components can be excluded from state dehydration if their parent component is', function (): void { $schema = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -538,7 +538,7 @@ test('components can be excluded from state dehydration if their parent componen ->dehydrateState()->toBe([]); }); -test('hidden components are excluded from state dehydration', function () { +test('hidden components are excluded from state dehydration', function (): void { $schema = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -553,7 +553,7 @@ test('hidden components are excluded from state dehydration', function () { ->dehydrateState()->toBe([]); }); -test('hidden components are excluded from state dehydration if their parent component is', function () { +test('hidden components are excluded from state dehydration if their parent component is', function (): void { $schema = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -571,7 +571,7 @@ test('hidden components are excluded from state dehydration if their parent comp ->dehydrateState()->toBe([]); }); -test('hidden components are excluded from state dehydration except if they are marked as dehydrated', function () { +test('hidden components are excluded from state dehydration except if they are marked as dehydrated', function (): void { $schema = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -606,7 +606,7 @@ test('hidden components are excluded from state dehydration except if they are m ->dehydrateState()->not()->toBe([]); }); -test('disabled components are excluded from state dehydration', function () { +test('disabled components are excluded from state dehydration', function (): void { $schema = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -621,7 +621,7 @@ test('disabled components are excluded from state dehydration', function () { ->dehydrateState()->toBe([]); }); -test('disabled components are excluded from state dehydration if their parent component is', function () { +test('disabled components are excluded from state dehydration if their parent component is', function (): void { $schema = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -639,7 +639,7 @@ test('disabled components are excluded from state dehydration if their parent co ->dehydrateState()->toBe([]); }); -test('disabled components are excluded from state dehydration except if they are marked as dehydrated', function () { +test('disabled components are excluded from state dehydration except if they are marked as dehydrated', function (): void { $schema = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -655,7 +655,7 @@ test('disabled components are excluded from state dehydration except if they are ->dehydrateState()->not()->toBe([]); }); -test('disabled components are excluded from state dehydration if their parent component is disabled and not marked as dehydrated', function () { +test('disabled components are excluded from state dehydration if their parent component is disabled and not marked as dehydrated', function (): void { $schema = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -674,7 +674,7 @@ test('disabled components are excluded from state dehydration if their parent co ->dehydrateState()->toBe([]); }); -test('dehydrated state can be mutated', function () { +test('dehydrated state can be mutated', function (): void { $schema = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -693,7 +693,7 @@ test('dehydrated state can be mutated', function () { ]); }); -test('sibling state can be retrieved relatively from another component', function () { +test('sibling state can be retrieved relatively from another component', function (): void { Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -709,7 +709,7 @@ test('sibling state can be retrieved relatively from another component', functio ->getContent()->toBe($state); }); -test('sibling nested state can be retrieved relatively from another component', function () { +test('sibling nested state can be retrieved relatively from another component', function (): void { Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -729,7 +729,7 @@ test('sibling nested state can be retrieved relatively from another component', ->getContent()->toBe($state); }); -test('parent sibling state can be retrieved relatively from another component', function () { +test('parent sibling state can be retrieved relatively from another component', function (): void { Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -749,7 +749,7 @@ test('parent sibling state can be retrieved relatively from another component', ->getContent()->toBe($state); }); -test('sibling state can be retrieved absolutely from another component', function () { +test('sibling state can be retrieved absolutely from another component', function (): void { Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -765,7 +765,7 @@ test('sibling state can be retrieved absolutely from another component', functio ->getContent()->toBe($state); }); -test('sibling nested state can be retrieved absolutely from another component', function () { +test('sibling nested state can be retrieved absolutely from another component', function (): void { Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -785,7 +785,7 @@ test('sibling nested state can be retrieved absolutely from another component', ->getContent()->toBe($state); }); -test('parent sibling state can be retrieved absolutely from another component', function () { +test('parent sibling state can be retrieved absolutely from another component', function (): void { Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -805,13 +805,13 @@ test('parent sibling state can be retrieved absolutely from another component', ->getContent()->toBe($state); }); -test('components can set their own state after they are hydrated', function () { +test('components can set their own state after they are hydrated', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ TextInput::make('foo') ->afterStateHydrated(fn (TextInput $component) => $component->state('bar')), ]) @@ -823,13 +823,13 @@ test('components can set their own state after they are hydrated', function () { ]); }); -test('components can set their own state after they are updated', function () { +test('components can set their own state after they are updated', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ TextInput::make('foo') ->afterStateUpdated(fn (TextInput $component) => $component->state('bar')), ]) @@ -844,13 +844,13 @@ test('components can set their own state after they are updated', function () { ]); }); -test('components can inject their own state after they are updated', function () { +test('components can inject their own state after they are updated', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ TextInput::make('foo') ->afterStateUpdated(fn (TextInput $component, $state) => $component->state(strrev($state))), ]) @@ -865,13 +865,13 @@ test('components can inject their own state after they are updated', function () ]); }); -test('components can get their own state from the component object', function () { +test('components can get their own state from the component object', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ TextInput::make('foo') ->afterStateUpdated(fn (TextInput $component) => $component->state(strrev($component->getState()))), ]) @@ -886,13 +886,13 @@ test('components can get their own state from the component object', function () ]); }); -test('layout components can get their state from the component object', function () { +test('layout components can get their state from the component object', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ Section::make(fn (Section $component) => 'Heading ' . ($component->getState()['foo'] ?? null)) ->schema([ TextInput::make('foo'), @@ -907,7 +907,7 @@ test('layout components can get their state from the component object', function ->assertSeeText('Heading ' . $state); }); -test('components can inject their old state after it is updated', function () { +test('components can inject their old state after it is updated', function (): void { livewire(new class extends Livewire { public $storedOldState = null; @@ -915,7 +915,7 @@ test('components can inject their old state after it is updated', function () { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ TextInput::make('foo') ->afterStateUpdated(fn ($old) => $this->storedOldState = $old), ]) diff --git a/tests/src/Forms/Utilities/GetTest.php b/tests/src/Forms/Utilities/GetTest.php index ccff1453ed..658660333a 100644 --- a/tests/src/Forms/Utilities/GetTest.php +++ b/tests/src/Forms/Utilities/GetTest.php @@ -12,13 +12,13 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can get the value of a field', function () { +it('can get the value of a field', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ TextInput::make('foo') ->live(), TextInput::make('bar') @@ -33,13 +33,13 @@ it('can get the value of a field', function () { ->assertSeeText("Label {$foo}"); }); -it('can get the value of a nested field', function () { +it('can get the value of a nested field', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ Section::make() ->statePath('nested') ->schema([ @@ -58,13 +58,13 @@ it('can get the value of a nested field', function () { ->assertSeeText("Label {$foo}"); }); -it('can get the value from a parent level field', function () { +it('can get the value from a parent level field', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ TextInput::make('foo') ->live(), Section::make() @@ -83,13 +83,13 @@ it('can get the value from a parent level field', function () { ->assertSeeText("Label {$foo}"); }); -it('can get the value from a parent level field with a nested field', function () { +it('can get the value from a parent level field with a nested field', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ Section::make() ->statePath('nestedOne') ->schema([ diff --git a/tests/src/Forms/Utilities/SetTest.php b/tests/src/Forms/Utilities/SetTest.php index 60790e5653..1e93238d5b 100644 --- a/tests/src/Forms/Utilities/SetTest.php +++ b/tests/src/Forms/Utilities/SetTest.php @@ -12,13 +12,13 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can set the value of a field', function () { +it('can set the value of a field', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ TextInput::make('foo'), TextInput::make('bar') ->live() @@ -35,13 +35,13 @@ it('can set the value of a field', function () { ]); }); -it('can set the value of a field and call its updated hook', function () { +it('can set the value of a field and call its updated hook', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ TextInput::make('foo') ->afterStateUpdated(fn (Set $set) => $set('baz', 'qux')), TextInput::make('bar') @@ -60,13 +60,13 @@ it('can set the value of a field and call its updated hook', function () { ]); }); -it('can set the value of a nested field', function () { +it('can set the value of a nested field', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ Section::make() ->statePath('nested') ->schema([ @@ -87,13 +87,13 @@ it('can set the value of a nested field', function () { ]); }); -it('can set the value of a parent level field', function () { +it('can set the value of a parent level field', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ TextInput::make('foo'), Section::make() ->statePath('nested') @@ -114,13 +114,13 @@ it('can set the value of a parent level field', function () { ]); }); -it('can set the value of a parent level field with a nested field', function () { +it('can set the value of a parent level field with a nested field', function (): void { livewire(new class extends Livewire { public function form(Schema $form): Schema { return $form - ->schema([ + ->components([ Section::make() ->statePath('nestedOne') ->schema([ diff --git a/tests/src/Forms/ValidationTest.php b/tests/src/Forms/ValidationTest.php index 7870100df1..eea81901a7 100644 --- a/tests/src/Forms/ValidationTest.php +++ b/tests/src/Forms/ValidationTest.php @@ -11,7 +11,7 @@ use Illuminate\Validation\ValidationException; uses(TestCase::class); -test('fields can be required', function () { +test('fields can be required', function (): void { $rules = []; try { @@ -30,7 +30,7 @@ test('fields can be required', function () { ->toContain('Required'); }); -test('fields use custom validation rules', function () { +test('fields use custom validation rules', function (): void { $rules = []; try { @@ -51,7 +51,7 @@ test('fields use custom validation rules', function () { ->toContain('Email'); }); -test('fields can be conditionally validated', function () { +test('fields can be conditionally validated', function (): void { $rules = []; try { @@ -75,7 +75,7 @@ test('fields can be conditionally validated', function () { } }); -test('fields are validated if they are not dehydrated', function () { +test('fields are validated if they are not dehydrated', function (): void { $rules = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -89,7 +89,7 @@ test('fields are validated if they are not dehydrated', function () { ->not->toBeEmpty(); }); -test('fields are not validated if they are not dehydrated and configured as such', function () { +test('fields are not validated if they are not dehydrated and configured as such', function (): void { $rules = Schema::make(Livewire::make()) ->statePath('data') ->components([ @@ -117,7 +117,7 @@ test('fields are not validated if they are not dehydrated and configured as such ->not->toBeEmpty(); }); -test('fields can be required if', function () { +test('fields can be required if', function (): void { $rules = []; $errors = []; @@ -144,7 +144,7 @@ test('fields can be required if', function () { ->toContain('The two field is required when one is foo.'); }); -test('fields can be required unless', function () { +test('fields can be required unless', function (): void { $rules = []; $errors = []; @@ -171,7 +171,7 @@ test('fields can be required unless', function () { ->toContain('The two field is required unless one is in foo.'); }); -test('the `in()` rule behaves the same as Laravel\'s', function (?string $input, array | Arrayable | string | Closure $allowed) { +test('the `in()` rule behaves the same as Laravel\'s', function (?string $input, array | Arrayable | string | Closure $allowed): void { $filamentFails = []; $laravelFails = []; @@ -271,7 +271,7 @@ test('the `in()` rule behaves the same as Laravel\'s', function (?string $input, ], ]); -test('the `in()` rule can be conditionally validated', function () { +test('the `in()` rule can be conditionally validated', function (): void { $fails = []; $fieldName = Str::random(); @@ -292,7 +292,7 @@ test('the `in()` rule can be conditionally validated', function () { ->toBeEmpty(); }); -test('the `notIn()` rule behaves the same as Laravel\'s', function (?string $input, array | Arrayable | string | Closure $allowed) { +test('the `notIn()` rule behaves the same as Laravel\'s', function (?string $input, array | Arrayable | string | Closure $allowed): void { $filamentFails = []; $laravelFails = []; @@ -396,7 +396,7 @@ test('the `notIn()` rule behaves the same as Laravel\'s', function (?string $inp ], ]); -test('the `notIn()` rule can be conditionally validated', function () { +test('the `notIn()` rule can be conditionally validated', function (): void { $fails = []; $fieldName = Str::random(); @@ -417,7 +417,7 @@ test('the `notIn()` rule can be conditionally validated', function () { ->toBeEmpty(); }); -test('the `startsWith()` rule behaves the same as Laravel\'s', function (?string $input, array | Arrayable | string | Closure $allowed) { +test('the `startsWith()` rule behaves the same as Laravel\'s', function (?string $input, array | Arrayable | string | Closure $allowed): void { $filamentFails = []; $laravelFails = []; @@ -530,7 +530,7 @@ test('the `startsWith()` rule behaves the same as Laravel\'s', function (?string ], ]); -test('the `startsWith()` rule can be conditionally validated', function () { +test('the `startsWith()` rule can be conditionally validated', function (): void { $fails = []; $fieldName = Str::random(); @@ -551,7 +551,7 @@ test('the `startsWith()` rule can be conditionally validated', function () { ->toBeEmpty(); }); -test('the `doesntStartWith()` rule behaves the same as Laravel\'s', function (?string $input, array | Arrayable | string | Closure $allowed) { +test('the `doesntStartWith()` rule behaves the same as Laravel\'s', function (?string $input, array | Arrayable | string | Closure $allowed): void { $filamentFails = []; $laravelFails = []; @@ -664,7 +664,7 @@ test('the `doesntStartWith()` rule behaves the same as Laravel\'s', function (?s ], ]); -test('the `doesntStartWith()` rule can be conditionally validated', function () { +test('the `doesntStartWith()` rule can be conditionally validated', function (): void { $fails = []; $fieldName = Str::random(); @@ -685,7 +685,7 @@ test('the `doesntStartWith()` rule can be conditionally validated', function () ->toBeEmpty(); }); -test('the `endsWith()` rule behaves the same as Laravel\'s', function (?string $input, array | Arrayable | string | Closure $allowed) { +test('the `endsWith()` rule behaves the same as Laravel\'s', function (?string $input, array | Arrayable | string | Closure $allowed): void { $filamentFails = []; $laravelFails = []; @@ -798,7 +798,7 @@ test('the `endsWith()` rule behaves the same as Laravel\'s', function (?string $ ], ]); -test('the `endsWith()` rule can be conditionally validated', function () { +test('the `endsWith()` rule can be conditionally validated', function (): void { $fails = []; $fieldName = Str::random(); @@ -819,7 +819,7 @@ test('the `endsWith()` rule can be conditionally validated', function () { ->toBeEmpty(); }); -test('the `doesntEndWith()` rule behaves the same as Laravel\'s', function (?string $input, array | Arrayable | string | Closure $allowed) { +test('the `doesntEndWith()` rule behaves the same as Laravel\'s', function (?string $input, array | Arrayable | string | Closure $allowed): void { $filamentFails = []; $laravelFails = []; @@ -932,7 +932,7 @@ test('the `doesntEndWith()` rule behaves the same as Laravel\'s', function (?str ], ]); -test('the `doesntEndWith()` rule can be conditionally validated', function () { +test('the `doesntEndWith()` rule can be conditionally validated', function (): void { $fails = []; $fieldName = Str::random(); diff --git a/tests/src/Infolists/ActionTest.php b/tests/src/Infolists/ActionTest.php index 9979cabe77..678e964712 100644 --- a/tests/src/Infolists/ActionTest.php +++ b/tests/src/Infolists/ActionTest.php @@ -11,7 +11,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can call an action with data', function () { +it('can call an action with data', function (): void { livewire(InfolistActions::class) ->callAction(TestAction::make('setValue')->schemaComponent('infolist.textEntry'), data: [ 'value' => $value = Str::random(), @@ -25,7 +25,7 @@ it('can call an action with data', function () { ->assertDispatched('foo', $value); }); -it('can validate an action\'s data', function () { +it('can validate an action\'s data', function (): void { livewire(InfolistActions::class) ->callAction(TestAction::make('setValue')->schemaComponent('infolist.textEntry'), data: [ 'value' => null, @@ -41,7 +41,7 @@ it('can validate an action\'s data', function () { ->assertNotDispatched('foo'); }); -it('can set default action data when mounted', function () { +it('can set default action data when mounted', function (): void { livewire(InfolistActions::class) ->mountAction(TestAction::make('setValue')->schemaComponent('infolist.textEntry')) ->assertActionDataSet([ @@ -55,7 +55,7 @@ it('can set default action data when mounted', function () { ]); }); -it('can call an action with arguments', function () { +it('can call an action with arguments', function (): void { livewire(InfolistActions::class) ->callAction(TestAction::make('setValueFromArguments')->schemaComponent('infolist.textEntry')->arguments([ 'value' => $value = Str::random(), @@ -69,7 +69,7 @@ it('can call an action with arguments', function () { ->assertDispatched('foo', $value); }); -it('can call an action and halt', function () { +it('can call an action and halt', function (): void { livewire(InfolistActions::class) ->callAction(TestAction::make('halt')->schemaComponent('infolist.textEntry')) ->assertActionHalted(TestAction::make('halt')->schemaComponent('infolist.textEntry')); @@ -79,7 +79,7 @@ it('can call an action and halt', function () { ->assertInfolistActionHalted('textEntry', 'halt'); }); -it('can hide an action', function () { +it('can hide an action', function (): void { livewire(InfolistActions::class) ->assertActionVisible(TestAction::make('visible')->schemaComponent('infolist.textEntry')) ->assertActionHidden(TestAction::make('hidden')->schemaComponent('infolist.textEntry')) @@ -93,7 +93,7 @@ it('can hide an action', function () { ->assertInfolistActionHidden('textEntry', 'hidden'); }); -it('can disable an action', function () { +it('can disable an action', function (): void { livewire(InfolistActions::class) ->assertActionEnabled(TestAction::make('enabled')->schemaComponent('infolist.textEntry')) ->assertActionDisabled(TestAction::make('disabled')->schemaComponent('infolist.textEntry')); @@ -103,7 +103,7 @@ it('can disable an action', function () { ->assertInfolistActionDisabled('textEntry', 'disabled'); }); -it('can have an icon', function () { +it('can have an icon', function (): void { livewire(InfolistActions::class) ->assertActionHasIcon(TestAction::make('hasIcon')->schemaComponent('infolist.textEntry'), Heroicon::PencilSquare) ->assertActionDoesNotHaveIcon(TestAction::make('hasIcon')->schemaComponent('infolist.textEntry'), Heroicon::Trash); @@ -113,7 +113,7 @@ it('can have an icon', function () { ->assertInfolistActionDoesNotHaveIcon('textEntry', 'hasIcon', Heroicon::Trash); }); -it('can have a label', function () { +it('can have a label', function (): void { livewire(InfolistActions::class) ->assertActionHasLabel(TestAction::make('hasLabel')->schemaComponent('infolist.textEntry'), 'My Action') ->assertActionDoesNotHaveLabel(TestAction::make('hasLabel')->schemaComponent('infolist.textEntry'), 'My Other Action'); @@ -123,7 +123,7 @@ it('can have a label', function () { ->assertInfolistActionDoesNotHaveLabel('textEntry', 'hasLabel', 'My Other Action'); }); -it('can have a color', function () { +it('can have a color', function (): void { livewire(InfolistActions::class) ->assertActionHasColor(TestAction::make('hasColor')->schemaComponent('infolist.textEntry'), 'primary') ->assertActionDoesNotHaveColor(TestAction::make('hasColor')->schemaComponent('infolist.textEntry'), 'gray'); @@ -133,7 +133,7 @@ it('can have a color', function () { ->assertInfolistActionDoesNotHaveColor('textEntry', 'hasColor', 'gray'); }); -it('can have a URL', function () { +it('can have a URL', function (): void { livewire(InfolistActions::class) ->assertActionHasUrl(TestAction::make('url')->schemaComponent('infolist.textEntry'), 'https://filamentphp.com') ->assertActionDoesNotHaveUrl(TestAction::make('url')->schemaComponent('infolist.textEntry'), 'https://google.com'); @@ -143,7 +143,7 @@ it('can have a URL', function () { ->assertInfolistActionDoesNotHaveUrl('textEntry', 'url', 'https://google.com'); }); -it('can open a URL in a new tab', function () { +it('can open a URL in a new tab', function (): void { livewire(InfolistActions::class) ->assertActionShouldOpenUrlInNewTab(TestAction::make('urlInNewTab')->schemaComponent('infolist.textEntry')) ->assertActionShouldNotOpenUrlInNewTab(TestAction::make('urlNotInNewTab')->schemaComponent('infolist.textEntry')); @@ -153,7 +153,7 @@ it('can open a URL in a new tab', function () { ->assertInfolistActionShouldNotOpenUrlInNewTab('textEntry', 'urlNotInNewTab'); }); -it('can state whether a form component action exists', function () { +it('can state whether a form component action exists', function (): void { livewire(InfolistActions::class) ->assertActionExists(TestAction::make('exists')->schemaComponent('infolist.textEntry')) ->assertActionDoesNotExist(TestAction::make('doesNotExist')->schemaComponent('infolist.textEntry')); diff --git a/tests/src/Infolists/EntryTest.php b/tests/src/Infolists/EntryTest.php index e47902c368..13a4c20fe9 100644 --- a/tests/src/Infolists/EntryTest.php +++ b/tests/src/Infolists/EntryTest.php @@ -5,14 +5,14 @@ use Filament\Tests\Tables\TestCase; uses(TestCase::class); -it('can be instantiated with a default name', function () { +it('can be instantiated with a default name', function (): void { $entry = IdEntry::make(); expect($entry->getName()) ->toBe('id'); }); -test('can ignore the default name if another is specified', function () { +test('can ignore the default name if another is specified', function (): void { $entry = IdEntry::make('identifier'); expect($entry->getName()) diff --git a/tests/src/Infolists/LivewireTest.php b/tests/src/Infolists/LivewireTest.php index 12bb228e1e..f9f9945edb 100644 --- a/tests/src/Infolists/LivewireTest.php +++ b/tests/src/Infolists/LivewireTest.php @@ -11,7 +11,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can evaluate livewire closure dependency by name', function () { +it('can evaluate livewire closure dependency by name', function (): void { livewire(LivewireInfolists::class) ->assertOk() ->assertSee('First Entry Label') @@ -45,7 +45,7 @@ class LivewireInfolists extends Component implements HasSchemas { return $schema ->state($this->data) - ->schema(function (self $livewire) { + ->components(function (self $livewire) { expect($livewire)->toBe($this); return [ @@ -59,7 +59,7 @@ class LivewireInfolists extends Component implements HasSchemas { return $schema ->state($this->data) - ->schema(function (self $livewire) { + ->components(function (self $livewire) { expect($livewire)->toBe($this); return [ diff --git a/tests/src/Notifications/NotificationTest.php b/tests/src/Notifications/NotificationTest.php index d335efe53b..1dbbfa877c 100644 --- a/tests/src/Notifications/NotificationTest.php +++ b/tests/src/Notifications/NotificationTest.php @@ -17,12 +17,12 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can render', function () { +it('can render', function (): void { livewire(Notifications::class) ->assertSeeHtml('notifications'); }); -it('can send notifications', function () { +it('can send notifications', function (): void { $iconSets = app(Factory::class)->all(); $icons = app(IconsManifest::class)->getManifest($iconSets); @@ -158,7 +158,7 @@ it('can send notifications', function () { ->toBeEmpty(); }); -it('can close notifications', function () { +it('can close notifications', function (): void { ($notification = Notification::make())->send(); $component = livewire(Notifications::class); @@ -181,7 +181,7 @@ function getLastNotificationAction() return $notifications->first()->getActions()[0]; } -it('can dispatch an event', function () { +it('can dispatch an event', function (): void { $action = Action::make('action')->dispatch('an_event'); expect($action->getLivewireClickHandler())->toBe("\$dispatch('an_event')"); @@ -195,7 +195,7 @@ it('can dispatch an event', function () { expect(getLastNotificationAction()->getLivewireClickHandler())->toBe("\$dispatch('an_event', JSON.parse('[\\u0022data\\u0022]'))"); }); -it('can dispatch an event to itself', function () { +it('can dispatch an event to itself', function (): void { $action = Action::make('action')->dispatchSelf('an_event'); expect($action->getLivewireClickHandler())->toBe("\$dispatchSelf('an_event')"); @@ -209,7 +209,7 @@ it('can dispatch an event to itself', function () { expect(getLastNotificationAction()->getLivewireClickHandler())->toBe("\$dispatchSelf('an_event', JSON.parse('[\\u0022data\\u0022]'))"); }); -it('can dispatch an event to a component', function () { +it('can dispatch an event to a component', function (): void { $action = Action::make('action')->dispatchTo('a_component', 'an_event'); expect($action->getLivewireClickHandler())->toBe("\$dispatchTo('a_component', 'an_event')"); @@ -223,7 +223,7 @@ it('can dispatch an event to a component', function () { expect(getLastNotificationAction()->getLivewireClickHandler())->toBe("\$dispatchTo('a_component', 'an_event', JSON.parse('[\\u0022data\\u0022]'))"); }); -it('can bind custom notification object', function () { +it('can bind custom notification object', function (): void { app()->bind(Notification::class, CustomNotification::class); $notification = Notification::make(); @@ -232,7 +232,7 @@ it('can bind custom notification object', function () { ->toBeInstanceOf(CustomNotification::class); }); -it('can resolve custom notification object from data', function () { +it('can resolve custom notification object from data', function (): void { app()->bind(Notification::class, CustomNotification::class); Notification::make() diff --git a/tests/src/Panels/Auth/EditProfileTest.php b/tests/src/Panels/Auth/EditProfileTest.php index 1d887a9e78..4ae6225ac6 100644 --- a/tests/src/Panels/Auth/EditProfileTest.php +++ b/tests/src/Panels/Auth/EditProfileTest.php @@ -14,18 +14,18 @@ use function Filament\Tests\livewire; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { $this->user = User::factory()->create(); $this->actingAs($this->user); }); -it('can render page', function () { +it('can render page', function (): void { $this->get(Filament::getProfileUrl()) ->assertSuccessful(); }); -it('can retrieve data', function () { +it('can retrieve data', function (): void { livewire(EditProfile::class) ->assertFormSet([ 'name' => $this->user->name, @@ -33,7 +33,7 @@ it('can retrieve data', function () { ]); }); -it('can save name', function () { +it('can save name', function (): void { $newUserData = User::factory()->make(); livewire(EditProfile::class) @@ -48,7 +48,7 @@ it('can save name', function () { ->name->toBe($newUserData->name); }); -it('can save email', function () { +it('can save email', function (): void { Filament::getCurrentOrDefaultPanel()->emailChangeVerification(false); $newUserData = User::factory()->make(); @@ -66,7 +66,7 @@ it('can save email', function () { ->email->toBe($newUserData->email); }); -it('can send email change verification', function () { +it('can send email change verification', function (): void { Notification::fake(); Filament::getCurrentOrDefaultPanel()->emailChangeVerification(); @@ -105,7 +105,7 @@ it('can send email change verification', function () { }); }); -it('can save password', function () { +it('can save password', function (): void { expect(Filament::auth()->attempt([ 'email' => $this->user->email, 'password' => 'password', @@ -138,7 +138,7 @@ it('can save password', function () { ]))->toBeTrue(); }); -it('can validate', function (array $formData, array $errors) { +it('can validate', function (array $formData, array $errors): void { Filament::getCurrentOrDefaultPanel()->emailChangeVerification(false); livewire(EditProfile::class) diff --git a/tests/src/Panels/Auth/EmailVerification/EmailChangeVerification/BlockEmailChangeVerificationTest.php b/tests/src/Panels/Auth/EmailVerification/EmailChangeVerification/BlockEmailChangeVerificationTest.php index 58fe7166ca..a3eda6ce91 100644 --- a/tests/src/Panels/Auth/EmailVerification/EmailChangeVerification/BlockEmailChangeVerificationTest.php +++ b/tests/src/Panels/Auth/EmailVerification/EmailChangeVerification/BlockEmailChangeVerificationTest.php @@ -8,7 +8,7 @@ use League\Uri\Components\Query; uses(TestCase::class); -it('can block an email change', function () { +it('can block an email change', function (): void { $userToVerify = User::factory()->create(); $newEmail = fake()->email; @@ -44,7 +44,7 @@ it('can block an email change', function () { ->email->not->toBe($newEmail); }); -it('cannot block an email change when signed in as another user', function () { +it('cannot block an email change when signed in as another user', function (): void { $userToVerify = User::factory()->create(); $newEmail = fake()->email; @@ -71,7 +71,7 @@ it('cannot block an email change when signed in as another user', function () { ->email->toBe($newEmail); }); -it('cannot block an email change once it has been verified', function () { +it('cannot block an email change once it has been verified', function (): void { $userToVerify = User::factory()->create(); $newEmail = fake()->email; diff --git a/tests/src/Panels/Auth/EmailVerification/EmailChangeVerification/VerifyEmailChangeTest.php b/tests/src/Panels/Auth/EmailVerification/EmailChangeVerification/VerifyEmailChangeTest.php index 4fd17a8db8..d0145b19ff 100644 --- a/tests/src/Panels/Auth/EmailVerification/EmailChangeVerification/VerifyEmailChangeTest.php +++ b/tests/src/Panels/Auth/EmailVerification/EmailChangeVerification/VerifyEmailChangeTest.php @@ -8,7 +8,7 @@ use League\Uri\Components\Query; uses(TestCase::class); -it('can verify an email change', function () { +it('can verify an email change', function (): void { $userToVerify = User::factory()->create(); $newEmail = fake()->email; @@ -31,7 +31,7 @@ it('can verify an email change', function () { ->email->toBe($newEmail); }); -it('can verify an email with a custom slug', function () { +it('can verify an email with a custom slug', function (): void { Filament::setCurrentPanel('slugs'); $userToVerify = User::factory()->create(); @@ -55,7 +55,7 @@ it('can verify an email with a custom slug', function () { ->email->toBe($newEmail); }); -it('cannot verify an email when signed in as another user', function () { +it('cannot verify an email when signed in as another user', function (): void { $userToVerify = User::factory()->create(); $newEmail = fake()->email; @@ -78,7 +78,7 @@ it('cannot verify an email when signed in as another user', function () { ->email->not->toBe($newEmail); }); -it('cannot verify an email change with the same URL twice', function () { +it('cannot verify an email change with the same URL twice', function (): void { $userToVerify = User::factory()->create(); $newEmail = fake()->email; diff --git a/tests/src/Panels/Auth/EmailVerification/EmailVerificationPromptTest.php b/tests/src/Panels/Auth/EmailVerification/EmailVerificationPromptTest.php index 444c28ffbe..760a5bcc61 100644 --- a/tests/src/Panels/Auth/EmailVerification/EmailVerificationPromptTest.php +++ b/tests/src/Panels/Auth/EmailVerification/EmailVerificationPromptTest.php @@ -11,7 +11,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can render page', function () { +it('can render page', function (): void { $userToVerify = User::factory()->create([ 'email_verified_at' => null, ]); @@ -24,7 +24,7 @@ it('can render page', function () { ->assertSuccessful(); }); -it('can render page with a custom slug', function () { +it('can render page with a custom slug', function (): void { Filament::setCurrentPanel('slugs'); expect(Filament::getEmailVerificationPromptUrl())->toEndWith('/email-verification-test/prompt-test'); @@ -39,7 +39,7 @@ it('can render page with a custom slug', function () { ->assertSuccessful(); }); -it('can resend notification', function () { +it('can resend notification', function (): void { Notification::fake(); $userToVerify = User::factory()->create([ @@ -55,7 +55,7 @@ it('can resend notification', function () { Notification::assertSentTo($userToVerify, VerifyEmail::class); }); -it('can throttle resend notification attempts', function () { +it('can throttle resend notification attempts', function (): void { Notification::fake(); $userToVerify = User::factory()->create([ diff --git a/tests/src/Panels/Auth/EmailVerification/EmailVerificationTest.php b/tests/src/Panels/Auth/EmailVerification/EmailVerificationTest.php index 75c55622a3..9be2987f67 100644 --- a/tests/src/Panels/Auth/EmailVerification/EmailVerificationTest.php +++ b/tests/src/Panels/Auth/EmailVerification/EmailVerificationTest.php @@ -6,7 +6,7 @@ use Filament\Tests\TestCase; uses(TestCase::class); -it('can verify an email', function () { +it('can verify an email', function (): void { $userToVerify = User::factory()->create([ 'email_verified_at' => null, ]); @@ -23,7 +23,7 @@ it('can verify an email', function () { ->hasVerifiedEmail()->toBeTrue(); }); -it('can verify an email with a custom slug', function () { +it('can verify an email with a custom slug', function (): void { Filament::setCurrentPanel('slugs'); $userToVerify = User::factory()->create([ @@ -43,7 +43,7 @@ it('can verify an email with a custom slug', function () { ->hasVerifiedEmail()->toBeTrue(); }); -it('cannot verify an email when signed in as another user', function () { +it('cannot verify an email when signed in as another user', function (): void { $userToVerify = User::factory()->create([ 'email_verified_at' => null, ]); diff --git a/tests/src/Panels/Auth/LoginTest.php b/tests/src/Panels/Auth/LoginTest.php index 5639a2dbe9..1ec460a32c 100644 --- a/tests/src/Panels/Auth/LoginTest.php +++ b/tests/src/Panels/Auth/LoginTest.php @@ -10,14 +10,14 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can render page', function () { +it('can render page', function (): void { expect(Filament::getLoginUrl())->toEndWith('/login'); $this->get(Filament::getLoginUrl()) ->assertSuccessful(); }); -it('can render page with a custom slug', function () { +it('can render page with a custom slug', function (): void { Filament::setCurrentPanel('slugs'); expect(Filament::getLoginUrl())->toEndWith('/login-test'); @@ -26,7 +26,7 @@ it('can render page with a custom slug', function () { ->assertSuccessful(); }); -it('can authenticate', function () { +it('can authenticate', function (): void { $this->assertGuest(); $userToAuthenticate = User::factory()->create(); @@ -42,7 +42,7 @@ it('can authenticate', function () { $this->assertAuthenticatedAs($userToAuthenticate); }); -it('can authenticate and redirect user to their intended URL', function () { +it('can authenticate and redirect user to their intended URL', function (): void { session()->put('url.intended', $intendedUrl = Str::random()); $userToAuthenticate = User::factory()->create(); @@ -56,11 +56,11 @@ it('can authenticate and redirect user to their intended URL', function () { ->assertRedirect($intendedUrl); }); -it('can redirect unauthenticated app requests', function () { +it('can redirect unauthenticated app requests', function (): void { $this->get(route('filament.admin.pages.dashboard'))->assertRedirect(Filament::getLoginUrl()); }); -it('cannot authenticate with incorrect credentials', function () { +it('cannot authenticate with incorrect credentials', function (): void { $userToAuthenticate = User::factory()->create(); livewire(Login::class) @@ -74,7 +74,7 @@ it('cannot authenticate with incorrect credentials', function () { $this->assertGuest(); }); -it('cannot authenticate on unauthorized panel', function () { +it('cannot authenticate on unauthorized panel', function (): void { $userToAuthenticate = User::factory()->create(); Filament::setCurrentPanel('custom'); @@ -90,7 +90,7 @@ it('cannot authenticate on unauthorized panel', function () { $this->assertGuest(); }); -it('can throttle authentication attempts', function () { +it('can throttle authentication attempts', function (): void { $this->assertGuest(); $userToAuthenticate = User::factory()->create(); @@ -119,21 +119,21 @@ it('can throttle authentication attempts', function () { $this->assertGuest(); }); -it('can validate `email` is required', function () { +it('can validate `email` is required', function (): void { livewire(Login::class) ->fillForm(['email' => '']) ->call('authenticate') ->assertHasFormErrors(['email' => ['required']]); }); -it('can validate `email` is valid email', function () { +it('can validate `email` is valid email', function (): void { livewire(Login::class) ->fillForm(['email' => 'invalid-email']) ->call('authenticate') ->assertHasFormErrors(['email' => ['email']]); }); -it('can validate `password` is required', function () { +it('can validate `password` is required', function (): void { livewire(Login::class) ->fillForm(['password' => '']) ->call('authenticate') diff --git a/tests/src/Panels/Auth/LogoutTest.php b/tests/src/Panels/Auth/LogoutTest.php index ba4f8e49ff..cb74e676a2 100644 --- a/tests/src/Panels/Auth/LogoutTest.php +++ b/tests/src/Panels/Auth/LogoutTest.php @@ -8,7 +8,7 @@ use Illuminate\Http\RedirectResponse; uses(TestCase::class); -it('can log a user out', function () { +it('can log a user out', function (): void { $this ->actingAs(User::factory()->create()) ->post(Filament::getLogoutUrl()) @@ -17,7 +17,7 @@ it('can log a user out', function () { $this->assertGuest(); }); -it('allows a user to override the logout response', function () { +it('allows a user to override the logout response', function (): void { $logoutResponseFake = new class implements LogoutResponse { public function toResponse($request): RedirectResponse diff --git a/tests/src/Panels/Auth/MultiFactor/EmailCode/DisableEmailCodeAuthenticationActionTest.php b/tests/src/Panels/Auth/MultiFactor/EmailCode/DisableEmailCodeAuthenticationActionTest.php index 09d8ae9016..2666e2e55c 100644 --- a/tests/src/Panels/Auth/MultiFactor/EmailCode/DisableEmailCodeAuthenticationActionTest.php +++ b/tests/src/Panels/Auth/MultiFactor/EmailCode/DisableEmailCodeAuthenticationActionTest.php @@ -15,7 +15,7 @@ use function Pest\Laravel\actingAs; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { Filament::setCurrentPanel('email-code-authentication'); actingAs(User::factory() @@ -25,7 +25,7 @@ beforeEach(function () { Notification::fake(); }); -it('can disable authentication when valid challenge code is used', function () { +it('can disable authentication when valid challenge code is used', function (): void { $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); @@ -61,7 +61,7 @@ it('can disable authentication when valid challenge code is used', function () { }); }); -it('can resend the code to the user', function () { +it('can resend the code to the user', function (): void { $this->travelTo(now()->subMinute()); $livewire = livewire(EditProfile::class) @@ -79,7 +79,7 @@ it('can resend the code to the user', function () { Notification::assertSentTimes(VerifyEmailCodeAuthentication::class, 2); }); -it('can resend the code to the user more than once per minute', function () { +it('can resend the code to the user more than once per minute', function (): void { $this->travelTo(now()->subMinute()); $livewire = livewire(EditProfile::class) @@ -103,7 +103,7 @@ it('can resend the code to the user more than once per minute', function () { Notification::assertSentTimes(VerifyEmailCodeAuthentication::class, 2); }); -it('will not disable authentication when an invalid code is used', function () { +it('will not disable authentication when an invalid code is used', function (): void { $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); @@ -129,7 +129,7 @@ it('will not disable authentication when an invalid code is used', function () { ->not()->toBeNull(); }); -test('codes are required', function () { +test('codes are required', function (): void { $user = auth()->user(); expect($user->hasEmailCodeAuthentication()) @@ -155,7 +155,7 @@ test('codes are required', function () { ->not()->toBeNull(); }); -test('codes must be 6 digits', function () { +test('codes must be 6 digits', function (): void { $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); diff --git a/tests/src/Panels/Auth/MultiFactor/EmailCode/EmailCodeAuthenticationChallengeTest.php b/tests/src/Panels/Auth/MultiFactor/EmailCode/EmailCodeAuthenticationChallengeTest.php index 2c45938df4..792aa03ff8 100644 --- a/tests/src/Panels/Auth/MultiFactor/EmailCode/EmailCodeAuthenticationChallengeTest.php +++ b/tests/src/Panels/Auth/MultiFactor/EmailCode/EmailCodeAuthenticationChallengeTest.php @@ -14,13 +14,13 @@ use function Filament\Tests\livewire; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { Filament::setCurrentPanel('email-code-authentication'); Notification::fake(); }); -it('can render the challenge form after valid login credentials are successfully used', function () { +it('can render the challenge form after valid login credentials are successfully used', function (): void { $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() @@ -51,7 +51,7 @@ it('can render the challenge form after valid login credentials are successfully }); }); -it('will authenticate the user after a valid challenge code is used', function () { +it('will authenticate the user after a valid challenge code is used', function (): void { $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() @@ -78,7 +78,7 @@ it('will authenticate the user after a valid challenge code is used', function ( $this->assertAuthenticatedAs($userToAuthenticate); }); -it('can resend the code to the user', function () { +it('can resend the code to the user', function (): void { $this->travelTo(now()->subMinute()); $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); @@ -105,7 +105,7 @@ it('can resend the code to the user', function () { Notification::assertSentTimes(VerifyEmailCodeAuthentication::class, 2); }); -it('can not resend the code to the user more than once per minute', function () { +it('can not resend the code to the user more than once per minute', function (): void { $this->travelTo(now()->subMinute()); $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); @@ -138,7 +138,7 @@ it('can not resend the code to the user more than once per minute', function () Notification::assertSentTimes(VerifyEmailCodeAuthentication::class, 2); }); -it('will not render the challenge form after invalid login credentials are used', function () { +it('will not render the challenge form after invalid login credentials are used', function (): void { $userToAuthenticate = User::factory() ->hasEmailCodeAuthentication() ->create(); @@ -158,7 +158,7 @@ it('will not render the challenge form after invalid login credentials are used' Notification::assertNotSentTo($userToAuthenticate, VerifyEmailCodeAuthentication::class); }); -it('will not render the challenge form if a user does not have multi-factor authentication enabled', function () { +it('will not render the challenge form if a user does not have multi-factor authentication enabled', function (): void { $userToAuthenticate = User::factory()->create(); livewire(Login::class) @@ -176,7 +176,7 @@ it('will not render the challenge form if a user does not have multi-factor auth Notification::assertNotSentTo($userToAuthenticate, VerifyEmailCodeAuthentication::class); }); -it('will not authenticate the user when an invalid challenge code is used', function () { +it('will not authenticate the user when an invalid challenge code is used', function (): void { $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() @@ -207,7 +207,7 @@ it('will not authenticate the user when an invalid challenge code is used', func $this->assertGuest(); }); -test('challenge codes are required', function () { +test('challenge codes are required', function (): void { $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() @@ -236,7 +236,7 @@ test('challenge codes are required', function () { $this->assertGuest(); }); -test('challenge codes must be numeric', function () { +test('challenge codes must be numeric', function (): void { $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() @@ -265,7 +265,7 @@ test('challenge codes must be numeric', function () { $this->assertGuest(); }); -test('challenge codes must be 6 digits', function () { +test('challenge codes must be 6 digits', function (): void { $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() diff --git a/tests/src/Panels/Auth/MultiFactor/EmailCode/SetUpEmailCodeAuthenticationActionTest.php b/tests/src/Panels/Auth/MultiFactor/EmailCode/SetUpEmailCodeAuthenticationActionTest.php index be7959fd3d..469a84ef5d 100644 --- a/tests/src/Panels/Auth/MultiFactor/EmailCode/SetUpEmailCodeAuthenticationActionTest.php +++ b/tests/src/Panels/Auth/MultiFactor/EmailCode/SetUpEmailCodeAuthenticationActionTest.php @@ -15,7 +15,7 @@ use function Pest\Laravel\actingAs; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { Filament::setCurrentPanel('email-code-authentication'); actingAs(User::factory()->create()); @@ -23,7 +23,7 @@ beforeEach(function () { Notification::fake(); }); -it('can generate a secret when the action is mounted', function () { +it('can generate a secret when the action is mounted', function (): void { $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $livewire = livewire(EditProfile::class) @@ -57,7 +57,7 @@ it('can generate a secret when the action is mounted', function () { }); }); -it('can save the secret to the user when the action is submitted', function () { +it('can save the secret to the user when the action is submitted', function (): void { $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); @@ -87,7 +87,7 @@ it('can save the secret to the user when the action is submitted', function () { ->toBe($secret); }); -it('can resend the code to the user', function () { +it('can resend the code to the user', function (): void { $this->travelTo(now()->subMinute()); $livewire = livewire(EditProfile::class) @@ -105,7 +105,7 @@ it('can resend the code to the user', function () { Notification::assertSentTimes(VerifyEmailCodeAuthentication::class, 2); }); -it('can resend the code to the user more than once per minute', function () { +it('can resend the code to the user more than once per minute', function (): void { $this->travelTo(now()->subMinute()); $livewire = livewire(EditProfile::class) @@ -129,7 +129,7 @@ it('can resend the code to the user more than once per minute', function () { Notification::assertSentTimes(VerifyEmailCodeAuthentication::class, 2); }); -it('will not set up authentication when an invalid code is used', function () { +it('will not set up authentication when an invalid code is used', function (): void { $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); @@ -161,7 +161,7 @@ it('will not set up authentication when an invalid code is used', function () { ->toBeEmpty(); }); -test('codes are required', function () { +test('codes are required', function (): void { $user = auth()->user(); expect($user->hasEmailCodeAuthentication()) @@ -186,7 +186,7 @@ test('codes are required', function () { ->toBeEmpty(); }); -test('codes must be 6 digits', function () { +test('codes must be 6 digits', function (): void { $emailCodeAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); diff --git a/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/Actions/DisableGoogleTwoFactorAuthenticationActionTest.php b/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/Actions/DisableGoogleTwoFactorAuthenticationActionTest.php index b799826e95..da460637dc 100644 --- a/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/Actions/DisableGoogleTwoFactorAuthenticationActionTest.php +++ b/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/Actions/DisableGoogleTwoFactorAuthenticationActionTest.php @@ -13,7 +13,7 @@ use function Pest\Laravel\actingAs; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { Filament::setCurrentPanel('google-two-factor-authentication'); $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); @@ -25,7 +25,7 @@ beforeEach(function () { ->create()); }); -it('can disable authentication when valid challenge code is used', function () { +it('can disable authentication when valid challenge code is used', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); @@ -59,7 +59,7 @@ it('can disable authentication when valid challenge code is used', function () { ->toBeEmpty(); }); -it('can disable authentication when a valid recovery code is used', function () { +it('can disable authentication when a valid recovery code is used', function (): void { $user = auth()->user(); expect($user->hasGoogleTwoFactorAuthentication()) @@ -94,7 +94,7 @@ it('can disable authentication when a valid recovery code is used', function () ->toBeEmpty(); }); -it('will not disable authentication when an invalid code is used', function () { +it('will not disable authentication when an invalid code is used', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); @@ -128,7 +128,7 @@ it('will not disable authentication when an invalid code is used', function () { ->toHaveCount(8); }); -test('codes are required without a recovery code', function () { +test('codes are required without a recovery code', function (): void { $user = auth()->user(); expect($user->hasGoogleTwoFactorAuthentication()) @@ -162,7 +162,7 @@ test('codes are required without a recovery code', function () { ->toHaveCount(8); }); -test('codes must be 6 digits', function () { +test('codes must be 6 digits', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); @@ -198,7 +198,7 @@ test('codes must be 6 digits', function () { ->toHaveCount(8); }); -it('will not disable authentication when an invalid recovery code is used', function () { +it('will not disable authentication when an invalid recovery code is used', function (): void { $user = auth()->user(); expect($user->hasGoogleTwoFactorAuthentication()) @@ -233,7 +233,7 @@ it('will not disable authentication when an invalid recovery code is used', func ->toHaveCount(8); }); -it('will not disable authentication with a recovery code if recovery is disabled', function () { +it('will not disable authentication with a recovery code if recovery is disabled', function (): void { Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()) ->recoverable(false); diff --git a/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/Actions/RegenerateGoogleTwoFactorAuthenticationRecoveryCodesActionTest.php b/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/Actions/RegenerateGoogleTwoFactorAuthenticationRecoveryCodesActionTest.php index 7d78247628..ccbee42d81 100644 --- a/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/Actions/RegenerateGoogleTwoFactorAuthenticationRecoveryCodesActionTest.php +++ b/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/Actions/RegenerateGoogleTwoFactorAuthenticationRecoveryCodesActionTest.php @@ -13,7 +13,7 @@ use function Pest\Laravel\actingAs; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { Filament::setCurrentPanel('google-two-factor-authentication'); actingAs(User::factory() @@ -21,7 +21,7 @@ beforeEach(function () { ->create()); }); -it('can generate new recovery codes when valid challenge code is used', function () { +it('can generate new recovery codes when valid challenge code is used', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); @@ -68,7 +68,7 @@ it('can generate new recovery codes when valid challenge code is used', function ->toHaveCount(8); }); -it('can generate new recovery codes when the current user\'s password is used', function () { +it('can generate new recovery codes when the current user\'s password is used', function (): void { $user = auth()->user(); $recoveryCodes = $user->getGoogleTwoFactorAuthenticationRecoveryCodes(); @@ -113,7 +113,7 @@ it('can generate new recovery codes when the current user\'s password is used', ->toHaveCount(8); }); -it('will not generate new recovery codes when an invalid code is used', function () { +it('will not generate new recovery codes when an invalid code is used', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); @@ -137,7 +137,7 @@ it('will not generate new recovery codes when an invalid code is used', function ->toBe($recoveryCodes); }); -test('codes are required without the user\'s current password', function () { +test('codes are required without the user\'s current password', function (): void { $user = auth()->user(); $recoveryCodes = $user->getGoogleTwoFactorAuthenticationRecoveryCodes(); @@ -161,7 +161,7 @@ test('codes are required without the user\'s current password', function () { ->toBe($recoveryCodes); }); -test('codes must be 6 digits', function () { +test('codes must be 6 digits', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); @@ -187,7 +187,7 @@ test('codes must be 6 digits', function () { ->toBe($recoveryCodes); }); -test('the user\'s current password must be valid', function () { +test('the user\'s current password must be valid', function (): void { $user = auth()->user(); $recoveryCodes = $user->getGoogleTwoFactorAuthenticationRecoveryCodes(); diff --git a/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/Actions/SetUpGoogleTwoFactorAuthenticationActionTest.php b/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/Actions/SetUpGoogleTwoFactorAuthenticationActionTest.php index d9e1b81eb3..ef5048bb89 100644 --- a/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/Actions/SetUpGoogleTwoFactorAuthenticationActionTest.php +++ b/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/Actions/SetUpGoogleTwoFactorAuthenticationActionTest.php @@ -14,13 +14,13 @@ use function Pest\Laravel\actingAs; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { Filament::setCurrentPanel('google-two-factor-authentication'); actingAs(User::factory()->create()); }); -it('can generate a secret and recovery codes when the action is mounted', function () { +it('can generate a secret and recovery codes when the action is mounted', function (): void { livewire(EditProfile::class) ->mountAction(TestAction::make('setUpGoogleTwoFactorAuthentication') ->schemaComponent('content.google_two_factor')) @@ -59,7 +59,7 @@ it('can generate a secret and recovery codes when the action is mounted', functi })); }); -it('can save the secret and recovery codes to the user when the action is submitted', function () { +it('can save the secret and recovery codes to the user when the action is submitted', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); @@ -103,7 +103,7 @@ it('can save the secret and recovery codes to the user when the action is submit } }); -it('will not set up authentication when an invalid code is used', function () { +it('will not set up authentication when an invalid code is used', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); @@ -143,7 +143,7 @@ it('will not set up authentication when an invalid code is used', function () { ->toBeEmpty(); }); -test('codes are required', function () { +test('codes are required', function (): void { $user = auth()->user(); expect($user->hasGoogleTwoFactorAuthentication()) @@ -176,7 +176,7 @@ test('codes are required', function () { ->toBeEmpty(); }); -test('codes must be 6 digits', function () { +test('codes must be 6 digits', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $user = auth()->user(); diff --git a/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/GoogleTwoFactorAuthenticationChallengeTest.php b/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/GoogleTwoFactorAuthenticationChallengeTest.php index 63343e8fce..f92eacd426 100644 --- a/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/GoogleTwoFactorAuthenticationChallengeTest.php +++ b/tests/src/Panels/Auth/MultiFactor/GoogleTwoFactor/GoogleTwoFactorAuthenticationChallengeTest.php @@ -13,11 +13,11 @@ use function Filament\Tests\livewire; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { Filament::setCurrentPanel('google-two-factor-authentication'); }); -it('can render the challenge form after valid login credentials are successfully used', function () { +it('can render the challenge form after valid login credentials are successfully used', function (): void { $userToAuthenticate = User::factory() ->hasGoogleTwoFactorAuthentication() ->create(); @@ -38,7 +38,7 @@ it('can render the challenge form after valid login credentials are successfully $this->assertGuest(); }); -it('will authenticate the user after a valid challenge code is used', function () { +it('will authenticate the user after a valid challenge code is used', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() @@ -65,7 +65,7 @@ it('will authenticate the user after a valid challenge code is used', function ( $this->assertAuthenticatedAs($userToAuthenticate); }); -it('will make the recovery code field visible when the user requests it', function () { +it('will make the recovery code field visible when the user requests it', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() @@ -94,7 +94,7 @@ it('will make the recovery code field visible when the user requests it', functi ); }); -it('will authenticate the user after a valid recovery code is used', function () { +it('will authenticate the user after a valid recovery code is used', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() @@ -123,7 +123,7 @@ it('will authenticate the user after a valid recovery code is used', function () $this->assertAuthenticatedAs($userToAuthenticate); }); -it('will not render the challenge form after invalid login credentials are used', function () { +it('will not render the challenge form after invalid login credentials are used', function (): void { $userToAuthenticate = User::factory() ->hasGoogleTwoFactorAuthentication() ->create(); @@ -141,7 +141,7 @@ it('will not render the challenge form after invalid login credentials are used' $this->assertGuest(); }); -it('will not render the challenge form if a user does not have multi-factor authentication enabled', function () { +it('will not render the challenge form if a user does not have multi-factor authentication enabled', function (): void { $userToAuthenticate = User::factory()->create(); livewire(Login::class) @@ -157,7 +157,7 @@ it('will not render the challenge form if a user does not have multi-factor auth $this->assertAuthenticatedAs($userToAuthenticate); }); -it('will not authenticate the user when an invalid challenge code is used', function () { +it('will not authenticate the user when an invalid challenge code is used', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() @@ -188,7 +188,7 @@ it('will not authenticate the user when an invalid challenge code is used', func $this->assertGuest(); }); -test('challenge codes are required', function () { +test('challenge codes are required', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() @@ -217,7 +217,7 @@ test('challenge codes are required', function () { $this->assertGuest(); }); -test('challenge codes must be numeric', function () { +test('challenge codes must be numeric', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() @@ -246,7 +246,7 @@ test('challenge codes must be numeric', function () { $this->assertGuest(); }); -test('challenge codes must be 6 digits', function () { +test('challenge codes must be 6 digits', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() @@ -275,7 +275,7 @@ test('challenge codes must be 6 digits', function () { $this->assertGuest(); }); -it('will not authenticate the user when an invalid recovery code is used', function () { +it('will not authenticate the user when an invalid recovery code is used', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()); $userToAuthenticate = User::factory() @@ -316,7 +316,7 @@ it('will not authenticate the user when an invalid recovery code is used', funct $this->assertGuest(); }); -it('will not authenticate the user with a valid recovery code if recovery is disabled', function () { +it('will not authenticate the user with a valid recovery code if recovery is disabled', function (): void { $googleTwoFactorAuthentication = Arr::first(Filament::getCurrentOrDefaultPanel()->getMultiFactorAuthenticationProviders()) ->recoverable(false); diff --git a/tests/src/Panels/Auth/MultiFactor/MultiFactorAuthenticationRequiredTest.php b/tests/src/Panels/Auth/MultiFactor/MultiFactorAuthenticationRequiredTest.php index 504d64652c..a0454c1444 100644 --- a/tests/src/Panels/Auth/MultiFactor/MultiFactorAuthenticationRequiredTest.php +++ b/tests/src/Panels/Auth/MultiFactor/MultiFactorAuthenticationRequiredTest.php @@ -6,7 +6,7 @@ use Filament\Tests\TestCase; uses(TestCase::class); -it('redirects the user to the setup page if they have not set up multi-factor authentication', function () { +it('redirects the user to the setup page if they have not set up multi-factor authentication', function (): void { Filament::setCurrentPanel('required-multi-factor-authentication'); $user = User::factory()->create(); @@ -17,7 +17,7 @@ it('redirects the user to the setup page if they have not set up multi-factor au ->assertRedirect(Filament::getSetUpRequiredMultiFactorAuthenticationUrl()); }); -it('can render setup page', function () { +it('can render setup page', function (): void { Filament::setCurrentPanel('required-multi-factor-authentication'); $user = User::factory()->create(); @@ -30,7 +30,7 @@ it('can render setup page', function () { ->assertSuccessful(); }); -it('can render setup page with a custom slug', function () { +it('can render setup page with a custom slug', function (): void { Filament::setCurrentPanel('slugs'); expect(Filament::getSetUpRequiredMultiFactorAuthenticationUrl())->toEndWith('/multi-factor-authentication-test/set-up-test'); @@ -43,7 +43,7 @@ it('can render setup page with a custom slug', function () { ->assertSuccessful(); }); -it('redirects the user away from the setup page if they have already set up multi-factor authentication', function () { +it('redirects the user away from the setup page if they have already set up multi-factor authentication', function (): void { Filament::setCurrentPanel('required-multi-factor-authentication'); $user = User::factory() diff --git a/tests/src/Panels/Auth/PasswordReset/RequestPasswordResetTest.php b/tests/src/Panels/Auth/PasswordReset/RequestPasswordResetTest.php index 82e08e8648..9b913e9bb5 100644 --- a/tests/src/Panels/Auth/PasswordReset/RequestPasswordResetTest.php +++ b/tests/src/Panels/Auth/PasswordReset/RequestPasswordResetTest.php @@ -11,14 +11,14 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can render page', function () { +it('can render page', function (): void { expect(Filament::getRequestPasswordResetUrl())->toEndWith('/password-reset/request'); $this->get(Filament::getRequestPasswordResetUrl()) ->assertSuccessful(); }); -it('can render page with a custom slug', function () { +it('can render page with a custom slug', function (): void { Filament::setCurrentPanel('slugs'); expect(Filament::getRequestPasswordResetUrl())->toEndWith('/password-reset-test/request-test'); @@ -27,7 +27,7 @@ it('can render page with a custom slug', function () { ->assertSuccessful(); }); -it('can request password reset', function () { +it('can request password reset', function (): void { Notification::fake(); $this->assertGuest(); @@ -44,7 +44,7 @@ it('can request password reset', function () { Notification::assertSentTo($userToResetPassword, ResetPassword::class); }); -it('can throttle requests', function () { +it('can throttle requests', function (): void { Notification::fake(); $this->assertGuest(); @@ -74,7 +74,7 @@ it('can throttle requests', function () { Notification::assertNotSentTo($userToResetPassword, ResetPassword::class); }); -it('can validate `email` is required', function () { +it('can validate `email` is required', function (): void { livewire(RequestPasswordReset::class) ->fillForm([ 'email' => '', @@ -83,7 +83,7 @@ it('can validate `email` is required', function () { ->assertHasFormErrors(['email' => ['required']]); }); -it('can validate `email` is valid email', function () { +it('can validate `email` is valid email', function (): void { livewire(RequestPasswordReset::class) ->fillForm([ 'email' => 'invalid-email', diff --git a/tests/src/Panels/Auth/PasswordReset/ResetPasswordTest.php b/tests/src/Panels/Auth/PasswordReset/ResetPasswordTest.php index 268c4c1f0c..4e70d2ba5f 100644 --- a/tests/src/Panels/Auth/PasswordReset/ResetPasswordTest.php +++ b/tests/src/Panels/Auth/PasswordReset/ResetPasswordTest.php @@ -13,7 +13,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can render page', function () { +it('can render page', function (): void { $userToResetPassword = User::factory()->make(); $token = Password::createToken($userToResetPassword); @@ -27,7 +27,7 @@ it('can render page', function () { $this->get($url)->assertSuccessful(); }); -it('can render page with a custom slug', function () { +it('can render page with a custom slug', function (): void { Filament::setCurrentPanel('slugs'); $userToResetPassword = User::factory()->make(); @@ -43,7 +43,7 @@ it('can render page with a custom slug', function () { $this->get($url)->assertSuccessful(); }); -it('can reset password', function () { +it('can reset password', function (): void { Event::fake(); $this->assertGuest(); @@ -69,7 +69,7 @@ it('can reset password', function () { ]); }); -it('requires request signature', function () { +it('requires request signature', function (): void { $userToResetPassword = User::factory()->make(); $token = Password::createToken($userToResetPassword); @@ -79,7 +79,7 @@ it('requires request signature', function () { ]))->assertForbidden(); }); -it('requires valid email and token', function () { +it('requires valid email and token', function (): void { Event::fake(); $this->assertGuest(); @@ -112,7 +112,7 @@ it('requires valid email and token', function () { Event::assertNotDispatched(PasswordReset::class); }); -it('can throttle reset password attempts', function () { +it('can throttle reset password attempts', function (): void { Event::fake(); $this->assertGuest(); @@ -157,14 +157,14 @@ it('can throttle reset password attempts', function () { ]); }); -it('can validate `password` is required', function () { +it('can validate `password` is required', function (): void { livewire(ResetPassword::class) ->set('password', '') ->call('resetPassword') ->assertHasErrors(['password' => ['required']]); }); -it('can validate `password` is confirmed', function () { +it('can validate `password` is confirmed', function (): void { livewire(ResetPassword::class) ->set('password', Str::random()) ->set('passwordConfirmation', Str::random()) @@ -172,7 +172,7 @@ it('can validate `password` is confirmed', function () { ->assertHasErrors(['password' => ['same']]); }); -it('can validate `passwordConfirmation` is required', function () { +it('can validate `passwordConfirmation` is required', function (): void { livewire(ResetPassword::class) ->set('passwordConfirmation', '') ->call('resetPassword') diff --git a/tests/src/Panels/Auth/RegisterTest.php b/tests/src/Panels/Auth/RegisterTest.php index 3adfc18224..3f1c5fbb00 100644 --- a/tests/src/Panels/Auth/RegisterTest.php +++ b/tests/src/Panels/Auth/RegisterTest.php @@ -14,14 +14,14 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can render page', function () { +it('can render page', function (): void { expect(Filament::getRegistrationUrl())->toEndWith('/register'); $this->get(Filament::getRegistrationUrl()) ->assertSuccessful(); }); -it('can render page with a custom slug', function () { +it('can render page with a custom slug', function (): void { Filament::setCurrentPanel('slugs'); expect(Filament::getRegistrationUrl())->toEndWith('/register-test'); @@ -30,7 +30,7 @@ it('can render page with a custom slug', function () { ->assertSuccessful(); }); -it('can register', function () { +it('can register', function (): void { Notification::fake(); Event::fake(); @@ -61,7 +61,7 @@ it('can register', function () { ]); }); -it('can register and redirect user to their intended URL', function () { +it('can register and redirect user to their intended URL', function (): void { Notification::fake(); Event::fake(); @@ -82,7 +82,7 @@ it('can register and redirect user to their intended URL', function () { ->assertRedirect($intendedUrl); }); -it('can throttle registration attempts', function () { +it('can throttle registration attempts', function (): void { Notification::fake(); Event::fake(); @@ -126,42 +126,42 @@ it('can throttle registration attempts', function () { $this->assertGuest(); }); -it('can validate `name` is required', function () { +it('can validate `name` is required', function (): void { livewire(Register::class) ->fillForm(['name' => '']) ->call('register') ->assertHasFormErrors(['name' => ['required']]); }); -it('can validate `name` is max 255 characters', function () { +it('can validate `name` is max 255 characters', function (): void { livewire(Register::class) ->fillForm(['name' => Str::random(256)]) ->call('register') ->assertHasFormErrors(['name' => ['max']]); }); -it('can validate `email` is required', function () { +it('can validate `email` is required', function (): void { livewire(Register::class) ->fillForm(['email' => '']) ->call('register') ->assertHasFormErrors(['email' => ['required']]); }); -it('can validate `email` is valid email', function () { +it('can validate `email` is valid email', function (): void { livewire(Register::class) ->fillForm(['email' => 'invalid-email']) ->call('register') ->assertHasFormErrors(['email' => ['email']]); }); -it('can validate `email` is max 255 characters', function () { +it('can validate `email` is max 255 characters', function (): void { livewire(Register::class) ->fillForm(['email' => Str::random(256)]) ->call('register') ->assertHasFormErrors(['email' => ['max']]); }); -it('can validate `email` is unique', function () { +it('can validate `email` is unique', function (): void { $existingEmail = User::factory()->create()->email; livewire(Register::class) @@ -170,14 +170,14 @@ it('can validate `email` is unique', function () { ->assertHasFormErrors(['email' => ['unique']]); }); -it('can validate `password` is required', function () { +it('can validate `password` is required', function (): void { livewire(Register::class) ->fillForm(['password' => '']) ->call('register') ->assertHasFormErrors(['password' => ['required']]); }); -it('can validate `password` is confirmed', function () { +it('can validate `password` is confirmed', function (): void { livewire(Register::class) ->fillForm([ 'password' => Str::random(), @@ -187,7 +187,7 @@ it('can validate `password` is confirmed', function () { ->assertHasFormErrors(['password' => ['same']]); }); -it('can validate `passwordConfirmation` is required', function () { +it('can validate `passwordConfirmation` is required', function (): void { livewire(Register::class) ->fillForm(['passwordConfirmation' => '']) ->call('register') diff --git a/tests/src/Panels/Commands/Legacy/LegacyMakeClusterCommandTest.php b/tests/src/Panels/Commands/Legacy/LegacyMakeClusterCommandTest.php index 74aba1cf1a..bcd0721bc3 100644 --- a/tests/src/Panels/Commands/Legacy/LegacyMakeClusterCommandTest.php +++ b/tests/src/Panels/Commands/Legacy/LegacyMakeClusterCommandTest.php @@ -8,7 +8,7 @@ use function PHPUnit\Framework\assertFileExists; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { config()->set('filament.file_generation.flags', [ FileGenerationFlag::PANEL_CLUSTER_CLASSES_OUTSIDE_DIRECTORIES, ]); @@ -17,7 +17,7 @@ beforeEach(function () { }) ->skip((bool) Arr::get($_SERVER, 'PARATEST'), 'File generation tests cannot be run in parallel as they would share a filesystem and have the potential to conflict with each other.'); -it('can generate a cluster class', function () { +it('can generate a cluster class', function (): void { $this->artisan('make:filament-cluster', [ 'name' => 'Blog', '--panel' => 'admin', @@ -29,7 +29,7 @@ it('can generate a cluster class', function () { ->toMatchSnapshot(); }); -it('can generate a cluster class in a nested directory', function () { +it('can generate a cluster class in a nested directory', function (): void { $this->artisan('make:filament-cluster', [ 'name' => 'Website/Blog', '--panel' => 'admin', diff --git a/tests/src/Panels/Commands/Legacy/LegacyMakePageCommandTest.php b/tests/src/Panels/Commands/Legacy/LegacyMakePageCommandTest.php index bd5f58de6c..b08dc05caf 100644 --- a/tests/src/Panels/Commands/Legacy/LegacyMakePageCommandTest.php +++ b/tests/src/Panels/Commands/Legacy/LegacyMakePageCommandTest.php @@ -14,7 +14,7 @@ use function PHPUnit\Framework\assertFileExists; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { config()->set('filament.file_generation.flags', [ FileGenerationFlag::EMBEDDED_PANEL_RESOURCE_SCHEMAS, FileGenerationFlag::EMBEDDED_PANEL_RESOURCE_TABLES, @@ -27,7 +27,7 @@ beforeEach(function () { }) ->skip((bool) Arr::get($_SERVER, 'PARATEST'), 'File generation tests cannot be run in parallel as they would share a filesystem and have the potential to conflict with each other.'); -it('can generate a page class', function () { +it('can generate a page class', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-page', [ @@ -41,7 +41,7 @@ it('can generate a page class', function () { ->toMatchSnapshot(); }); -it('can generate a page view', function () { +it('can generate a page view', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-page', [ @@ -55,7 +55,7 @@ it('can generate a page view', function () { ->toMatchSnapshot(); }); -it('can generate a page class in a nested directory', function () { +it('can generate a page class in a nested directory', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-page', [ @@ -69,7 +69,7 @@ it('can generate a page class in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a page view in a nested directory', function () { +it('can generate a page view in a nested directory', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-page', [ @@ -83,7 +83,7 @@ it('can generate a page view in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a page class in a cluster', function () { +it('can generate a page class in a cluster', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-cluster', [ @@ -106,7 +106,7 @@ it('can generate a page class in a cluster', function () { ->toMatchSnapshot(); }); -it('can generate a page view in a cluster', function () { +it('can generate a page view in a cluster', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-cluster', [ @@ -129,7 +129,7 @@ it('can generate a page view in a cluster', function () { ->toMatchSnapshot(); }); -it('can generate a page class in a resource', function () { +it('can generate a page class in a resource', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-resource', [ @@ -161,7 +161,7 @@ it('can generate a page class in a resource', function () { ->toMatchSnapshot(); }); -it('can generate a page view in a resource', function () { +it('can generate a page view in a resource', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-resource', [ @@ -193,7 +193,7 @@ it('can generate a page view in a resource', function () { ->toMatchSnapshot(); }); -it('can generate a create page class in a resource', function () { +it('can generate a create page class in a resource', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-resource', [ @@ -227,7 +227,7 @@ it('can generate a create page class in a resource', function () { assertFileDoesNotExist(resource_path('views/filament/resources/user-resource/pages/create-user.blade.php')); }); -it('can generate an edit page class in a resource', function () { +it('can generate an edit page class in a resource', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-resource', [ @@ -261,7 +261,7 @@ it('can generate an edit page class in a resource', function () { assertFileDoesNotExist(resource_path('views/filament/resources/user-resource/pages/edit-user.blade.php')); }); -it('can generate a view page class in a resource', function () { +it('can generate a view page class in a resource', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-resource', [ @@ -353,7 +353,7 @@ $generateManageRelatedRecordsPageCommandQuestions = [ 'relationshipType' => 'What type of relationship is this?', ]; -it('can generate a manage related records page class in a resource', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) @@ -372,7 +372,7 @@ it('can generate a manage related records page class in a resource', function () assertFileDoesNotExist(resource_path('views/filament/resources/user-resource/pages/manage-user-teams.blade.php')); }); -it('can generate a manage related records page class in a resource with a related resource', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource with a related resource', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) @@ -386,7 +386,7 @@ it('can generate a manage related records page class in a resource with a relate ->toMatchSnapshot(); }); -it('can generate a manage related records page class in a resource with a generated form schema and table columns', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource with a generated form schema and table columns', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) @@ -405,7 +405,7 @@ it('can generate a manage related records page class in a resource with a genera ->toMatchSnapshot(); }); -it('can generate a manage related records page class in a resource with a view operation', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource with a view operation', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) @@ -422,7 +422,7 @@ it('can generate a manage related records page class in a resource with a view o ->toMatchSnapshot(); }); -it('can generate a manage related records page class in a resource with soft deletes', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource with soft deletes', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) @@ -439,7 +439,7 @@ it('can generate a manage related records page class in a resource with soft del ->toMatchSnapshot(); }); -it('can generate a manage related records page class in a resource for a `HasMany` relationship', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource for a `HasMany` relationship', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) diff --git a/tests/src/Panels/Commands/Legacy/LegacyMakeRelationManagerCommandTest.php b/tests/src/Panels/Commands/Legacy/LegacyMakeRelationManagerCommandTest.php index 4634327452..b6357ae3d2 100644 --- a/tests/src/Panels/Commands/Legacy/LegacyMakeRelationManagerCommandTest.php +++ b/tests/src/Panels/Commands/Legacy/LegacyMakeRelationManagerCommandTest.php @@ -10,7 +10,7 @@ use function PHPUnit\Framework\assertFileExists; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { config()->set('filament.file_generation.flags', [ FileGenerationFlag::EMBEDDED_PANEL_RESOURCE_SCHEMAS, FileGenerationFlag::EMBEDDED_PANEL_RESOURCE_TABLES, @@ -55,7 +55,7 @@ beforeEach(function () { }) ->skip((bool) Arr::get($_SERVER, 'PARATEST'), 'File generation tests cannot be run in parallel as they would share a filesystem and have the potential to conflict with each other.'); -it('can generate a relation manager', function () { +it('can generate a relation manager', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', @@ -70,7 +70,7 @@ it('can generate a relation manager', function () { ->toMatchSnapshot(); }); -it('can generate a relation manager with a related resource', function () { +it('can generate a relation manager with a related resource', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', @@ -84,7 +84,7 @@ it('can generate a relation manager with a related resource', function () { ->toMatchSnapshot(); }); -it('can generate a relation manager with a generated form schema and table columns', function () { +it('can generate a relation manager with a generated form schema and table columns', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', @@ -101,7 +101,7 @@ it('can generate a relation manager with a generated form schema and table colum ->toMatchSnapshot(); }); -it('can generate a relation manager with a view operation', function () { +it('can generate a relation manager with a view operation', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', @@ -117,7 +117,7 @@ it('can generate a relation manager with a view operation', function () { ->toMatchSnapshot(); }); -it('can generate a relation manager with soft deletes', function () { +it('can generate a relation manager with soft deletes', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', @@ -133,7 +133,7 @@ it('can generate a relation manager with soft deletes', function () { ->toMatchSnapshot(); }); -it('can generate a relation manager for a `HasMany` relationship', function () { +it('can generate a relation manager for a `HasMany` relationship', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', diff --git a/tests/src/Panels/Commands/Legacy/LegacyMakeResourceCommandTest.php b/tests/src/Panels/Commands/Legacy/LegacyMakeResourceCommandTest.php index 2fd9b927eb..61bec9123e 100644 --- a/tests/src/Panels/Commands/Legacy/LegacyMakeResourceCommandTest.php +++ b/tests/src/Panels/Commands/Legacy/LegacyMakeResourceCommandTest.php @@ -9,7 +9,7 @@ use function PHPUnit\Framework\assertFileExists; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { config()->set('filament.file_generation.flags', [ FileGenerationFlag::EMBEDDED_PANEL_RESOURCE_SCHEMAS, FileGenerationFlag::EMBEDDED_PANEL_RESOURCE_TABLES, @@ -23,7 +23,7 @@ beforeEach(function () { }) ->skip((bool) Arr::get($_SERVER, 'PARATEST'), 'File generation tests cannot be run in parallel as they would share a filesystem and have the potential to conflict with each other.'); -it('can generate a resource class', function () { +it('can generate a resource class', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -37,7 +37,7 @@ it('can generate a resource class', function () { ->toMatchSnapshot(); }); -it('can generate a resource list page', function () { +it('can generate a resource list page', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -50,7 +50,7 @@ it('can generate a resource list page', function () { ->toMatchSnapshot(); }); -it('can generate a resource create page', function () { +it('can generate a resource create page', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -63,7 +63,7 @@ it('can generate a resource create page', function () { ->toMatchSnapshot(); }); -it('can generate a resource edit page', function () { +it('can generate a resource edit page', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -76,7 +76,7 @@ it('can generate a resource edit page', function () { ->toMatchSnapshot(); }); -it('can generate a resource view page', function () { +it('can generate a resource view page', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--view' => true, @@ -90,7 +90,7 @@ it('can generate a resource view page', function () { ->toMatchSnapshot(); }); -it('can generate the form and table of a resource class', function () { +it('can generate the form and table of a resource class', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--generate' => true, @@ -104,7 +104,7 @@ it('can generate the form and table of a resource class', function () { ->toMatchSnapshot(); }); -it('can generate a resource class with soft deletes', function () { +it('can generate a resource class with soft deletes', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--soft-deletes' => true, @@ -118,7 +118,7 @@ it('can generate a resource class with soft deletes', function () { ->toMatchSnapshot(); }); -it('can generate a resource edit page with soft deletes', function () { +it('can generate a resource edit page with soft deletes', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--soft-deletes' => true, @@ -132,7 +132,7 @@ it('can generate a resource edit page with soft deletes', function () { ->toMatchSnapshot(); }); -it('can generate a simple resource class', function () { +it('can generate a simple resource class', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--simple' => true, @@ -146,7 +146,7 @@ it('can generate a simple resource class', function () { ->toMatchSnapshot(); }); -it('can generate a simple resource manage page', function () { +it('can generate a simple resource manage page', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--simple' => true, @@ -160,7 +160,7 @@ it('can generate a simple resource manage page', function () { ->toMatchSnapshot(); }); -it('can generate a resource class in a nested directory', function () { +it('can generate a resource class in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -173,7 +173,7 @@ it('can generate a resource class in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a resource list page in a nested directory', function () { +it('can generate a resource list page in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -186,7 +186,7 @@ it('can generate a resource list page in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a resource create page in a nested directory', function () { +it('can generate a resource create page in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -199,7 +199,7 @@ it('can generate a resource create page in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a resource edit page in a nested directory', function () { +it('can generate a resource edit page in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -212,7 +212,7 @@ it('can generate a resource edit page in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a resource view page in a nested directory', function () { +it('can generate a resource view page in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--view' => true, @@ -226,7 +226,7 @@ it('can generate a resource view page in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a simple resource manage page in a nested directory', function () { +it('can generate a simple resource manage page in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--simple' => true, diff --git a/tests/src/Panels/Commands/Legacy/LegacyMakeSettingsPageCommandTest.php b/tests/src/Panels/Commands/Legacy/LegacyMakeSettingsPageCommandTest.php index c219cf589b..e6556c3d34 100644 --- a/tests/src/Panels/Commands/Legacy/LegacyMakeSettingsPageCommandTest.php +++ b/tests/src/Panels/Commands/Legacy/LegacyMakeSettingsPageCommandTest.php @@ -17,7 +17,7 @@ use function PHPUnit\Framework\assertFileExists; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { config()->set('filament.file_generation.flags', [ FileGenerationFlag::PANEL_CLUSTER_CLASSES_OUTSIDE_DIRECTORIES, FileGenerationFlag::PARTIAL_IMPORTS, @@ -27,7 +27,7 @@ beforeEach(function () { }) ->skip((bool) Arr::get($_SERVER, 'PARATEST'), 'File generation tests cannot be run in parallel as they would share a filesystem and have the potential to conflict with each other.'); -it('can generate a page class', function () { +it('can generate a page class', function (): void { $this->artisan('make:filament-settings-page', [ 'name' => 'ManageSettings', 'settings' => Settings::class, @@ -40,7 +40,7 @@ it('can generate a page class', function () { ->toMatchSnapshot(); }); -it('can generate a page class in a nested directory', function () { +it('can generate a page class in a nested directory', function (): void { $this->artisan('make:filament-settings-page', [ 'name' => 'Site/ManageSettings', 'settings' => Settings::class, @@ -53,7 +53,7 @@ it('can generate a page class in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a page class in a cluster', function () { +it('can generate a page class in a cluster', function (): void { $this->artisan('make:filament-cluster', [ 'name' => 'Site', '--panel' => 'admin', @@ -75,7 +75,7 @@ it('can generate a page class in a cluster', function () { ->toMatchSnapshot(); }); -it('can generate a page class with a generated form schema', function () { +it('can generate a page class with a generated form schema', function (): void { $this->artisan('make:filament-settings-page', [ 'name' => 'ManageSettings', 'settings' => Settings::class, diff --git a/tests/src/Panels/Commands/MakeClusterCommandTest.php b/tests/src/Panels/Commands/MakeClusterCommandTest.php index 300b1618cc..f2fba06656 100644 --- a/tests/src/Panels/Commands/MakeClusterCommandTest.php +++ b/tests/src/Panels/Commands/MakeClusterCommandTest.php @@ -7,12 +7,12 @@ use function PHPUnit\Framework\assertFileExists; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { $this->withoutMockingConsoleOutput(); }) ->skip((bool) Arr::get($_SERVER, 'PARATEST'), 'File generation tests cannot be run in parallel as they would share a filesystem and have the potential to conflict with each other.'); -it('can generate a cluster class', function () { +it('can generate a cluster class', function (): void { $this->artisan('make:filament-cluster', [ 'name' => 'Blog', '--panel' => 'admin', @@ -24,7 +24,7 @@ it('can generate a cluster class', function () { ->toMatchSnapshot(); }); -it('can generate a cluster class in a nested directory', function () { +it('can generate a cluster class in a nested directory', function (): void { $this->artisan('make:filament-cluster', [ 'name' => 'Website/Blog', '--panel' => 'admin', diff --git a/tests/src/Panels/Commands/MakePageCommandTest.php b/tests/src/Panels/Commands/MakePageCommandTest.php index 71aefb3b4f..89b732ba66 100644 --- a/tests/src/Panels/Commands/MakePageCommandTest.php +++ b/tests/src/Panels/Commands/MakePageCommandTest.php @@ -13,12 +13,12 @@ use function PHPUnit\Framework\assertFileExists; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { MakePageCommand::$shouldCheckModelsForSoftDeletes = false; }) ->skip((bool) Arr::get($_SERVER, 'PARATEST'), 'File generation tests cannot be run in parallel as they would share a filesystem and have the potential to conflict with each other.'); -it('can generate a page class', function () { +it('can generate a page class', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-page', [ @@ -32,7 +32,7 @@ it('can generate a page class', function () { ->toMatchSnapshot(); }); -it('can generate a page view', function () { +it('can generate a page view', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-page', [ @@ -46,7 +46,7 @@ it('can generate a page view', function () { ->toMatchSnapshot(); }); -it('can generate a page class in a nested directory', function () { +it('can generate a page class in a nested directory', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-page', [ @@ -60,7 +60,7 @@ it('can generate a page class in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a page view in a nested directory', function () { +it('can generate a page view in a nested directory', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-page', [ @@ -74,7 +74,7 @@ it('can generate a page view in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a page class in a cluster', function () { +it('can generate a page class in a cluster', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-cluster', [ @@ -97,7 +97,7 @@ it('can generate a page class in a cluster', function () { ->toMatchSnapshot(); }); -it('can generate a page view in a cluster', function () { +it('can generate a page view in a cluster', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-cluster', [ @@ -120,7 +120,7 @@ it('can generate a page view in a cluster', function () { ->toMatchSnapshot(); }); -it('can generate a page class in a resource', function () { +it('can generate a page class in a resource', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-resource', [ @@ -152,7 +152,7 @@ it('can generate a page class in a resource', function () { ->toMatchSnapshot(); }); -it('can generate a page view in a resource', function () { +it('can generate a page view in a resource', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-resource', [ @@ -184,7 +184,7 @@ it('can generate a page view in a resource', function () { ->toMatchSnapshot(); }); -it('can generate a create page class in a resource', function () { +it('can generate a create page class in a resource', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-resource', [ @@ -218,7 +218,7 @@ it('can generate a create page class in a resource', function () { assertFileDoesNotExist(resource_path('views/filament/resources/users/pages/create-user.blade.php')); }); -it('can generate an edit page class in a resource', function () { +it('can generate an edit page class in a resource', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-resource', [ @@ -252,7 +252,7 @@ it('can generate an edit page class in a resource', function () { assertFileDoesNotExist(resource_path('views/filament/resources/users/pages/edit-user.blade.php')); }); -it('can generate a view page class in a resource', function () { +it('can generate a view page class in a resource', function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-resource', [ @@ -350,7 +350,7 @@ $generateManageRelatedRecordsPageCommandQuestions = [ 'relationshipType' => 'What type of relationship is this?', ]; -it('can generate a manage related records page class in a resource', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) @@ -371,7 +371,7 @@ it('can generate a manage related records page class in a resource', function () assertFileDoesNotExist(resource_path('views/filament/resources/users/pages/manage-user-teams.blade.php')); }); -it('can generate a manage related records page class in a resource with a related resource', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource with a related resource', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) @@ -385,7 +385,7 @@ it('can generate a manage related records page class in a resource with a relate ->toMatchSnapshot(); }); -it('can generate a manage related records page class in a resource with a form schema class', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource with a form schema class', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) @@ -405,7 +405,7 @@ it('can generate a manage related records page class in a resource with a form s ->toMatchSnapshot(); }); -it('can generate a manage related records page class in a resource with a generated form schema and table columns', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource with a generated form schema and table columns', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) @@ -426,7 +426,7 @@ it('can generate a manage related records page class in a resource with a genera ->toMatchSnapshot(); }); -it('can generate a manage related records page class in a resource with a view operation', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource with a view operation', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) @@ -446,7 +446,7 @@ it('can generate a manage related records page class in a resource with a view o ->toMatchSnapshot(); }); -it('can generate a manage related records page class in a resource with an infolist schema class', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource with an infolist schema class', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) @@ -467,7 +467,7 @@ it('can generate a manage related records page class in a resource with an infol ->toMatchSnapshot(); }); -it('can generate a manage related records page class in a resource with a table class', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource with a table class', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) @@ -485,7 +485,7 @@ it('can generate a manage related records page class in a resource with a table ->toMatchSnapshot(); }); -it('can generate a manage related records page class in a resource with soft deletes', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource with soft deletes', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) @@ -504,7 +504,7 @@ it('can generate a manage related records page class in a resource with soft del ->toMatchSnapshot(); }); -it('can generate a manage related records page class in a resource for a `HasMany` relationship', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions) { +it('can generate a manage related records page class in a resource for a `HasMany` relationship', function () use ($runGenerateManageRelatedRecordsPageCommand, $generateManageRelatedRecordsPageCommandQuestions): void { $questions = $generateManageRelatedRecordsPageCommandQuestions; $runGenerateManageRelatedRecordsPageCommand($this) diff --git a/tests/src/Panels/Commands/MakeRelationManagerCommandTest.php b/tests/src/Panels/Commands/MakeRelationManagerCommandTest.php index 361154c0e7..1b1232ce2d 100644 --- a/tests/src/Panels/Commands/MakeRelationManagerCommandTest.php +++ b/tests/src/Panels/Commands/MakeRelationManagerCommandTest.php @@ -9,7 +9,7 @@ use function PHPUnit\Framework\assertFileExists; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { $this->withoutMockingConsoleOutput(); $this->artisan('make:filament-resource', [ @@ -50,7 +50,7 @@ beforeEach(function () { }) ->skip((bool) Arr::get($_SERVER, 'PARATEST'), 'File generation tests cannot be run in parallel as they would share a filesystem and have the potential to conflict with each other.'); -it('can generate a relation manager', function () { +it('can generate a relation manager', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', @@ -65,7 +65,7 @@ it('can generate a relation manager', function () { ->toMatchSnapshot(); }); -it('can generate a relation manager with a related resource', function () { +it('can generate a relation manager with a related resource', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', @@ -79,7 +79,7 @@ it('can generate a relation manager with a related resource', function () { ->toMatchSnapshot(); }); -it('can generate a relation manager with a form schema class', function () { +it('can generate a relation manager with a form schema class', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', @@ -95,7 +95,7 @@ it('can generate a relation manager with a form schema class', function () { ->toMatchSnapshot(); }); -it('can generate a relation manager with a generated form schema and table columns', function () { +it('can generate a relation manager with a generated form schema and table columns', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', @@ -112,7 +112,7 @@ it('can generate a relation manager with a generated form schema and table colum ->toMatchSnapshot(); }); -it('can generate a relation manager with a view operation', function () { +it('can generate a relation manager with a view operation', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', @@ -128,7 +128,7 @@ it('can generate a relation manager with a view operation', function () { ->toMatchSnapshot(); }); -it('can generate a relation manager with an infolist schema class', function () { +it('can generate a relation manager with an infolist schema class', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', @@ -145,7 +145,7 @@ it('can generate a relation manager with an infolist schema class', function () ->toMatchSnapshot(); }); -it('can generate a relation manager with a table class', function () { +it('can generate a relation manager with a table class', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', @@ -161,7 +161,7 @@ it('can generate a relation manager with a table class', function () { ->toMatchSnapshot(); }); -it('can generate a relation manager with soft deletes', function () { +it('can generate a relation manager with soft deletes', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', @@ -177,7 +177,7 @@ it('can generate a relation manager with soft deletes', function () { ->toMatchSnapshot(); }); -it('can generate a relation manager for a `HasMany` relationship', function () { +it('can generate a relation manager for a `HasMany` relationship', function (): void { $this->artisan('make:filament-relation-manager', [ 'resource' => 'Users', 'relationship' => 'teams', diff --git a/tests/src/Panels/Commands/MakeResourceCommandTest.php b/tests/src/Panels/Commands/MakeResourceCommandTest.php index 7b920b53bf..e03ee28203 100644 --- a/tests/src/Panels/Commands/MakeResourceCommandTest.php +++ b/tests/src/Panels/Commands/MakeResourceCommandTest.php @@ -10,14 +10,14 @@ use function PHPUnit\Framework\assertFileExists; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { $this->withoutMockingConsoleOutput(); MakeResourceCommand::$shouldCheckModelsForSoftDeletes = false; }) ->skip((bool) Arr::get($_SERVER, 'PARATEST'), 'File generation tests cannot be run in parallel as they would share a filesystem and have the potential to conflict with each other.'); -it('can generate a resource class', function () { +it('can generate a resource class', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -30,7 +30,7 @@ it('can generate a resource class', function () { ->toMatchSnapshot(); }); -it('can generate a resource form', function () { +it('can generate a resource form', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -43,7 +43,7 @@ it('can generate a resource form', function () { ->toMatchSnapshot(); }); -it('can generate a resource infolist', function () { +it('can generate a resource infolist', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--view' => true, @@ -57,7 +57,7 @@ it('can generate a resource infolist', function () { ->toMatchSnapshot(); }); -it('can generate a resource table', function () { +it('can generate a resource table', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -70,7 +70,7 @@ it('can generate a resource table', function () { ->toMatchSnapshot(); }); -it('can generate a resource list page', function () { +it('can generate a resource list page', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -83,7 +83,7 @@ it('can generate a resource list page', function () { ->toMatchSnapshot(); }); -it('can generate a resource create page', function () { +it('can generate a resource create page', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -96,7 +96,7 @@ it('can generate a resource create page', function () { ->toMatchSnapshot(); }); -it('can generate a resource edit page', function () { +it('can generate a resource edit page', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -109,7 +109,7 @@ it('can generate a resource edit page', function () { ->toMatchSnapshot(); }); -it('can generate a resource view page', function () { +it('can generate a resource view page', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--view' => true, @@ -123,7 +123,7 @@ it('can generate a resource view page', function () { ->toMatchSnapshot(); }); -it('can generate a resource class with embedded form', function () { +it('can generate a resource class with embedded form', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--embed-schemas' => true, @@ -137,7 +137,7 @@ it('can generate a resource class with embedded form', function () { ->toMatchSnapshot(); }); -it('can generate a resource class with embedded infolist', function () { +it('can generate a resource class with embedded infolist', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--embed-schemas' => true, @@ -152,7 +152,7 @@ it('can generate a resource class with embedded infolist', function () { ->toMatchSnapshot(); }); -it('can generate a resource class with embedded table', function () { +it('can generate a resource class with embedded table', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--embed-table' => true, @@ -166,7 +166,7 @@ it('can generate a resource class with embedded table', function () { ->toMatchSnapshot(); }); -it('can generate the resource form content', function () { +it('can generate the resource form content', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--generate' => true, @@ -180,7 +180,7 @@ it('can generate the resource form content', function () { ->toMatchSnapshot(); }); -it('can generate the resource table content', function () { +it('can generate the resource table content', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--generate' => true, @@ -194,7 +194,7 @@ it('can generate the resource table content', function () { ->toMatchSnapshot(); }); -it('can generate the form and table content embedded in a resource class', function () { +it('can generate the form and table content embedded in a resource class', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--embed-schemas' => true, @@ -210,7 +210,7 @@ it('can generate the form and table content embedded in a resource class', funct ->toMatchSnapshot(); }); -it('can generate a resource class with soft deletes', function () { +it('can generate a resource class with soft deletes', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--soft-deletes' => true, @@ -224,7 +224,7 @@ it('can generate a resource class with soft deletes', function () { ->toMatchSnapshot(); }); -it('can generate a resource table with soft deletes', function () { +it('can generate a resource table with soft deletes', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--soft-deletes' => true, @@ -238,7 +238,7 @@ it('can generate a resource table with soft deletes', function () { ->toMatchSnapshot(); }); -it('can generate a resource edit page with soft deletes', function () { +it('can generate a resource edit page with soft deletes', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--soft-deletes' => true, @@ -252,7 +252,7 @@ it('can generate a resource edit page with soft deletes', function () { ->toMatchSnapshot(); }); -it('can generate a simple resource class', function () { +it('can generate a simple resource class', function (): void { foreach ([ app_path('Filament/Resources/Posts/Schemas/PostForm.php'), app_path('Filament/Resources/Posts/Schemas/PostInfolist.php'), @@ -282,7 +282,7 @@ it('can generate a simple resource class', function () { assertFileDoesNotExist(app_path('Filament/Resources/Posts/Tables/PostsTable.php')); }); -it('can generate a simple resource manage page', function () { +it('can generate a simple resource manage page', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--simple' => true, @@ -296,7 +296,7 @@ it('can generate a simple resource manage page', function () { ->toMatchSnapshot(); }); -it('can generate a simple resource class without embedded schemas and table', function () { +it('can generate a simple resource class without embedded schemas and table', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Post', '--not-embedded' => true, @@ -312,7 +312,7 @@ it('can generate a simple resource class without embedded schemas and table', fu ->toMatchSnapshot(); }); -it('can generate a resource class in a nested directory', function () { +it('can generate a resource class in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -325,7 +325,7 @@ it('can generate a resource class in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a resource form in a nested directory', function () { +it('can generate a resource form in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -338,7 +338,7 @@ it('can generate a resource form in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a resource infolist in a nested directory', function () { +it('can generate a resource infolist in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--view' => true, @@ -352,7 +352,7 @@ it('can generate a resource infolist in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a resource table in a nested directory', function () { +it('can generate a resource table in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -365,7 +365,7 @@ it('can generate a resource table in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a resource list page in a nested directory', function () { +it('can generate a resource list page in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -378,7 +378,7 @@ it('can generate a resource list page in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a resource create page in a nested directory', function () { +it('can generate a resource create page in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -391,7 +391,7 @@ it('can generate a resource create page in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a resource edit page in a nested directory', function () { +it('can generate a resource edit page in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--model-namespace' => 'Filament\Tests\Fixtures\Models', @@ -404,7 +404,7 @@ it('can generate a resource edit page in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a resource view page in a nested directory', function () { +it('can generate a resource view page in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--view' => true, @@ -418,7 +418,7 @@ it('can generate a resource view page in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a simple resource manage page in a nested directory', function () { +it('can generate a simple resource manage page in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'Blog/Post', '--simple' => true, @@ -432,7 +432,7 @@ it('can generate a simple resource manage page in a nested directory', function ->toMatchSnapshot(); }); -it('can generate a nested resource class', function () { +it('can generate a nested resource class', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'User', '--panel' => 'admin', @@ -462,7 +462,7 @@ it('can generate a nested resource class', function () { ->toMatchSnapshot(); }); -it('can generate a nested resource class with a plural parent resource name', function () { +it('can generate a nested resource class with a plural parent resource name', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'User', '--panel' => 'admin', @@ -492,7 +492,7 @@ it('can generate a nested resource class with a plural parent resource name', fu ->toMatchSnapshot(); }); -it('can generate a nested resource class with a parent resource name with `Resource` at the end', function () { +it('can generate a nested resource class with a parent resource name with `Resource` at the end', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'User', '--panel' => 'admin', @@ -522,7 +522,7 @@ it('can generate a nested resource class with a parent resource name with `Resou ->toMatchSnapshot(); }); -it('can generate a nested resource form', function () { +it('can generate a nested resource form', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'User', '--panel' => 'admin', @@ -552,7 +552,7 @@ it('can generate a nested resource form', function () { ->toMatchSnapshot(); }); -it('can generate a nested resource infolist', function () { +it('can generate a nested resource infolist', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'User', '--panel' => 'admin', @@ -583,7 +583,7 @@ it('can generate a nested resource infolist', function () { ->toMatchSnapshot(); }); -it('can generate a nested resource create page', function () { +it('can generate a nested resource create page', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'User', '--panel' => 'admin', @@ -613,7 +613,7 @@ it('can generate a nested resource create page', function () { ->toMatchSnapshot(); }); -it('can generate a nested resource edit page', function () { +it('can generate a nested resource edit page', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'User', '--panel' => 'admin', @@ -643,7 +643,7 @@ it('can generate a nested resource edit page', function () { ->toMatchSnapshot(); }); -it('can generate a nested resource view page', function () { +it('can generate a nested resource view page', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'User', '--panel' => 'admin', @@ -674,7 +674,7 @@ it('can generate a nested resource view page', function () { ->toMatchSnapshot(); }); -it('can generate a nested resource class in a nested directory', function () { +it('can generate a nested resource class in a nested directory', function (): void { $this->artisan('make:filament-resource', [ 'model' => 'User', '--panel' => 'admin', diff --git a/tests/src/Panels/Commands/MakeSettingsPageCommandTest.php b/tests/src/Panels/Commands/MakeSettingsPageCommandTest.php index e46c24d0bf..0c489164ec 100644 --- a/tests/src/Panels/Commands/MakeSettingsPageCommandTest.php +++ b/tests/src/Panels/Commands/MakeSettingsPageCommandTest.php @@ -16,12 +16,12 @@ use function PHPUnit\Framework\assertFileExists; uses(TestCase::class); -beforeEach(function () { +beforeEach(function (): void { $this->withoutMockingConsoleOutput(); }) ->skip((bool) Arr::get($_SERVER, 'PARATEST'), 'File generation tests cannot be run in parallel as they would share a filesystem and have the potential to conflict with each other.'); -it('can generate a page class', function () { +it('can generate a page class', function (): void { $this->artisan('make:filament-settings-page', [ 'name' => 'ManageSettings', 'settings' => Settings::class, @@ -34,7 +34,7 @@ it('can generate a page class', function () { ->toMatchSnapshot(); }); -it('can generate a page class in a nested directory', function () { +it('can generate a page class in a nested directory', function (): void { $this->artisan('make:filament-settings-page', [ 'name' => 'Site/ManageSettings', 'settings' => Settings::class, @@ -47,7 +47,7 @@ it('can generate a page class in a nested directory', function () { ->toMatchSnapshot(); }); -it('can generate a page class in a cluster', function () { +it('can generate a page class in a cluster', function (): void { $this->artisan('make:filament-cluster', [ 'name' => 'Site', '--panel' => 'admin', @@ -69,7 +69,7 @@ it('can generate a page class in a cluster', function () { ->toMatchSnapshot(); }); -it('can generate a page class with a generated form schema', function () { +it('can generate a page class with a generated form schema', function (): void { $this->artisan('make:filament-settings-page', [ 'name' => 'ManageSettings', 'settings' => Settings::class, diff --git a/tests/src/Panels/GlobalSearch/GlobalSearchTest.php b/tests/src/Panels/GlobalSearch/GlobalSearchTest.php index e590aff3f2..bac0f23139 100644 --- a/tests/src/Panels/GlobalSearch/GlobalSearchTest.php +++ b/tests/src/Panels/GlobalSearch/GlobalSearchTest.php @@ -14,12 +14,12 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can render', function () { +it('can render', function (): void { livewire(GlobalSearch::class) ->assertSeeHtml('search'); }); -it('can retrieve search results', function () { +it('can retrieve search results', function (): void { $post = Post::factory()->create(); livewire(GlobalSearch::class) @@ -28,7 +28,7 @@ it('can retrieve search results', function () { ->assertSee($post->title); }); -it('can retrieve limited search results', function () { +it('can retrieve limited search results', function (): void { $title = Str::random(); $posts = Post::factory() @@ -50,7 +50,7 @@ it('can retrieve limited search results', function () { ->assertDontSee($posts[3]->title); }); -it('can retrieve results via custom search provider', function () { +it('can retrieve results via custom search provider', function (): void { Filament::getCurrentOrDefaultPanel()->globalSearch(CustomSearchProvider::class); livewire(GlobalSearch::class) diff --git a/tests/src/Panels/HelpersTest.php b/tests/src/Panels/HelpersTest.php index 3af22442c9..5dbc657388 100644 --- a/tests/src/Panels/HelpersTest.php +++ b/tests/src/Panels/HelpersTest.php @@ -5,7 +5,7 @@ use Filament\Tests\TestCase; uses(TestCase::class); -it('can retrieve `FilamentManager` from container', function () { +it('can retrieve `FilamentManager` from container', function (): void { $this->assertInstanceOf( FilamentManager::class, filament(), diff --git a/tests/src/Panels/Navigation/NavigationBuilderTest.php b/tests/src/Panels/Navigation/NavigationBuilderTest.php index d44be3455c..82ec059d5e 100644 --- a/tests/src/Panels/Navigation/NavigationBuilderTest.php +++ b/tests/src/Panels/Navigation/NavigationBuilderTest.php @@ -15,7 +15,7 @@ use Filament\Tests\Panels\Navigation\TestCase; uses(TestCase::class); -it('can register navigation', function () { +it('can register navigation', function (): void { Filament::getCurrentOrDefaultPanel()->navigation(function (NavigationBuilder $navigation): NavigationBuilder { return $navigation ->items([ @@ -80,7 +80,7 @@ it('can register navigation', function () { ); }); -it('can register navigation groups individually', function () { +it('can register navigation groups individually', function (): void { Filament::getCurrentOrDefaultPanel()->navigation(function (NavigationBuilder $navigation): NavigationBuilder { return $navigation ->group('Blog', [ diff --git a/tests/src/Panels/Navigation/NavigationTest.php b/tests/src/Panels/Navigation/NavigationTest.php index 26f338d1b1..ac7dd76283 100644 --- a/tests/src/Panels/Navigation/NavigationTest.php +++ b/tests/src/Panels/Navigation/NavigationTest.php @@ -8,7 +8,7 @@ use Filament\Tests\Panels\Navigation\TestCase; uses(TestCase::class); -it('can register navigation items from resources and pages', function () { +it('can register navigation items from resources and pages', function (): void { expect(Filament::getNavigation()) ->sequence( fn ($group) => $group @@ -64,7 +64,7 @@ it('can register navigation items from resources and pages', function () { ); }); -it('can reorder navigation groups by registering them', function () { +it('can reorder navigation groups by registering them', function (): void { Filament::getCurrentOrDefaultPanel()->navigationGroups([ NavigationGroup::make()->label('Shop'), NavigationGroup::make()->label('Blog'), @@ -84,7 +84,7 @@ it('can reorder navigation groups by registering them', function () { ); }); -it('can reorder navigation groups by registering them with different labels', function () { +it('can reorder navigation groups by registering them with different labels', function (): void { Filament::getCurrentOrDefaultPanel()->navigationGroups([ 'Shop' => NavigationGroup::make()->label('Store'), 'Blog' => NavigationGroup::make()->label('Posts'), @@ -104,7 +104,7 @@ it('can reorder navigation groups by registering them with different labels', fu ); }); -it('can reorder navigation groups by registering their labels', function () { +it('can reorder navigation groups by registering their labels', function (): void { Filament::getCurrentOrDefaultPanel()->navigationGroups([ 'Shop', 'Blog', diff --git a/tests/src/Panels/Pages/PageTest.php b/tests/src/Panels/Pages/PageTest.php index 8c600c5cd3..33981c527e 100644 --- a/tests/src/Panels/Pages/PageTest.php +++ b/tests/src/Panels/Pages/PageTest.php @@ -10,18 +10,18 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can render page', function () { +it('can render page', function (): void { $this->get(Settings::getUrl()) ->assertSuccessful(); }); -it('can generate a slug based on the page name', function () { +it('can generate a slug based on the page name', function (): void { expect(Settings::getSlug()) ->toBe('settings'); }); -it('can report validation errors', function () { - Page::$reportValidationErrorUsing = function (ValidationException $exception) { +it('can report validation errors', function (): void { + Page::$reportValidationErrorUsing = function (ValidationException $exception): void { Notification::make() ->danger() ->title($exception->getMessage()) diff --git a/tests/src/Panels/Pages/RegistrationTest.php b/tests/src/Panels/Pages/RegistrationTest.php index 29b9313ec8..c5b068e90c 100644 --- a/tests/src/Panels/Pages/RegistrationTest.php +++ b/tests/src/Panels/Pages/RegistrationTest.php @@ -6,7 +6,7 @@ use Filament\Tests\Panels\Pages\TestCase; uses(TestCase::class); -it('can register pages', function () { +it('can register pages', function (): void { expect(Filament::getPages()) ->toContain(Settings::class); }); diff --git a/tests/src/Panels/Pages/Tenancy/EditTenantProfileTest.php b/tests/src/Panels/Pages/Tenancy/EditTenantProfileTest.php index 002aa21cf2..e8b3f137cc 100644 --- a/tests/src/Panels/Pages/Tenancy/EditTenantProfileTest.php +++ b/tests/src/Panels/Pages/Tenancy/EditTenantProfileTest.php @@ -11,7 +11,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('allows the user access to the tenant profile page if the user is authorized', function () { +it('allows the user access to the tenant profile page if the user is authorized', function (): void { Filament::setTenant(Team::factory()->create()); Gate::policy(Team::class, TeamPolicyWithAccess::class); @@ -20,7 +20,7 @@ it('allows the user access to the tenant profile page if the user is authorized' ->assertSuccessful(); }); -it('denies the user access to the tenant profile page if the user is unauthorized', function () { +it('denies the user access to the tenant profile page if the user is unauthorized', function (): void { Filament::setTenant(Team::factory()->create()); Gate::policy(Team::class, TeamPolicyWithoutAccess::class); diff --git a/tests/src/Panels/Resources/Pages/CreateRecordTest.php b/tests/src/Panels/Resources/Pages/CreateRecordTest.php index 2d202fadaf..a70aa7a893 100644 --- a/tests/src/Panels/Resources/Pages/CreateRecordTest.php +++ b/tests/src/Panels/Resources/Pages/CreateRecordTest.php @@ -15,12 +15,12 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can render page', function () { +it('can render page', function (): void { $this->get(PostResource::getUrl('create')) ->assertSuccessful(); }); -it('can create', function () { +it('can create', function (): void { $newData = Post::factory()->make(); livewire(CreatePost::class) @@ -44,7 +44,7 @@ it('can create', function () { ]); }); -it('can create another', function () { +it('can create another', function (): void { $newData = Post::factory()->make(); $newData2 = Post::factory()->make(); @@ -94,7 +94,7 @@ it('can create another', function () { ]); }); -it('can create another and preserve data', function () { +it('can create another and preserve data', function (): void { $newData = Post::factory()->make(); $newData2 = Post::factory()->make(); @@ -142,7 +142,7 @@ it('can create another and preserve data', function () { ]); }); -it('can validate input', function () { +it('can validate input', function (): void { Post::factory()->make(); livewire(CreatePost::class) @@ -153,19 +153,19 @@ it('can validate input', function () { ->assertHasFormErrors(['title' => 'required']); }); -it('can render page without a policy', function () { +it('can render page without a policy', function (): void { $this->get(TicketMessageResource::getUrl('create')) ->assertSuccessful(); }); -it('can render page if the policy viewAny returns true', function () { +it('can render page if the policy viewAny returns true', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); $this->get(TicketResource::getUrl('create')) ->assertSuccessful(); }); -it('can render page if the policy viewAny returns an allowed response', function () { +it('can render page if the policy viewAny returns an allowed response', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): Response => Response::allow()); $this->get(TicketResource::getUrl('create')) @@ -174,7 +174,7 @@ it('can render page if the policy viewAny returns an allowed response', function app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render page without a policy if authorization is strict', function () { +it('does not render page without a policy if authorization is strict', function (): void { Filament::getCurrentOrDefaultPanel()->strictAuthorization(); $this->get(TicketMessageResource::getUrl('create')) @@ -183,7 +183,7 @@ it('does not render page without a policy if authorization is strict', function Filament::getCurrentOrDefaultPanel()->strictAuthorization(false); }); -it('does not render page if the policy viewAny returns false', function () { +it('does not render page if the policy viewAny returns false', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => false); $this->get(TicketResource::getUrl('create')) @@ -192,7 +192,7 @@ it('does not render page if the policy viewAny returns false', function () { app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render page if the policy viewAny returns a denied response', function () { +it('does not render page if the policy viewAny returns a denied response', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): Response => Response::deny()); $this->get(TicketResource::getUrl('create')) @@ -201,14 +201,14 @@ it('does not render page if the policy viewAny returns a denied response', funct app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('can render page if the policy create returns true', function () { +it('can render page if the policy create returns true', function (): void { app()->bind(TicketPolicy::class . '::create', fn (): bool => true); $this->get(TicketResource::getUrl('create')) ->assertSuccessful(); }); -it('can render page if the policy create returns an allowed response', function () { +it('can render page if the policy create returns an allowed response', function (): void { app()->bind(TicketPolicy::class . '::create', fn (): Response => Response::allow()); $this->get(TicketResource::getUrl('create')) @@ -217,7 +217,7 @@ it('can render page if the policy create returns an allowed response', function app()->bind(TicketPolicy::class . '::create', fn (): bool => true); }); -it('does not render page if the policy create returns false', function () { +it('does not render page if the policy create returns false', function (): void { app()->bind(TicketPolicy::class . '::create', fn (): bool => false); $this->get(TicketResource::getUrl('create')) @@ -226,7 +226,7 @@ it('does not render page if the policy create returns false', function () { app()->bind(TicketPolicy::class . '::create', fn (): bool => true); }); -it('does not render page if the policy create returns a denied response', function () { +it('does not render page if the policy create returns a denied response', function (): void { app()->bind(TicketPolicy::class . '::create', fn (): Response => Response::deny()); $this->get(TicketResource::getUrl('create')) diff --git a/tests/src/Panels/Resources/Pages/CreateRecordUsingWizardTest.php b/tests/src/Panels/Resources/Pages/CreateRecordUsingWizardTest.php index 3dc9c05ba8..89b24d42a3 100644 --- a/tests/src/Panels/Resources/Pages/CreateRecordUsingWizardTest.php +++ b/tests/src/Panels/Resources/Pages/CreateRecordUsingWizardTest.php @@ -7,7 +7,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('it validates the current wizard step when moving to the next wizard step', function () { +it('it validates the current wizard step when moving to the next wizard step', function (): void { livewire(CreatePostUsingWizard::class) ->goToWizardStep(2) ->assertHasFormErrors(['title']) @@ -17,7 +17,7 @@ it('it validates the current wizard step when moving to the next wizard step', f ->assertHasNoFormErrors(); }); -it('it verifies what wizard step we are currently in', function () { +it('it verifies what wizard step we are currently in', function (): void { livewire(CreatePostUsingWizard::class) ->assertWizardCurrentStep(1) ->fillForm(['title' => 'Test title']) @@ -25,14 +25,14 @@ it('it verifies what wizard step we are currently in', function () { ->assertWizardCurrentStep(2); }); -it('it goes to the next wizard step', function () { +it('it goes to the next wizard step', function (): void { livewire(CreatePostUsingWizard::class) ->fillForm(['title' => 'Test title']) ->goToNextWizardStep() ->assertWizardCurrentStep(2); }); -it('it goes to the previous wizard step', function () { +it('it goes to the previous wizard step', function (): void { livewire(CreatePostUsingWizard::class) ->fillForm(['title' => 'Test title']) ->goToNextWizardStep() diff --git a/tests/src/Panels/Resources/Pages/EditRecordTest.php b/tests/src/Panels/Resources/Pages/EditRecordTest.php index b027166321..8d369fc6fc 100644 --- a/tests/src/Panels/Resources/Pages/EditRecordTest.php +++ b/tests/src/Panels/Resources/Pages/EditRecordTest.php @@ -25,13 +25,13 @@ use function Pest\Laravel\assertSoftDeleted; uses(TestCase::class); -it('can render page', function () { +it('can render page', function (): void { $this->get(PostResource::getUrl('edit', [ 'record' => Post::factory()->create(), ]))->assertSuccessful(); }); -it('can retrieve data', function () { +it('can retrieve data', function (): void { $post = Post::factory()->create(); livewire(EditPost::class, [ @@ -46,7 +46,7 @@ it('can retrieve data', function () { ]); }); -it('can save', function () { +it('can save', function (): void { $post = Post::factory()->create(); $newData = Post::factory()->make(); @@ -70,7 +70,7 @@ it('can save', function () { ->title->toBe($newData->title); }); -it('can validate input', function () { +it('can validate input', function (): void { $post = Post::factory()->create(); livewire(EditPost::class, [ @@ -83,7 +83,7 @@ it('can validate input', function () { ->assertHasFormErrors(['title' => 'required']); }); -it('can delete', function () { +it('can delete', function (): void { $post = Post::factory()->create(); livewire(EditPost::class, [ @@ -94,7 +94,7 @@ it('can delete', function () { assertSoftDeleted($post); }); -it('can refresh data', function () { +it('can refresh data', function (): void { $post = Post::factory()->create(); $page = livewire(EditPost::class, [ @@ -123,7 +123,7 @@ it('can refresh data', function () { ]); }); -it('can ticket messages page without a policy', function () { +it('can ticket messages page without a policy', function (): void { $message = TicketMessage::factory() ->create(); @@ -131,7 +131,7 @@ it('can ticket messages page without a policy', function () { ->assertSuccessful(); }); -it('can render page if the policy viewAny returns true', function () { +it('can render page if the policy viewAny returns true', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); $ticket = Ticket::factory() @@ -141,7 +141,7 @@ it('can render page if the policy viewAny returns true', function () { ->assertSuccessful(); }); -it('can render page if the policy viewAny returns an allowed response', function () { +it('can render page if the policy viewAny returns an allowed response', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): Response => Response::allow()); $ticket = Ticket::factory() @@ -153,7 +153,7 @@ it('can render page if the policy viewAny returns an allowed response', function app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render page without a policy if authorization is strict', function () { +it('does not render page without a policy if authorization is strict', function (): void { Filament::getCurrentOrDefaultPanel()->strictAuthorization(); $message = TicketMessage::factory() @@ -165,7 +165,7 @@ it('does not render page without a policy if authorization is strict', function Filament::getCurrentOrDefaultPanel()->strictAuthorization(false); }); -it('does not render page if the policy viewAny returns false', function () { +it('does not render page if the policy viewAny returns false', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => false); $ticket = Ticket::factory() @@ -177,7 +177,7 @@ it('does not render page if the policy viewAny returns false', function () { app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render page if the policy viewAny returns a denied response', function () { +it('does not render page if the policy viewAny returns a denied response', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): Response => Response::deny()); $ticket = Ticket::factory() @@ -189,7 +189,7 @@ it('does not render page if the policy viewAny returns a denied response', funct app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('can render page if the policy update returns true', function () { +it('can render page if the policy update returns true', function (): void { app()->bind(TicketPolicy::class . '::update', fn (): bool => true); $ticket = Ticket::factory() @@ -199,7 +199,7 @@ it('can render page if the policy update returns true', function () { ->assertSuccessful(); }); -it('can render page if the policy update returns an allowed response', function () { +it('can render page if the policy update returns an allowed response', function (): void { app()->bind(TicketPolicy::class . '::update', fn (): Response => Response::allow()); $ticket = Ticket::factory() @@ -211,7 +211,7 @@ it('can render page if the policy update returns an allowed response', function app()->bind(TicketPolicy::class . '::update', fn (): bool => true); }); -it('does not render page if the policy update returns false', function () { +it('does not render page if the policy update returns false', function (): void { app()->bind(TicketPolicy::class . '::update', fn (): bool => false); $ticket = Ticket::factory() @@ -223,7 +223,7 @@ it('does not render page if the policy update returns false', function () { app()->bind(TicketPolicy::class . '::update', fn (): bool => true); }); -it('does not render page if the policy update returns a denied response', function () { +it('does not render page if the policy update returns a denied response', function (): void { app()->bind(TicketPolicy::class . '::update', fn (): Response => Response::deny()); $ticket = Ticket::factory() @@ -235,7 +235,7 @@ it('does not render page if the policy update returns a denied response', functi app()->bind(TicketPolicy::class . '::update', fn (): bool => true); }); -it('renders actions based on policy', function (string $action, string $policyMethod, bool | Response $policyResult, bool $isVisible, bool $isSoftDeleted = false) { +it('renders actions based on policy', function (string $action, string $policyMethod, bool | Response $policyResult, bool $isVisible, bool $isSoftDeleted = false): void { app()->bind(TicketPolicy::class . '::' . $policyMethod, fn (): bool | Response => $policyResult); $ticket = Ticket::factory() diff --git a/tests/src/Panels/Resources/Pages/ListRecordsTest.php b/tests/src/Panels/Resources/Pages/ListRecordsTest.php index 1c245cf952..a2b2b68516 100644 --- a/tests/src/Panels/Resources/Pages/ListRecordsTest.php +++ b/tests/src/Panels/Resources/Pages/ListRecordsTest.php @@ -30,38 +30,38 @@ use function Pest\Laravel\assertSoftDeleted; uses(TestCase::class); -it('can render posts page', function () { +it('can render posts page', function (): void { $this->get(PostResource::getUrl('index')) ->assertSuccessful(); }); -it('can render users page', function () { +it('can render users page', function (): void { $this->get(UserResource::getUrl('index')) ->assertSuccessful(); }); -it('can list posts', function () { +it('can list posts', function (): void { $posts = Post::factory()->count(10)->create(); livewire(ListPosts::class) ->assertCanSeeTableRecords($posts); }); -it('can render post titles', function () { +it('can render post titles', function (): void { Post::factory()->count(10)->create(); livewire(ListPosts::class) ->assertCanRenderTableColumn('title'); }); -it('can render post authors', function () { +it('can render post authors', function (): void { Post::factory()->count(10)->create(); livewire(ListPosts::class) ->assertCanRenderTableColumn('author.name'); }); -it('can sort posts by title', function () { +it('can sort posts by title', function (): void { $posts = Post::factory()->count(10)->create(); livewire(ListPosts::class) @@ -71,7 +71,7 @@ it('can sort posts by title', function () { ->assertCanSeeTableRecords($posts->sortByDesc('title'), inOrder: true); }); -it('can sort posts by author', function () { +it('can sort posts by author', function (): void { $posts = Post::factory()->count(10)->create(); livewire(ListPosts::class) @@ -81,7 +81,7 @@ it('can sort posts by author', function () { ->assertCanSeeTableRecords($posts->sortByDesc('author.name'), inOrder: true); }); -it('can search posts by title', function () { +it('can search posts by title', function (): void { $posts = Post::factory()->count(10)->create(); $title = $posts->first()->title; @@ -92,7 +92,7 @@ it('can search posts by title', function () { ->assertCanNotSeeTableRecords($posts->where('title', '!=', $title)); }); -it('can search posts by author', function () { +it('can search posts by author', function (): void { $posts = Post::factory()->count(10)->create(); $author = $posts->first()->author->name; @@ -103,7 +103,7 @@ it('can search posts by author', function () { ->assertCanNotSeeTableRecords($posts->where('author.name', '!=', $author)); }); -it('can filter posts by `is_published`', function () { +it('can filter posts by `is_published`', function (): void { $posts = Post::factory()->count(10)->create(); livewire(ListPosts::class) @@ -113,7 +113,7 @@ it('can filter posts by `is_published`', function () { ->assertCanNotSeeTableRecords($posts->where('is_published', false)); }); -it('can delete posts', function () { +it('can delete posts', function (): void { $post = Post::factory()->create(); livewire(ListPosts::class) @@ -122,7 +122,7 @@ it('can delete posts', function () { assertSoftDeleted($post); }); -it('can bulk delete posts', function () { +it('can bulk delete posts', function (): void { $posts = Post::factory()->count(10)->create(); livewire(ListPosts::class) @@ -133,7 +133,7 @@ it('can bulk delete posts', function () { } }); -it('can render ticket messages page without a policy', function () { +it('can render ticket messages page without a policy', function (): void { TicketMessage::factory(10) ->create(); @@ -141,7 +141,7 @@ it('can render ticket messages page without a policy', function () { ->assertSuccessful(); }); -it('can render tickets page if the policy viewAny returns true', function () { +it('can render tickets page if the policy viewAny returns true', function (): void { Ticket::factory(10) ->create(); @@ -151,7 +151,7 @@ it('can render tickets page if the policy viewAny returns true', function () { ->assertSuccessful(); }); -it('can render tickets page if the policy viewAny returns an allowed response', function () { +it('can render tickets page if the policy viewAny returns an allowed response', function (): void { Ticket::factory(10) ->create(); @@ -163,7 +163,7 @@ it('can render tickets page if the policy viewAny returns an allowed response', app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render ticket messages page without a policy if authorization is strict', function () { +it('does not render ticket messages page without a policy if authorization is strict', function (): void { Filament::getCurrentOrDefaultPanel()->strictAuthorization(); TicketMessage::factory(10) @@ -175,7 +175,7 @@ it('does not render ticket messages page without a policy if authorization is st Filament::getCurrentOrDefaultPanel()->strictAuthorization(false); }); -it('does not render tickets page if the policy viewAny returns false', function () { +it('does not render tickets page if the policy viewAny returns false', function (): void { Ticket::factory(10) ->create(); @@ -187,7 +187,7 @@ it('does not render tickets page if the policy viewAny returns false', function app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render tickets page if the policy viewAny returns a denied response', function () { +it('does not render tickets page if the policy viewAny returns a denied response', function (): void { Ticket::factory(10) ->create(); @@ -199,7 +199,7 @@ it('does not render tickets page if the policy viewAny returns a denied response app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('renders actions based on policy', function (string $action, string $policyMethod, bool | Response $policyResult, bool $isVisible, bool $isSoftDeleted = false, bool $isTableAction = false, bool $isBulkAction = false) { +it('renders actions based on policy', function (string $action, string $policyMethod, bool | Response $policyResult, bool $isVisible, bool $isSoftDeleted = false, bool $isTableAction = false, bool $isBulkAction = false): void { app()->bind(TicketPolicy::class . '::' . $policyMethod, fn (): bool | Response => $policyResult); if ($isTableAction) { diff --git a/tests/src/Panels/Resources/Pages/ManageRelatedRecordsTest.php b/tests/src/Panels/Resources/Pages/ManageRelatedRecordsTest.php index 9eac3a5fb7..4393150e14 100644 --- a/tests/src/Panels/Resources/Pages/ManageRelatedRecordsTest.php +++ b/tests/src/Panels/Resources/Pages/ManageRelatedRecordsTest.php @@ -24,7 +24,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can render page', function () { +it('can render page', function (): void { $ticket = Ticket::factory() ->create(); @@ -32,7 +32,7 @@ it('can render page', function () { ->assertSuccessful(); }); -it('can list departments', function () { +it('can list departments', function (): void { $ticket = Ticket::factory() ->hasAttached(Department::factory(10)) ->create(); @@ -41,7 +41,7 @@ it('can list departments', function () { ->assertCanSeeTableRecords($ticket->departments); }); -it('can render page if the policy viewAny returns true', function () { +it('can render page if the policy viewAny returns true', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); $ticket = Ticket::factory() @@ -51,7 +51,7 @@ it('can render page if the policy viewAny returns true', function () { ->assertSuccessful(); }); -it('can render page if the policy viewAny returns an allowed response', function () { +it('can render page if the policy viewAny returns an allowed response', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): Response => Response::allow()); $ticket = Ticket::factory() @@ -63,7 +63,7 @@ it('can render page if the policy viewAny returns an allowed response', function app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render page if the policy viewAny returns false', function () { +it('does not render page if the policy viewAny returns false', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => false); $ticket = Ticket::factory() @@ -75,7 +75,7 @@ it('does not render page if the policy viewAny returns false', function () { app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render page if the policy viewAny returns a denied response', function () { +it('does not render page if the policy viewAny returns a denied response', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): Response => Response::deny()); $ticket = Ticket::factory() @@ -87,7 +87,7 @@ it('does not render page if the policy viewAny returns a denied response', funct app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('can render page if the related policy viewAny returns true', function () { +it('can render page if the related policy viewAny returns true', function (): void { app()->bind(DepartmentPolicy::class . '::viewAny', fn (): bool => true); $ticket = Ticket::factory() @@ -97,7 +97,7 @@ it('can render page if the related policy viewAny returns true', function () { ->assertSuccessful(); }); -it('can render page if the related policy viewAny returns an allowed response', function () { +it('can render page if the related policy viewAny returns an allowed response', function (): void { app()->bind(DepartmentPolicy::class . '::viewAny', fn (): Response => Response::allow()); $ticket = Ticket::factory() @@ -109,7 +109,7 @@ it('can render page if the related policy viewAny returns an allowed response', app()->bind(DepartmentPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render page if the related policy viewAny returns false', function () { +it('does not render page if the related policy viewAny returns false', function (): void { app()->bind(DepartmentPolicy::class . '::viewAny', fn (): bool => false); $ticket = Ticket::factory() @@ -121,7 +121,7 @@ it('does not render page if the related policy viewAny returns false', function app()->bind(DepartmentPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render page if the related policy viewAny returns a denied response', function () { +it('does not render page if the related policy viewAny returns a denied response', function (): void { app()->bind(DepartmentPolicy::class . '::viewAny', fn (): Response => Response::deny()); $ticket = Ticket::factory() @@ -133,7 +133,7 @@ it('does not render page if the related policy viewAny returns a denied response app()->bind(DepartmentPolicy::class . '::viewAny', fn (): bool => true); }); -it('renders actions based on policy', function (string $action, string $policyMethod, bool | Response $policyResult, bool $isVisible, bool $isSoftDeleted = false, bool $isTableAction = false, bool $isBulkAction = false) { +it('renders actions based on policy', function (string $action, string $policyMethod, bool | Response $policyResult, bool $isVisible, bool $isSoftDeleted = false, bool $isTableAction = false, bool $isBulkAction = false): void { $policy = ($isTableAction || ($policyMethod === 'create')) ? DepartmentPolicy::class : TicketPolicy::class; app()->bind("{$policy}::{$policyMethod}", fn (): bool | Response => $policyResult); diff --git a/tests/src/Panels/Resources/Pages/ViewRecordTest.php b/tests/src/Panels/Resources/Pages/ViewRecordTest.php index 005a61370c..35c52c3124 100644 --- a/tests/src/Panels/Resources/Pages/ViewRecordTest.php +++ b/tests/src/Panels/Resources/Pages/ViewRecordTest.php @@ -24,13 +24,13 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can render page', function () { +it('can render page', function (): void { $this->get(PostResource::getUrl('view', [ 'record' => Post::factory()->create(), ]))->assertSuccessful(); }); -it('can retrieve data', function () { +it('can retrieve data', function (): void { $post = Post::factory()->create(); livewire(ViewPost::class, [ @@ -44,7 +44,7 @@ it('can retrieve data', function () { ]); }); -it('can refresh data', function () { +it('can refresh data', function (): void { $post = Post::factory()->create(); $page = livewire(ViewPost::class, [ @@ -73,7 +73,7 @@ it('can refresh data', function () { ]); }); -it('can ticket messages page without a policy', function () { +it('can ticket messages page without a policy', function (): void { $message = TicketMessage::factory() ->create(); @@ -81,7 +81,7 @@ it('can ticket messages page without a policy', function () { ->assertSuccessful(); }); -it('can render tickets page if the policy viewAny returns true', function () { +it('can render tickets page if the policy viewAny returns true', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); $ticket = Ticket::factory() @@ -91,7 +91,7 @@ it('can render tickets page if the policy viewAny returns true', function () { ->assertSuccessful(); }); -it('can render tickets page if the policy viewAny returns an allowed response', function () { +it('can render tickets page if the policy viewAny returns an allowed response', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): Response => Response::allow()); $ticket = Ticket::factory() @@ -103,7 +103,7 @@ it('can render tickets page if the policy viewAny returns an allowed response', app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render ticket messages page without a policy if authorization is strict', function () { +it('does not render ticket messages page without a policy if authorization is strict', function (): void { Filament::getCurrentOrDefaultPanel()->strictAuthorization(); $message = TicketMessage::factory() @@ -115,7 +115,7 @@ it('does not render ticket messages page without a policy if authorization is st Filament::getCurrentOrDefaultPanel()->strictAuthorization(false); }); -it('does not render tickets page if the policy viewAny returns false', function () { +it('does not render tickets page if the policy viewAny returns false', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => false); $ticket = Ticket::factory() @@ -127,7 +127,7 @@ it('does not render tickets page if the policy viewAny returns false', function app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render tickets page if the policy viewAny returns a denied response', function () { +it('does not render tickets page if the policy viewAny returns a denied response', function (): void { app()->bind(TicketPolicy::class . '::viewAny', fn (): Response => Response::deny()); $ticket = Ticket::factory() @@ -139,7 +139,7 @@ it('does not render tickets page if the policy viewAny returns a denied response app()->bind(TicketPolicy::class . '::viewAny', fn (): bool => true); }); -it('can render tickets page if the policy view returns true', function () { +it('can render tickets page if the policy view returns true', function (): void { app()->bind(TicketPolicy::class . '::view', fn (): bool => true); $ticket = Ticket::factory() @@ -149,7 +149,7 @@ it('can render tickets page if the policy view returns true', function () { ->assertSuccessful(); }); -it('can render tickets page if the policy view returns an allowed response', function () { +it('can render tickets page if the policy view returns an allowed response', function (): void { app()->bind(TicketPolicy::class . '::view', fn (): Response => Response::allow()); $ticket = Ticket::factory() @@ -161,7 +161,7 @@ it('can render tickets page if the policy view returns an allowed response', fun app()->bind(TicketPolicy::class . '::view', fn (): bool => true); }); -it('does not render tickets page if the policy view returns false', function () { +it('does not render tickets page if the policy view returns false', function (): void { app()->bind(TicketPolicy::class . '::view', fn (): bool => false); $ticket = Ticket::factory() @@ -173,7 +173,7 @@ it('does not render tickets page if the policy view returns false', function () app()->bind(TicketPolicy::class . '::view', fn (): bool => true); }); -it('does not render tickets page if the policy view returns a denied response', function () { +it('does not render tickets page if the policy view returns a denied response', function (): void { app()->bind(TicketPolicy::class . '::view', fn (): Response => Response::deny()); $ticket = Ticket::factory() @@ -185,7 +185,7 @@ it('does not render tickets page if the policy view returns a denied response', app()->bind(TicketPolicy::class . '::view', fn (): bool => true); }); -it('renders actions based on policy', function (string $action, string $policyMethod, bool | Response $policyResult, bool $isVisible, bool $isSoftDeleted = false) { +it('renders actions based on policy', function (string $action, string $policyMethod, bool | Response $policyResult, bool $isVisible, bool $isSoftDeleted = false): void { app()->bind(TicketPolicy::class . '::' . $policyMethod, fn (): bool | Response => $policyResult); $ticket = Ticket::factory() diff --git a/tests/src/Panels/Resources/RegistrationTest.php b/tests/src/Panels/Resources/RegistrationTest.php index 0907ea4f83..2312f17220 100644 --- a/tests/src/Panels/Resources/RegistrationTest.php +++ b/tests/src/Panels/Resources/RegistrationTest.php @@ -6,7 +6,7 @@ use Filament\Tests\Panels\Resources\TestCase; uses(TestCase::class); -it('can register resources', function () { +it('can register resources', function (): void { expect(Filament::getResources()) ->toContain(PostResource::class); }); diff --git a/tests/src/Panels/Resources/RelationManagerTest.php b/tests/src/Panels/Resources/RelationManagerTest.php index 718cf01a50..67b18760b5 100644 --- a/tests/src/Panels/Resources/RelationManagerTest.php +++ b/tests/src/Panels/Resources/RelationManagerTest.php @@ -23,7 +23,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can render relation manager', function () { +it('can render relation manager', function (): void { $ticket = Ticket::factory() ->create(); @@ -31,7 +31,7 @@ it('can render relation manager', function () { ->assertSuccessful(); }); -it('can list departments', function () { +it('can list departments', function (): void { $ticket = Ticket::factory() ->hasAttached(Department::factory(10)) ->create(); @@ -40,7 +40,7 @@ it('can list departments', function () { ->assertCanSeeTableRecords($ticket->departments); }); -it('can render relation manager if the policy viewAny returns true', function () { +it('can render relation manager if the policy viewAny returns true', function (): void { app()->bind(DepartmentPolicy::class . '::viewAny', fn (): bool => true); $ticket = Ticket::factory() @@ -51,7 +51,7 @@ it('can render relation manager if the policy viewAny returns true', function () )->toBeTrue(); }); -it('can render relation manager if the policy viewAny returns an allowed response', function () { +it('can render relation manager if the policy viewAny returns an allowed response', function (): void { app()->bind(DepartmentPolicy::class . '::viewAny', fn (): Response => Response::allow()); $ticket = Ticket::factory() @@ -64,7 +64,7 @@ it('can render relation manager if the policy viewAny returns an allowed respons app()->bind(DepartmentPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render relation manager if the policy viewAny returns false', function () { +it('does not render relation manager if the policy viewAny returns false', function (): void { app()->bind(DepartmentPolicy::class . '::viewAny', fn (): bool => false); $ticket = Ticket::factory() @@ -77,7 +77,7 @@ it('does not render relation manager if the policy viewAny returns false', funct app()->bind(DepartmentPolicy::class . '::viewAny', fn (): bool => true); }); -it('does not render relation manager if the policy viewAny returns a denied response', function () { +it('does not render relation manager if the policy viewAny returns a denied response', function (): void { app()->bind(DepartmentPolicy::class . '::viewAny', fn (): Response => Response::deny()); $ticket = Ticket::factory() @@ -90,7 +90,7 @@ it('does not render relation manager if the policy viewAny returns a denied resp app()->bind(DepartmentPolicy::class . '::viewAny', fn (): bool => true); }); -it('renders actions based on policy', function (string $action, string $policyMethod, bool | Response $policyResult, bool $isVisible, bool $isSoftDeleted = false, bool $isBulkAction = false) { +it('renders actions based on policy', function (string $action, string $policyMethod, bool | Response $policyResult, bool $isVisible, bool $isSoftDeleted = false, bool $isBulkAction = false): void { app()->bind(DepartmentPolicy::class . '::' . $policyMethod, fn (): bool | Response => $policyResult); $ticket = Ticket::factory() diff --git a/tests/src/Panels/Resources/ResourceTest.php b/tests/src/Panels/Resources/ResourceTest.php index 5b5f0bf160..c82acf075d 100644 --- a/tests/src/Panels/Resources/ResourceTest.php +++ b/tests/src/Panels/Resources/ResourceTest.php @@ -12,48 +12,48 @@ use Illuminate\Database\Eloquent\Builder; uses(TestCase::class); -it('can retrieve Eloquent query for model', function () { +it('can retrieve Eloquent query for model', function (): void { expect(PostResource::getEloquentQuery()) ->toBeInstanceOf(Builder::class) ->getModel()->toBeInstanceOf(Post::class); }); -it('can generate a slug based on the model name', function () { +it('can generate a slug based on the model name', function (): void { expect(PostResource::getSlug()) ->toBe('posts'); }); -it('can generate a slug based on the multi-word model name', function () { +it('can generate a slug based on the multi-word model name', function (): void { expect(PostCategoryResource::getSlug()) ->toBe('post-categories'); }); -it('can generate a nested slug based on the model name', function () { +it('can generate a nested slug based on the model name', function (): void { expect(ProductResource::getSlug()) ->toBe('shop/products'); }); -it('can generate a nested slug based on the model name with a resource outside of its directory', function () { +it('can generate a nested slug based on the model name with a resource outside of its directory', function (): void { expect(OrderResource::getSlug()) ->toBe('shop/orders'); }); -it('can generate a nested slug based on the multi-word model name', function () { +it('can generate a nested slug based on the multi-word model name', function (): void { expect(OrderInvoiceResource::getSlug()) ->toBe('shop/order-invoices'); }); -it('can generate a label based on the model name', function () { +it('can generate a label based on the model name', function (): void { expect(PostResource::getModelLabel()) ->toBe('post'); }); -it('can generate a label based on the multi-word model name', function () { +it('can generate a label based on the multi-word model name', function (): void { expect(PostCategoryResource::getModelLabel()) ->toBe('post category'); }); -it('can generate a plural label based on the model name and locale', function () { +it('can generate a plural label based on the model name and locale', function (): void { $originalLocale = app()->getLocale(); app()->setLocale('en'); @@ -67,7 +67,7 @@ it('can generate a plural label based on the model name and locale', function () app()->setLocale($originalLocale); }); -it('can generate a plural label based on the multi-word model name and locale', function () { +it('can generate a plural label based on the multi-word model name and locale', function (): void { $originalLocale = app()->getLocale(); app()->setLocale('en'); @@ -81,21 +81,21 @@ it('can generate a plural label based on the multi-word model name and locale', app()->setLocale($originalLocale); }); -it('can retrieve a record\'s title', function () { +it('can retrieve a record\'s title', function (): void { $post = Post::factory()->create(); expect(PostResource::getRecordTitle($post)) ->toBe($post->title); }); -it('can resolve record route binding', function () { +it('can resolve record route binding', function (): void { $post = Post::factory()->create(); expect(PostResource::resolveRecordRouteBinding($post->getKey())) ->toBeSameModel($post); }); -it('can retrieve a page\'s URL', function () { +it('can retrieve a page\'s URL', function (): void { $post = Post::factory()->create(); $resourceSlug = PostResource::getSlug(); @@ -111,7 +111,7 @@ it('can retrieve a page\'s URL', function () { ->toContain(strval($post->getRouteKey())); }); -it('can retrieve a page\'s URL from its model', function () { +it('can retrieve a page\'s URL from its model', function (): void { $post = Post::factory()->create(); expect(Filament::getResourceUrl($post, 'edit')) diff --git a/tests/src/Panels/Routes/SingleAndMultiDomainTest.php b/tests/src/Panels/Routes/SingleAndMultiDomainTest.php index bff96c2c11..03dd3d4cec 100644 --- a/tests/src/Panels/Routes/SingleAndMultiDomainTest.php +++ b/tests/src/Panels/Routes/SingleAndMultiDomainTest.php @@ -5,13 +5,13 @@ use Illuminate\Support\Facades\Route; uses(TestCase::class); -it('panels without any domain should not use the domain in the names of routes', function () { +it('panels without any domain should not use the domain in the names of routes', function (): void { $routeName = 'filament.admin.auth.login'; $route = Route::getRoutes()->getByName($routeName); expect($route)->not->toBeEmpty(); }); -it('panels with a single domain should not use the domain in the names of routes', function () { +it('panels with a single domain should not use the domain in the names of routes', function (): void { $routeName = 'filament.single-domain.auth.login'; $route = Route::getRoutes()->getByName($routeName); expect($route)->not->toBeEmpty(); @@ -21,7 +21,7 @@ it('panels with a single domain should not use the domain in the names of routes expect($route)->toBeEmpty(); }); -it('panels with multiple domains should use the domain in names of all routes', function () { +it('panels with multiple domains should use the domain in names of all routes', function (): void { $routeName = 'filament.multi-domain.auth.login'; $route = Route::getRoutes()->getByName($routeName); expect($route)->toBeEmpty(); diff --git a/tests/src/Panels/Tenancy/ResolveTenantTest.php b/tests/src/Panels/Tenancy/ResolveTenantTest.php index 3cfb34f94f..e7236fa818 100644 --- a/tests/src/Panels/Tenancy/ResolveTenantTest.php +++ b/tests/src/Panels/Tenancy/ResolveTenantTest.php @@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Route; uses(TestCase::class); -it('resolves the tenant correctly from the route', function () { +it('resolves the tenant correctly from the route', function (): void { $team = Team::factory()->create(); $panel = Filament::getPanel('tenancy'); @@ -29,7 +29,7 @@ it('resolves the tenant correctly from the route', function () { expect($resolvedTenant)->toBeSameModel($team); }); -it('resolves the tenant correctly using domain', function () { +it('resolves the tenant correctly using domain', function (): void { $team = DomainTeam::factory()->create(); $panel = Filament::getPanel('domain-tenancy'); diff --git a/tests/src/Schemas/ComponentTest.php b/tests/src/Schemas/ComponentTest.php index 48975e293f..8e436a7f61 100644 --- a/tests/src/Schemas/ComponentTest.php +++ b/tests/src/Schemas/ComponentTest.php @@ -8,7 +8,7 @@ use Illuminate\Support\Str; uses(TestCase::class); -it('belongs to container', function () { +it('belongs to container', function (): void { $component = (new Component) ->container($schema = Schema::make(Livewire::make())); @@ -16,7 +16,7 @@ it('belongs to container', function () { ->getContainer()->toBe($schema); }); -it('can access container\'s Livewire component', function () { +it('can access container\'s Livewire component', function (): void { $component = (new Component) ->container(Schema::make($livewire = Livewire::make())); @@ -24,7 +24,7 @@ it('can access container\'s Livewire component', function () { ->getLivewire()->toBe($livewire); }); -it('has child components', function () { +it('has child components', function (): void { $components = []; foreach (range(1, $count = rand(2, 10)) as $i) { @@ -46,7 +46,7 @@ it('has child components', function () { ); }); -it('has a label', function () { +it('has a label', function (): void { $component = (new Component) ->container(Schema::make(Livewire::make())) ->label($label = Str::random()); @@ -55,7 +55,7 @@ it('has a label', function () { ->getLabel()->toBe($label); }); -it('can have meta', function () { +it('can have meta', function (): void { $component = (new Component) ->meta('foo', 'bar') ->meta('bob', 'baz'); @@ -69,13 +69,13 @@ it('can have meta', function () { ]); }); -it('can be cloned', function () { +it('can be cloned', function (): void { $afterClonedCallbackCalledCount = 0; $afterClonedCallbackClone = null; $afterClonedCallbackOriginal = null; $component = (new Component) - ->afterCloned(function (Component $clone, Component $original) use (&$afterClonedCallbackCalledCount, &$afterClonedCallbackClone, &$afterClonedCallbackOriginal) { + ->afterCloned(function (Component $clone, Component $original) use (&$afterClonedCallbackCalledCount, &$afterClonedCallbackClone, &$afterClonedCallbackOriginal): void { $afterClonedCallbackCalledCount++; $afterClonedCallbackClone = $clone; $afterClonedCallbackOriginal = $original; diff --git a/tests/src/Schemas/Components/StateCasts/EnumArrayStateCastTest.php b/tests/src/Schemas/Components/StateCasts/EnumArrayStateCastTest.php index b558adddde..7fed0d157f 100644 --- a/tests/src/Schemas/Components/StateCasts/EnumArrayStateCastTest.php +++ b/tests/src/Schemas/Components/StateCasts/EnumArrayStateCastTest.php @@ -7,28 +7,28 @@ use Filament\Tests\TestCase; uses(TestCase::class); -it('can get an array of enum from strings', function () { +it('can get an array of enum from strings', function (): void { $cast = app(EnumArrayStateCast::class, ['enum' => StringBackedEnum::class]); expect($cast->get(['one', 'two', 'three'])) ->toBe([StringBackedEnum::One, StringBackedEnum::Two, StringBackedEnum::Three]); }); -it('can get an array of enums from integers', function () { +it('can get an array of enums from integers', function (): void { $cast = app(EnumArrayStateCast::class, ['enum' => IntegerBackedEnum::class]); expect($cast->get([1, 2, 3])) ->toBe([IntegerBackedEnum::One, IntegerBackedEnum::Two, IntegerBackedEnum::Three]); }); -it('can ignore if an array of enums is passed to the getter already', function () { +it('can ignore if an array of enums is passed to the getter already', function (): void { $cast = app(EnumArrayStateCast::class, ['enum' => StringBackedEnum::class]); expect($cast->get([StringBackedEnum::One, StringBackedEnum::Two, StringBackedEnum::Three])) ->toBe([StringBackedEnum::One, StringBackedEnum::Two, StringBackedEnum::Three]); }); -it('can return an empty array if blank values are passed to the getter', function () { +it('can return an empty array if blank values are passed to the getter', function (): void { $cast = app(EnumArrayStateCast::class, ['enum' => StringBackedEnum::class]); expect($cast->get([null, ''])) @@ -36,42 +36,42 @@ it('can return an empty array if blank values are passed to the getter', functio ->toBeEmpty(); }); -it('can filter out blank values from the array of enums in the getter', function () { +it('can filter out blank values from the array of enums in the getter', function (): void { $cast = app(EnumArrayStateCast::class, ['enum' => StringBackedEnum::class]); expect($cast->get(['one', null, 'two', '', 'three'])) ->toBe([StringBackedEnum::One, StringBackedEnum::Two, StringBackedEnum::Three]); }); -it('can decode a JSON array of enum from strings', function () { +it('can decode a JSON array of enum from strings', function (): void { $cast = app(EnumArrayStateCast::class, ['enum' => StringBackedEnum::class]); expect($cast->get('["one", "two", "three"]')) ->toBe([StringBackedEnum::One, StringBackedEnum::Two, StringBackedEnum::Three]); }); -it('can get the values from an array of string backed enums in the setter', function () { +it('can get the values from an array of string backed enums in the setter', function (): void { $cast = app(EnumArrayStateCast::class, ['enum' => StringBackedEnum::class]); expect($cast->set([StringBackedEnum::One, StringBackedEnum::Two, StringBackedEnum::Three])) ->toBe(['one', 'two', 'three']); }); -it('can get the values from an array of integer backed enums in the setter', function () { +it('can get the values from an array of integer backed enums in the setter', function (): void { $cast = app(EnumArrayStateCast::class, ['enum' => IntegerBackedEnum::class]); expect($cast->set([IntegerBackedEnum::One, IntegerBackedEnum::Two, IntegerBackedEnum::Three])) ->toBe([1, 2, 3]); }); -it('can ignore the values in the setter if they are not enums', function () { +it('can ignore the values in the setter if they are not enums', function (): void { $cast = app(EnumArrayStateCast::class, ['enum' => StringBackedEnum::class]); expect($cast->set(['one', 'two', 'three'])) ->toBe(['one', 'two', 'three']); }); -it('can filter out blank values from the array of enums in the setter', function () { +it('can filter out blank values from the array of enums in the setter', function (): void { $cast = app(EnumArrayStateCast::class, ['enum' => StringBackedEnum::class]); expect($cast->set([StringBackedEnum::One, null, StringBackedEnum::Two, '', StringBackedEnum::Three])) diff --git a/tests/src/Schemas/Components/StateCasts/EnumStateCastTest.php b/tests/src/Schemas/Components/StateCasts/EnumStateCastTest.php index 9eaa4ddd82..f57b5dca39 100644 --- a/tests/src/Schemas/Components/StateCasts/EnumStateCastTest.php +++ b/tests/src/Schemas/Components/StateCasts/EnumStateCastTest.php @@ -7,7 +7,7 @@ use Filament\Tests\TestCase; uses(TestCase::class); -it('can get an enum from a string', function (string $string, StringBackedEnum $enum) { +it('can get an enum from a string', function (string $string, StringBackedEnum $enum): void { $cast = app(EnumStateCast::class, ['enum' => StringBackedEnum::class]); expect($cast->get($string)) @@ -18,7 +18,7 @@ it('can get an enum from a string', function (string $string, StringBackedEnum $ ['three', StringBackedEnum::Three], ]); -it('can get an enum from an integer', function (int $integer, IntegerBackedEnum $enum) { +it('can get an enum from an integer', function (int $integer, IntegerBackedEnum $enum): void { $cast = app(EnumStateCast::class, ['enum' => IntegerBackedEnum::class]); expect($cast->get($integer)) @@ -29,7 +29,7 @@ it('can get an enum from an integer', function (int $integer, IntegerBackedEnum [3, IntegerBackedEnum::Three], ]); -it('can ignore if an enum is passed to the getter already', function (StringBackedEnum $enum) { +it('can ignore if an enum is passed to the getter already', function (StringBackedEnum $enum): void { $cast = app(EnumStateCast::class, ['enum' => StringBackedEnum::class]); expect($cast->get($enum)) @@ -40,7 +40,7 @@ it('can ignore if an enum is passed to the getter already', function (StringBack StringBackedEnum::Three, ]); -it('can return null if a blank value is passed to the getter', function ($value) { +it('can return null if a blank value is passed to the getter', function ($value): void { $cast = app(EnumStateCast::class, ['enum' => StringBackedEnum::class]); expect($cast->get($value)) @@ -50,7 +50,7 @@ it('can return null if a blank value is passed to the getter', function ($value) '', ]); -it('can get the value from a string backed enum in the setter', function (StringBackedEnum $enum, string $string) { +it('can get the value from a string backed enum in the setter', function (StringBackedEnum $enum, string $string): void { $cast = app(EnumStateCast::class, ['enum' => StringBackedEnum::class]); expect($cast->set($enum)) @@ -61,7 +61,7 @@ it('can get the value from a string backed enum in the setter', function (String [StringBackedEnum::Three, 'three'], ]); -it('can get the value from an integer backed enum in the setter', function (IntegerBackedEnum $enum, int $integer) { +it('can get the value from an integer backed enum in the setter', function (IntegerBackedEnum $enum, int $integer): void { $cast = app(EnumStateCast::class, ['enum' => IntegerBackedEnum::class]); expect($cast->set($enum)) @@ -72,7 +72,7 @@ it('can get the value from an integer backed enum in the setter', function (Inte [IntegerBackedEnum::Three, 3], ]); -it('can ignore the value in the setter if it is not an enum', function ($value) { +it('can ignore the value in the setter if it is not an enum', function ($value): void { $cast = app(EnumStateCast::class, ['enum' => StringBackedEnum::class]); expect($cast->set($value)) diff --git a/tests/src/Schemas/Components/StateCasts/FileUploadStateCastTest.php b/tests/src/Schemas/Components/StateCasts/FileUploadStateCastTest.php index 024e567fc3..e48c27cf65 100644 --- a/tests/src/Schemas/Components/StateCasts/FileUploadStateCastTest.php +++ b/tests/src/Schemas/Components/StateCasts/FileUploadStateCastTest.php @@ -6,35 +6,35 @@ use Illuminate\Support\Str; uses(TestCase::class); -it('can transform an array of files into a single file', function () { +it('can transform an array of files into a single file', function (): void { $cast = app(FileUploadStateCast::class, ['isMultiple' => false]); expect($cast->get([$file = Str::random()])) ->toBe($file); }); -it('can transform a single file into an array of files', function () { +it('can transform a single file into an array of files', function (): void { $cast = app(FileUploadStateCast::class, ['isMultiple' => true]); expect($cast->get($file = Str::random())) ->toBe([$file]); }); -it('can reset the keys in an array of files', function () { +it('can reset the keys in an array of files', function (): void { $cast = app(FileUploadStateCast::class, ['isMultiple' => true]); expect($cast->get([(string) Str::uuid() => $file = Str::random()])) ->toBe([$file]); }); -it('can leave a single file alone in the getter', function () { +it('can leave a single file alone in the getter', function (): void { $cast = app(FileUploadStateCast::class, ['isMultiple' => false]); expect($cast->get($file = Str::random())) ->toBe($file); }); -it('can wrap a single file in an array in the setter', function () { +it('can wrap a single file in an array in the setter', function (): void { $cast = app(FileUploadStateCast::class, ['isMultiple' => false]); expect($cast->set($file = Str::random())) @@ -44,7 +44,7 @@ it('can wrap a single file in an array in the setter', function () { ->not->toBe([$file]); }); -it('can strip empty items from the final array in the setter', function () { +it('can strip empty items from the final array in the setter', function (): void { $cast = app(FileUploadStateCast::class, ['isMultiple' => true]); expect($cast->set([null, $file = Str::random(), ''])) diff --git a/tests/src/Schemas/Components/StateCasts/KeyValueStateCastTest.php b/tests/src/Schemas/Components/StateCasts/KeyValueStateCastTest.php index 3b1bfdef7c..1002aa7083 100644 --- a/tests/src/Schemas/Components/StateCasts/KeyValueStateCastTest.php +++ b/tests/src/Schemas/Components/StateCasts/KeyValueStateCastTest.php @@ -5,7 +5,7 @@ use Filament\Tests\TestCase; uses(TestCase::class); -it('can get a key-value array from an array of objects', function () { +it('can get a key-value array from an array of objects', function (): void { $cast = app(KeyValueStateCast::class); expect($cast->get([ @@ -20,7 +20,7 @@ it('can get a key-value array from an array of objects', function () { ]); }); -it('can decode a JSON string to a key-value array', function () { +it('can decode a JSON string to a key-value array', function (): void { $cast = app(KeyValueStateCast::class); expect($cast->get('[ @@ -35,7 +35,7 @@ it('can decode a JSON string to a key-value array', function () { ]); }); -it('does not decode an array if it is already in key-value format', function () { +it('does not decode an array if it is already in key-value format', function (): void { $cast = app(KeyValueStateCast::class); expect($cast->get([ @@ -50,7 +50,7 @@ it('does not decode an array if it is already in key-value format', function () ]); }); -it('returns an empty array if the value is blank', function ($value) { +it('returns an empty array if the value is blank', function ($value): void { $cast = app(KeyValueStateCast::class); expect($cast->get($value)) @@ -61,7 +61,7 @@ it('returns an empty array if the value is blank', function ($value) { [[]], ]); -it('can get an array of objects from a key-value array in the setter', function () { +it('can get an array of objects from a key-value array in the setter', function (): void { $cast = app(KeyValueStateCast::class); expect($cast->set([ @@ -76,7 +76,7 @@ it('can get an array of objects from a key-value array in the setter', function ]); }); -it('can decode a JSON string to an array of objects in the setter', function () { +it('can decode a JSON string to an array of objects in the setter', function (): void { $cast = app(KeyValueStateCast::class); expect($cast->set('{ @@ -91,7 +91,7 @@ it('can decode a JSON string to an array of objects in the setter', function () ]); }); -it('does not decode an array if it is already in object format in the setter', function () { +it('does not decode an array if it is already in object format in the setter', function (): void { $cast = app(KeyValueStateCast::class); expect($cast->set([ diff --git a/tests/src/Support/ColorTest.php b/tests/src/Support/ColorTest.php index ddfd4f96f8..45acae8d93 100644 --- a/tests/src/Support/ColorTest.php +++ b/tests/src/Support/ColorTest.php @@ -33,7 +33,7 @@ use Illuminate\Support\Str; uses(TestCase::class); -it('generates colors from a HEX value', function (string $color) { +it('generates colors from a HEX value', function (string $color): void { expect(Color::generatePalette($color)) ->toMatchSnapshot(); })->with([ @@ -44,7 +44,7 @@ it('generates colors from a HEX value', function (string $color) { '#FFFFFF', ]); -it('generates colors from an RGB value', function (string $color) { +it('generates colors from an RGB value', function (string $color): void { expect(Color::generatePalette($color)) ->toMatchSnapshot(); })->with([ @@ -55,7 +55,7 @@ it('generates colors from an RGB value', function (string $color) { 'rgb(255, 255, 255)', ]); -it('returns all colors', function () { +it('returns all colors', function (): void { $colors = []; foreach ((new ReflectionClass(Color::class))->getConstants() as $name => $color) { @@ -66,7 +66,7 @@ it('returns all colors', function () { ->toBe($colors); }); -it('generates component classes', function (string | HasColor $component, string $color) { +it('generates component classes', function (string | HasColor $component, string $color): void { expect(FilamentColor::getComponentClasses($component, $color)) ->toMatchSnapshot(); }) diff --git a/tests/src/Support/EvaluatesClosuresTest.php b/tests/src/Support/EvaluatesClosuresTest.php index 969176812b..00a01a2f0e 100644 --- a/tests/src/Support/EvaluatesClosuresTest.php +++ b/tests/src/Support/EvaluatesClosuresTest.php @@ -7,27 +7,27 @@ use Illuminate\Database\Eloquent\Model; uses(TestCase::class); -it('will make any object from container', function () { +it('will make any object from container', function (): void { $isEvaluatingClosures = new IsEvaluatingClosures; - $isEvaluatingClosures->evaluate(function (IsEvaluatingClosures $isEvaluatingClosures) { + $isEvaluatingClosures->evaluate(function (IsEvaluatingClosures $isEvaluatingClosures): void { $this->expectNotToPerformAssertions(); }); }); -it('will instantiate Eloquent Models provided by name', function () { +it('will instantiate Eloquent Models provided by name', function (): void { $isEvaluatingClosures = new IsEvaluatingClosures( record: $recordModel = new RecordModel, shouldResolveDefaultClosureDependencyForEvaluationByName: true, shouldResolveDefaultClosureDependencyForEvaluationByType: false, ); - $isEvaluatingClosures->evaluate(function (RecordModel $record) use ($recordModel) { + $isEvaluatingClosures->evaluate(function (RecordModel $record) use ($recordModel): void { expect($record)->toBe($recordModel); }); }); -it('will not instantiate Eloquent Models not provided by name', function () { +it('will not instantiate Eloquent Models not provided by name', function (): void { $isEvaluatingClosures = new IsEvaluatingClosures( record: $recordModel = new RecordModel, shouldResolveDefaultClosureDependencyForEvaluationByName: true, @@ -36,69 +36,69 @@ it('will not instantiate Eloquent Models not provided by name', function () { $this->expectException(BindingResolutionException::class); - $isEvaluatingClosures->evaluate(function (RecordModel $recordModel) { + $isEvaluatingClosures->evaluate(function (RecordModel $recordModel): void { throw new RuntimeException('Should not be called because named parameter not provided.'); }); }); -it('will instantiate Eloquent Models provided by type', function () { +it('will instantiate Eloquent Models provided by type', function (): void { $isEvaluatingClosures = new IsEvaluatingClosures( record: $recordModel = new RecordModel, shouldResolveDefaultClosureDependencyForEvaluationByName: false, shouldResolveDefaultClosureDependencyForEvaluationByType: true, ); - $isEvaluatingClosures->evaluate(function (RecordModel $record) use ($recordModel) { + $isEvaluatingClosures->evaluate(function (RecordModel $record) use ($recordModel): void { expect($record)->toBe($recordModel); }); - $isEvaluatingClosures->evaluate(function (RecordModel $recordModelWithDifferentName) use ($recordModel) { + $isEvaluatingClosures->evaluate(function (RecordModel $recordModelWithDifferentName) use ($recordModel): void { expect($recordModelWithDifferentName)->toBe($recordModel); }); }); -it('will not instantiate empty Models from container', function () { +it('will not instantiate empty Models from container', function (): void { $isEvaluatingClosures = new IsEvaluatingClosures; $this->expectException(BindingResolutionException::class); - $isEvaluatingClosures->evaluate(function (RecordModel $recordModel) { + $isEvaluatingClosures->evaluate(function (RecordModel $recordModel): void { throw new RuntimeException('Should not be called.'); }); }); -it('will instantiate empty Models from container if bound', function () { +it('will instantiate empty Models from container if bound', function (): void { $isEvaluatingClosures = new IsEvaluatingClosures; $boundRecordModel = new RecordModel; app()->bind(RecordModel::class, fn () => $boundRecordModel); - $isEvaluatingClosures->evaluate(function (RecordModel $recordModel) use ($boundRecordModel) { + $isEvaluatingClosures->evaluate(function (RecordModel $recordModel) use ($boundRecordModel): void { expect($recordModel)->toBe($boundRecordModel); }); }); -it('will instantiate empty Models from container if bound as singleton', function () { +it('will instantiate empty Models from container if bound as singleton', function (): void { $isEvaluatingClosures = new IsEvaluatingClosures; $boundRecordModel = new RecordModel; app()->singleton(RecordModel::class, fn () => $boundRecordModel); - $isEvaluatingClosures->evaluate(function (RecordModel $recordModel) use ($boundRecordModel) { + $isEvaluatingClosures->evaluate(function (RecordModel $recordModel) use ($boundRecordModel): void { expect($recordModel)->toBe($boundRecordModel); }); }); -it('will instantiate empty Models from container if bound as scoped', function () { +it('will instantiate empty Models from container if bound as scoped', function (): void { $isEvaluatingClosures = new IsEvaluatingClosures; $boundRecordModel = new RecordModel; app()->scoped(RecordModel::class, fn () => $boundRecordModel); - $isEvaluatingClosures->evaluate(function (RecordModel $recordModel) use ($boundRecordModel) { + $isEvaluatingClosures->evaluate(function (RecordModel $recordModel) use ($boundRecordModel): void { expect($recordModel)->toBe($boundRecordModel); }); }); diff --git a/tests/src/Support/JsAssetTest.php b/tests/src/Support/JsAssetTest.php index 1ad48db69f..dc4a4311dd 100644 --- a/tests/src/Support/JsAssetTest.php +++ b/tests/src/Support/JsAssetTest.php @@ -6,7 +6,7 @@ use Filament\Tests\TestCase; uses(TestCase::class); -it('registers script tag with type of module', function () { +it('registers script tag with type of module', function (): void { FilamentAsset::register([ Js::make('test-js', 'test.js'), ]); diff --git a/tests/src/Support/MarkdownTest.php b/tests/src/Support/MarkdownTest.php index de1262dbd8..30ae188613 100644 --- a/tests/src/Support/MarkdownTest.php +++ b/tests/src/Support/MarkdownTest.php @@ -5,14 +5,14 @@ use Filament\Tests\TestCase; uses(TestCase::class); -it('can convert a block of markdown to a string of HTML', function () { +it('can convert a block of markdown to a string of HTML', function (): void { $markdown = new Markdown('This is a **snippet** of _example_ Markdown.'); expect($markdown->toHtml()) ->toBe("

This is a snippet of example Markdown.

\n"); }); -it('can convert inline markdown to a string of HTML', function () { +it('can convert inline markdown to a string of HTML', function (): void { $markdown = new Markdown('This is a **snippet** of _example_ Markdown.', isInline: true); expect($markdown->toHtml()) diff --git a/tests/src/Support/RenderHooksTest.php b/tests/src/Support/RenderHooksTest.php index 8890f4f2bf..48137ca308 100644 --- a/tests/src/Support/RenderHooksTest.php +++ b/tests/src/Support/RenderHooksTest.php @@ -8,7 +8,7 @@ use Illuminate\Support\HtmlString; uses(TestCase::class); -test('render hooks can be registered', function () { +test('render hooks can be registered', function (): void { FilamentView::registerRenderHook('foo', function (): string { return Blade::render('bar'); }); @@ -18,7 +18,7 @@ test('render hooks can be registered', function () { ->toHtml()->toBe('bar'); }); -test('render hooks can render view files', function () { +test('render hooks can render view files', function (): void { FilamentView::registerRenderHook('view-foo', function (): View { return view('pages.render-hooks.foo'); }); @@ -28,7 +28,7 @@ test('render hooks can render view files', function () { ->toHtml()->toContain('bar'); }); -test('render hooks can be scopes:d', function () { +test('render hooks can be scopes:d', function (): void { FilamentView::registerRenderHook('foo', function (): string { return Blade::render('bar'); }); @@ -42,7 +42,7 @@ test('render hooks can be scopes:d', function () { ->toHtml()->toBe('barbar'); }); -test('render hooks can be scopes:d to multiple scopes:s', function () { +test('render hooks can be scopes:d to multiple scopes:s', function (): void { FilamentView::registerRenderHook('foo', function (): string { return Blade::render('bar'); }); @@ -60,7 +60,7 @@ test('render hooks can be scopes:d to multiple scopes:s', function () { ->toHtml()->toBe('barbar'); }); -test('render hooks can be scopes:d to multiple scopes:s but only ever output once', function () { +test('render hooks can be scopes:d to multiple scopes:s but only ever output once', function (): void { FilamentView::registerRenderHook('foo', function (): string { return Blade::render('bar'); }); diff --git a/tests/src/Support/Services/RelationshipJoinerTest.php b/tests/src/Support/Services/RelationshipJoinerTest.php index 80657303f9..f2758183b6 100644 --- a/tests/src/Support/Services/RelationshipJoinerTest.php +++ b/tests/src/Support/Services/RelationshipJoinerTest.php @@ -8,7 +8,7 @@ use Illuminate\Database\Query\Expression; uses(TestCase::class); -it('can prepare query for no constraints for a BelongsToMany relationship', function () { +it('can prepare query for no constraints for a BelongsToMany relationship', function (): void { $user = User::factory()->create(); expect($user->teams()->toBase()) diff --git a/tests/src/Support/SpaModeTest.php b/tests/src/Support/SpaModeTest.php index 701b1deaf1..5605606230 100644 --- a/tests/src/Support/SpaModeTest.php +++ b/tests/src/Support/SpaModeTest.php @@ -7,7 +7,7 @@ use function Filament\Support\generate_href_html; uses(TestCase::class); -test('SPA mode can be toggled', function () { +test('SPA mode can be toggled', function (): void { expect(FilamentView::hasSpaMode())->toBeFalse(); FilamentView::spa(); @@ -17,7 +17,7 @@ test('SPA mode can be toggled', function () { expect(FilamentView::hasSpaMode())->toBeFalse(); }); -test('`href` HTML can be generated with `wire:navigate` based on SPA mode', function () { +test('`href` HTML can be generated with `wire:navigate` based on SPA mode', function (): void { FilamentView::spa(); expect(generate_href_html('http://localhost/page')) ->toHtml()->toBe('href="http://localhost/page" wire:navigate'); @@ -27,7 +27,7 @@ test('`href` HTML can be generated with `wire:navigate` based on SPA mode', func ->toHtml()->toBe('href="http://localhost/page"'); }); -test('`wire:navigate` is not used in the `href` HTML if it doesn\'t match the request\'s domain', function () { +test('`wire:navigate` is not used in the `href` HTML if it doesn\'t match the request\'s domain', function (): void { FilamentView::spa(); expect(generate_href_html('http://another-localhost/page')) ->toHtml()->toBe('href="http://another-localhost/page"'); @@ -37,7 +37,7 @@ test('`wire:navigate` is not used in the `href` HTML if it doesn\'t match the re ->toHtml()->toBe('href="http://another-localhost/page"'); }); -test('`target` HTML can be generated if the URL should open in a new tab', function () { +test('`target` HTML can be generated if the URL should open in a new tab', function (): void { FilamentView::spa(); expect(generate_href_html('http://localhost/page', shouldOpenInNewTab: true)) ->toHtml()->toBe('href="http://localhost/page" target="_blank"'); diff --git a/tests/src/Support/helpersTest.php b/tests/src/Support/helpersTest.php index 1eec5125fc..98cedd1781 100644 --- a/tests/src/Support/helpersTest.php +++ b/tests/src/Support/helpersTest.php @@ -4,7 +4,7 @@ use Illuminate\View\ComponentAttributeBag; use function Filament\Support\prepare_inherited_attributes; -it('will prepare attributes', function () { +it('will prepare attributes', function (): void { $bag = new ComponentAttributeBag([ 'style' => 'color:red', ]); @@ -16,7 +16,7 @@ it('will prepare attributes', function () { ]); }); -it('will prepare Alpine attributes', function () { +it('will prepare Alpine attributes', function (): void { $bag = new ComponentAttributeBag([ 'x-data' => '{foo:bar}', ]); @@ -28,7 +28,7 @@ it('will prepare Alpine attributes', function () { ]); }); -it('will prepare data attributes', function () { +it('will prepare data attributes', function (): void { $bag = new ComponentAttributeBag([ 'data-foo' => 'bar', ]); diff --git a/tests/src/Tables/Actions/ActionTest.php b/tests/src/Tables/Actions/ActionTest.php index fa44d32380..dc0050a527 100644 --- a/tests/src/Tables/Actions/ActionTest.php +++ b/tests/src/Tables/Actions/ActionTest.php @@ -16,7 +16,7 @@ use function Pest\Laravel\assertSoftDeleted; uses(TestCase::class); -it('can call action', function () { +it('can call action', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -32,7 +32,7 @@ it('can call action', function () { assertSoftDeleted($post); }); -it('can call an action with data', function () { +it('can call an action with data', function (): void { livewire(PostsTable::class) ->callAction(TestAction::make('data')->table(), data: [ 'payload' => $payload = Str::random(), @@ -52,7 +52,7 @@ it('can call an action with data', function () { ]); }); -it('can call action inside group', function () { +it('can call action inside group', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -68,7 +68,7 @@ it('can call action inside group', function () { assertSoftDeleted($post); }); -it('can validate an action\'s data', function () { +it('can validate an action\'s data', function (): void { livewire(PostsTable::class) ->callAction(TestAction::make('data')->table(), data: [ 'payload' => null, @@ -84,7 +84,7 @@ it('can validate an action\'s data', function () { ->assertNotDispatched('data-called'); }); -it('can set default action data when mounted', function () { +it('can set default action data when mounted', function (): void { livewire(PostsTable::class) ->mountAction(TestAction::make('data')->table()) ->assertActionDataSet([ @@ -101,7 +101,7 @@ it('can set default action data when mounted', function () { }); }); -it('can call a nested action registered in the modal footer', function () { +it('can call a nested action registered in the modal footer', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -121,7 +121,7 @@ it('can call a nested action registered in the modal footer', function () { ->assertDispatched('parent-called', foo: $foo, recordKey: $post->getKey()); }); -it('can call a manually modal registered nested action', function () { +it('can call a manually modal registered nested action', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -141,7 +141,7 @@ it('can call a manually modal registered nested action', function () { ->assertDispatched('parent-called', foo: $foo, recordKey: $post->getKey()); }); -it('can call a nested action registered on a schema component', function () { +it('can call a nested action registered on a schema component', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -161,7 +161,7 @@ it('can call a nested action registered on a schema component', function () { ->assertDispatched('parent-called', foo: $foo, recordKey: $post->getKey()); }); -it('can cancel a parent action when calling a nested action', function () { +it('can cancel a parent action when calling a nested action', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -177,7 +177,7 @@ it('can cancel a parent action when calling a nested action', function () { ->assertNotDispatched('parent-called'); }); -it('can call a grouped nested action registered in the modal footer', function () { +it('can call a grouped nested action registered in the modal footer', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -197,7 +197,7 @@ it('can call a grouped nested action registered in the modal footer', function ( ->assertDispatched('grouped-parent-called', foo: $foo, recordKey: $post->getKey()); }); -it('can call a grouped manually modal registered nested action', function () { +it('can call a grouped manually modal registered nested action', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -217,7 +217,7 @@ it('can call a grouped manually modal registered nested action', function () { ->assertDispatched('grouped-parent-called', foo: $foo, recordKey: $post->getKey()); }); -it('can call a grouped nested action registered on a schema component', function () { +it('can call a grouped nested action registered on a schema component', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -237,7 +237,7 @@ it('can call a grouped nested action registered on a schema component', function ->assertDispatched('grouped-parent-called', foo: $foo, recordKey: $post->getKey()); }); -it('can cancel a grouped parent action when calling a nested action', function () { +it('can cancel a grouped parent action when calling a nested action', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -253,7 +253,7 @@ it('can cancel a grouped parent action when calling a nested action', function ( ->assertNotDispatched('grouped-parent-called'); }); -it('can call an action with arguments', function () { +it('can call an action with arguments', function (): void { livewire(PostsTable::class) ->callAction(TestAction::make('arguments')->table()->arguments([ 'payload' => $payload = Str::random(), @@ -271,7 +271,7 @@ it('can call an action with arguments', function () { ]); }); -it('can call an action and halt', function () { +it('can call an action and halt', function (): void { livewire(PostsTable::class) ->callAction(TestAction::make('halt')->table()) ->assertDispatched('halt-called') @@ -283,7 +283,7 @@ it('can call an action and halt', function () { ->assertTableActionHalted('halt'); }); -it('can hide an action', function () { +it('can hide an action', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -309,7 +309,7 @@ it('can hide an action', function () { ->assertTableActionDoesNotExist('groupedWithHiddenGroupCondition', fn (Action $action): bool => $action->isVisible(), $post); }); -it('can disable an action', function () { +it('can disable an action', function (): void { livewire(PostsTable::class) ->assertActionEnabled(TestAction::make('enabled')->table()) ->assertActionDisabled(TestAction::make('disabled')->table()); @@ -319,7 +319,7 @@ it('can disable an action', function () { ->assertTableActionDisabled('disabled'); }); -it('can have an icon', function () { +it('can have an icon', function (): void { livewire(PostsTable::class) ->assertActionHasIcon(TestAction::make('hasIcon')->table(), Heroicon::PencilSquare) ->assertActionDoesNotHaveIcon(TestAction::make('hasIcon')->table(), Heroicon::Trash); @@ -329,7 +329,7 @@ it('can have an icon', function () { ->assertTableActionDoesNotHaveIcon('hasIcon', Heroicon::Trash); }); -it('can have a label', function () { +it('can have a label', function (): void { livewire(PostsTable::class) ->assertActionHasLabel(TestAction::make('hasLabel')->table(), 'My Action') ->assertActionDoesNotHaveLabel(TestAction::make('hasLabel')->table(), 'My Other Action'); @@ -339,7 +339,7 @@ it('can have a label', function () { ->assertTableActionDoesNotHaveLabel('hasLabel', 'My Other Action'); }); -it('can have a color', function () { +it('can have a color', function (): void { livewire(PostsTable::class) ->assertActionHasColor(TestAction::make('hasColor')->table(), 'primary') ->assertActionDoesNotHaveColor(TestAction::make('hasColor')->table(), 'gray'); @@ -349,7 +349,7 @@ it('can have a color', function () { ->assertTableActionDoesNotHaveColor('hasColor', 'gray'); }); -it('can have a URL', function () { +it('can have a URL', function (): void { livewire(PostsTable::class) ->assertActionHasUrl(TestAction::make('url')->table(), 'https://filamentphp.com') ->assertActionDoesNotHaveUrl(TestAction::make('url')->table(), 'https://google.com'); @@ -359,7 +359,7 @@ it('can have a URL', function () { ->assertTableActionDoesNotHaveUrl('url', 'https://google.com'); }); -it('can open a URL in a new tab', function () { +it('can open a URL in a new tab', function (): void { livewire(PostsTable::class) ->assertActionShouldOpenUrlInNewTab(TestAction::make('urlInNewTab')->table()) ->assertActionShouldNotOpenUrlInNewTab(TestAction::make('urlNotInNewTab')->table()); @@ -369,7 +369,7 @@ it('can open a URL in a new tab', function () { ->assertTableActionShouldNotOpenUrlInNewTab('urlNotInNewTab'); }); -it('can state whether a table action exists', function () { +it('can state whether a table action exists', function (): void { livewire(PostsTable::class) ->assertActionExists(TestAction::make('exists')->table()) ->assertActionDoesNotExist(TestAction::make('doesNotExist')->table()); @@ -379,14 +379,14 @@ it('can state whether a table action exists', function () { ->assertTableActionDoesNotExist('doesNotExist'); }); -it('can state whether table actions exist in order', function () { +it('can state whether table actions exist in order', function (): void { livewire(PostsTable::class) ->assertTableActionsExistInOrder(['edit', 'delete']) ->assertTableHeaderActionsExistInOrder(['exists', 'existsInOrder']) ->assertTableEmptyStateActionsExistInOrder(['emptyExists', 'emptyExistsInOrder']); }); -it('can state whether a table action exists with a given configuration', function () { +it('can state whether a table action exists with a given configuration', function (): void { livewire(PostsTable::class) ->assertActionExists(TestAction::make('attachMultiple')->table(), fn (AttachAction $action) => $action->isMultiple()) ->assertActionDoesNotExist(TestAction::make(AttachAction::class)->table(), fn (AttachAction $action) => $action->isMultiple()); @@ -396,7 +396,7 @@ it('can state whether a table action exists with a given configuration', functio ->assertTableActionDoesNotExist(AttachAction::class, fn (AttachAction $action) => $action->isMultiple()); }); -it('can replicate a record', function () { +it('can replicate a record', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) diff --git a/tests/src/Tables/Actions/BulkActionTest.php b/tests/src/Tables/Actions/BulkActionTest.php index 773de277be..6ae6fd73a1 100644 --- a/tests/src/Tables/Actions/BulkActionTest.php +++ b/tests/src/Tables/Actions/BulkActionTest.php @@ -13,7 +13,7 @@ use function Pest\Laravel\assertSoftDeleted; uses(TestCase::class); -it('can call bulk action', function () { +it('can call bulk action', function (): void { $posts = Post::factory()->count(10)->create(); livewire(PostsTable::class) @@ -34,7 +34,7 @@ it('can call bulk action', function () { } }); -it('can call a bulk action with data', function () { +it('can call a bulk action with data', function (): void { $posts = Post::factory()->count(10)->create(); livewire(PostsTable::class) @@ -57,7 +57,7 @@ it('can call a bulk action with data', function () { ]); }); -it('can validate a bulk action\'s data', function () { +it('can validate a bulk action\'s data', function (): void { $posts = Post::factory()->count(10)->create(); livewire(PostsTable::class) @@ -76,7 +76,7 @@ it('can validate a bulk action\'s data', function () { ->assertNotDispatched('data-called'); }); -it('can set default bulk action data when mounted', function () { +it('can set default bulk action data when mounted', function (): void { $posts = Post::factory()->count(10)->create(); livewire(PostsTable::class) @@ -96,7 +96,7 @@ it('can set default bulk action data when mounted', function () { }); }); -it('can call a bulk action with arguments', function () { +it('can call a bulk action with arguments', function (): void { $posts = Post::factory()->count(10)->create(); livewire(PostsTable::class) @@ -117,7 +117,7 @@ it('can call a bulk action with arguments', function () { ]); }); -it('can call a bulk action and halt', function () { +it('can call a bulk action and halt', function (): void { $posts = Post::factory()->count(10)->create(); livewire(PostsTable::class) @@ -132,7 +132,7 @@ it('can call a bulk action and halt', function () { ->assertTableBulkActionHalted('halt'); }); -it('can hide a bulk action', function () { +it('can hide a bulk action', function (): void { livewire(PostsTable::class) ->assertActionVisible(TestAction::make('visible')->table()->bulk()) ->assertActionHidden(TestAction::make('hidden')->table()->bulk()); @@ -142,7 +142,7 @@ it('can hide a bulk action', function () { ->assertTableBulkActionHidden('hidden'); }); -it('can disable a bulk action', function () { +it('can disable a bulk action', function (): void { livewire(PostsTable::class) ->assertActionEnabled(TestAction::make('enabled')->table()->bulk()) ->assertActionDisabled(TestAction::make('disabled')->table()->bulk()); @@ -152,7 +152,7 @@ it('can disable a bulk action', function () { ->assertTableBulkActionDisabled('disabled'); }); -it('can have an icon', function () { +it('can have an icon', function (): void { livewire(PostsTable::class) ->assertActionHasIcon(TestAction::make('hasIcon')->table()->bulk(), Heroicon::PencilSquare) ->assertActionDoesNotHaveIcon(TestAction::make('hasIcon')->table()->bulk(), Heroicon::Trash); @@ -162,7 +162,7 @@ it('can have an icon', function () { ->assertTableBulkActionDoesNotHaveIcon('hasIcon', Heroicon::Trash); }); -it('can have a label', function () { +it('can have a label', function (): void { livewire(PostsTable::class) ->assertActionHasLabel(TestAction::make('hasLabel')->table()->bulk(), 'My Action') ->assertActionDoesNotHaveLabel(TestAction::make('hasLabel')->table()->bulk(), 'My Other Action'); @@ -172,7 +172,7 @@ it('can have a label', function () { ->assertTableBulkActionDoesNotHaveLabel('hasLabel', 'My Other Action'); }); -it('can have a color', function () { +it('can have a color', function (): void { livewire(PostsTable::class) ->assertActionHasColor(TestAction::make('hasColor')->table()->bulk(), 'primary') ->assertActionDoesNotHaveColor(TestAction::make('hasColor')->table()->bulk(), 'gray'); @@ -182,7 +182,7 @@ it('can have a color', function () { ->assertTableBulkActionDoesNotHaveColor('hasColor', 'gray'); }); -it('can state whether a bulk action exists', function () { +it('can state whether a bulk action exists', function (): void { livewire(PostsTable::class) ->assertActionExists(TestAction::make('exists')->table()->bulk()) ->assertActionDoesNotExist(TestAction::make('doesNotExist')->table()->bulk()); @@ -192,7 +192,7 @@ it('can state whether a bulk action exists', function () { ->assertTableBulkActionDoesNotExist('doesNotExist'); }); -it('can state whether bulk actions exist in order', function () { +it('can state whether bulk actions exist in order', function (): void { livewire(PostsTable::class) ->assertTableBulkActionsExistInOrder(['exists', 'existsInOrder']); }); diff --git a/tests/src/Tables/ColumnTest.php b/tests/src/Tables/ColumnTest.php index 1e9b1ac2d5..65d53e62bc 100644 --- a/tests/src/Tables/ColumnTest.php +++ b/tests/src/Tables/ColumnTest.php @@ -12,21 +12,21 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can render text column', function () { +it('can render text column', function (): void { Post::factory()->count(10)->create(); livewire(PostsTable::class) ->assertCanRenderTableColumn('title'); }); -it('can render text column with relationship', function () { +it('can render text column with relationship', function (): void { Post::factory()->count(10)->create(); livewire(PostsTable::class) ->assertCanRenderTableColumn('author.name'); }); -it('can sort records', function () { +it('can sort records', function (): void { $posts = Post::factory()->count(10)->create(); livewire(PostsTable::class) @@ -36,7 +36,7 @@ it('can sort records', function () { ->assertCanSeeTableRecords($posts->sortByDesc('title'), inOrder: true); }); -it('can sort records with relationship', function () { +it('can sort records with relationship', function (): void { $posts = Post::factory()->count(10)->create(); livewire(PostsTable::class) @@ -46,7 +46,7 @@ it('can sort records with relationship', function () { ->assertCanSeeTableRecords($posts->sortByDesc('author.name'), inOrder: true); }); -it('can sort records with JSON column', function () { +it('can sort records with JSON column', function (): void { $posts = Post::factory()->count(10)->state(fn (): array => [ 'json' => ['foo' => Str::random()], ])->create(); @@ -58,7 +58,7 @@ it('can sort records with JSON column', function () { ->assertCanSeeTableRecords($posts->sortByDesc('json.foo'), inOrder: true); }); -it('can sort records with nested JSON column', function () { +it('can sort records with nested JSON column', function (): void { $posts = Post::factory()->count(10)->state(fn (): array => [ 'json' => ['bar' => ['baz' => Str::random()]], ])->create(); @@ -70,7 +70,7 @@ it('can sort records with nested JSON column', function () { ->assertCanSeeTableRecords($posts->sortByDesc('json.bar.baz'), inOrder: true); }); -it('can sort records with relationship JSON column', function () { +it('can sort records with relationship JSON column', function (): void { $posts = Post::factory()->count(10)->state(fn (): array => [ 'author_id' => User::factory()->state(['json' => ['foo' => Str::random()]]), ])->create(); @@ -82,7 +82,7 @@ it('can sort records with relationship JSON column', function () { ->assertCanSeeTableRecords($posts->sortByDesc('author.json.foo'), inOrder: true); }); -it('can sort records with relationship nested JSON column', function () { +it('can sort records with relationship nested JSON column', function (): void { $posts = Post::factory()->count(10)->state(fn (): array => [ 'author_id' => User::factory()->state(['json' => ['bar' => ['baz' => Str::random()]]]), ])->create(); @@ -94,7 +94,7 @@ it('can sort records with relationship nested JSON column', function () { ->assertCanSeeTableRecords($posts->sortByDesc('author.json.bar.baz'), inOrder: true); }); -it('can search records', function () { +it('can search records', function (): void { $posts = Post::factory()->count(10)->create(); $title = $posts->first()->title; @@ -105,7 +105,7 @@ it('can search records', function () { ->assertCanNotSeeTableRecords($posts->where('title', '!=', $title)); }); -it('can search individual column records', function () { +it('can search individual column records', function (): void { $posts = Post::factory()->count(10)->create(); $content = $posts->first()->content; @@ -116,7 +116,7 @@ it('can search individual column records', function () { ->assertCanNotSeeTableRecords($posts->where('content', '!=', $content)); }); -it('can search posts with relationship', function () { +it('can search posts with relationship', function (): void { $posts = Post::factory()->count(10)->create(); $author = $posts->first()->author->name; @@ -127,7 +127,7 @@ it('can search posts with relationship', function () { ->assertCanNotSeeTableRecords($posts->where('author.name', '!=', $author)); }); -it('can search posts with JSON column', function () { +it('can search posts with JSON column', function (): void { $search = Str::random(); $matchingPosts = Post::factory()->count(5)->create([ @@ -144,7 +144,7 @@ it('can search posts with JSON column', function () { ->assertCanNotSeeTableRecords($notMatchingPosts); }); -it('can search posts with nested JSON column', function () { +it('can search posts with nested JSON column', function (): void { $search = Str::random(); $matchingPosts = Post::factory()->count(5)->create([ @@ -161,7 +161,7 @@ it('can search posts with nested JSON column', function () { ->assertCanNotSeeTableRecords($notMatchingPosts); }); -it('can search posts with relationship JSON column', function () { +it('can search posts with relationship JSON column', function (): void { $search = Str::random(); $matchingAuthor = User::factory() @@ -182,7 +182,7 @@ it('can search posts with relationship JSON column', function () { ->assertCanNotSeeTableRecords($notMatchingPosts); }); -it('can search posts with relationship nested JSON column', function () { +it('can search posts with relationship nested JSON column', function (): void { $search = Str::random(); $matchingAuthor = User::factory() @@ -203,7 +203,7 @@ it('can search posts with relationship nested JSON column', function () { ->assertCanNotSeeTableRecords($notMatchingPosts); }); -it('can search individual column records with relationship', function () { +it('can search individual column records with relationship', function (): void { $posts = Post::factory()->count(10)->create(); $authorEmail = $posts->first()->author->email; @@ -214,7 +214,7 @@ it('can search individual column records with relationship', function () { ->assertCanNotSeeTableRecords($posts->where('author.email', '!=', $authorEmail)); }); -it('can search multiple individual columns', function () { +it('can search multiple individual columns', function (): void { $posts = Post::factory()->count(10)->create(); $content = $posts->first()->content; @@ -229,13 +229,13 @@ it('can search multiple individual columns', function () { ->assertCanNotSeeTableRecords($posts->where('author.email', '!=', $authorEmail)); }); -it('can hide a column', function () { +it('can hide a column', function (): void { livewire(PostsTable::class) ->assertTableColumnVisible('visible') ->assertTableColumnHidden('hidden'); }); -it('can call a column action', function () { +it('can call a column action', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -243,7 +243,7 @@ it('can call a column action', function () { ->assertDispatched('title-action-called'); }); -it('can call a column action object', function () { +it('can call a column action object', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -251,7 +251,7 @@ it('can call a column action object', function () { ->assertDispatched('column-action-object-called'); }); -it('can state whether a column has the correct value', function () { +it('can state whether a column has the correct value', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -259,7 +259,7 @@ it('can state whether a column has the correct value', function () { ->assertTableColumnStateNotSet('with_state', 'incorrect state', $post); }); -it('can state whether a column has the correct formatted value', function () { +it('can state whether a column has the correct formatted value', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -267,7 +267,7 @@ it('can state whether a column has the correct formatted value', function () { ->assertTableColumnFormattedStateNotSet('formatted_state', 'incorrect formatted state', $post); }); -it('can output JSON values', function () { +it('can output JSON values', function (): void { $post = Post::factory()->create([ 'json' => ['foo' => 'bar'], ]); @@ -276,7 +276,7 @@ it('can output JSON values', function () { ->assertTableColumnStateSet('json.foo', 'bar', $post); }); -it('can output nested JSON values', function () { +it('can output nested JSON values', function (): void { $post = Post::factory()->create([ 'json' => ['bar' => ['baz' => 'qux']], ]); @@ -285,7 +285,7 @@ it('can output nested JSON values', function () { ->assertTableColumnStateSet('json.bar.baz', 'qux', $post); }); -it('can output relationship JSON values', function () { +it('can output relationship JSON values', function (): void { $post = Post::factory()->create([ 'author_id' => User::factory()->state([ 'json' => ['foo' => 'bar'], @@ -296,7 +296,7 @@ it('can output relationship JSON values', function () { ->assertTableColumnStateSet('author.json.foo', 'bar', $post); }); -it('can output relationship nested JSON values', function () { +it('can output relationship nested JSON values', function (): void { $post = Post::factory()->create([ 'author_id' => User::factory()->state([ 'json' => ['bar' => ['baz' => 'qux']], @@ -307,7 +307,7 @@ it('can output relationship nested JSON values', function () { ->assertTableColumnStateSet('author.json.bar.baz', 'qux', $post); }); -it('can output values in a JSON array column of objects', function () { +it('can output values in a JSON array column of objects', function (): void { $post = Post::factory()->create([ 'json_array_of_objects' => [ ['value' => 'foo'], @@ -320,7 +320,7 @@ it('can output values in a JSON array column of objects', function () { ->assertTableColumnStateSet('json_array_of_objects.*.value', ['foo', 'bar', 'baz'], $post); }); -it('can state whether a column has extra attributes', function () { +it('can state whether a column has extra attributes', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -328,7 +328,7 @@ it('can state whether a column has extra attributes', function () { ->assertTableColumnDoesNotHaveExtraAttributes('extra_attributes', ['class' => 'text-primary-500'], $post); }); -it('can state whether a column has a description', function () { +it('can state whether a column has a description', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -338,7 +338,7 @@ it('can state whether a column has a description', function () { ->assertTableColumnDoesNotHaveDescription('with_description', 'incorrect description above', $post, 'above'); }); -it('can state whether a select column has options', function () { +it('can state whether a select column has options', function (): void { $post = Post::factory()->create(); livewire(PostsTable::class) @@ -346,7 +346,7 @@ it('can state whether a select column has options', function () { ->assertTableSelectColumnDoesNotHaveOptions('with_options', ['one' => 'One', 'two' => 'Two'], $post); }); -it('can assert that a column exists with the given configuration', function () { +it('can assert that a column exists with the given configuration', function (): void { $publishedPost = Post::factory()->create([ 'is_published' => true, ]); @@ -376,7 +376,7 @@ it('can assert that a column exists with the given configuration', function () { }, $publishedPost); }); -it('can automatically detect boolean cast attribute in icon column', function () { +it('can automatically detect boolean cast attribute in icon column', function (): void { $post = Post::factory() ->create(['is_published' => false]); diff --git a/tests/src/Tables/Concerns/CanSearchRecordsTest.php b/tests/src/Tables/Concerns/CanSearchRecordsTest.php index 25628a7929..caaa2d73db 100644 --- a/tests/src/Tables/Concerns/CanSearchRecordsTest.php +++ b/tests/src/Tables/Concerns/CanSearchRecordsTest.php @@ -7,7 +7,7 @@ use function PHPUnit\Framework\assertCount; uses(TestCase::class); -it('can extract the search into words using whitespace', function () { +it('can extract the search into words using whitespace', function (): void { $trait = new class { use CanSearchRecords { @@ -39,7 +39,7 @@ it('can extract the search into words using whitespace', function () { $this->assertSame([], $trait->extractTableSearchWords('')); }); -it('can trim the search query', function () { +it('can trim the search query', function (): void { $trait = new class { use CanSearchRecords; diff --git a/tests/src/Tables/Filters/FilterTest.php b/tests/src/Tables/Filters/FilterTest.php index ca73c314c7..ff1bfec012 100644 --- a/tests/src/Tables/Filters/FilterTest.php +++ b/tests/src/Tables/Filters/FilterTest.php @@ -9,7 +9,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can filter records by boolean column', function () { +it('can filter records by boolean column', function (): void { $posts = Post::factory()->count(10)->create(); livewire(PostsTable::class) @@ -19,7 +19,7 @@ it('can filter records by boolean column', function () { ->assertCanNotSeeTableRecords($posts->where('is_published', false)); }); -it('can filter records by relationship', function () { +it('can filter records by relationship', function (): void { $posts = Post::factory()->count(10)->create(); $author = $posts->first()->author; @@ -31,7 +31,7 @@ it('can filter records by relationship', function () { ->assertCanNotSeeTableRecords($posts->where('author_id', '!=', $author->getKey())); }); -it('can persist filters in the user\'s session', function () { +it('can persist filters in the user\'s session', function (): void { $posts = Post::factory()->count(10)->create(); $unpublishedPosts = $posts->where('is_published', false); @@ -52,7 +52,7 @@ it('can persist filters in the user\'s session', function () { ->assertCanSeeTableRecords($unpublishedPosts); }); -it('can reset filters', function () { +it('can reset filters', function (): void { $posts = Post::factory()->count(10)->create(); $unpublishedPosts = $posts->where('is_published', false); @@ -64,7 +64,7 @@ it('can reset filters', function () { ->assertCanSeeTableRecords($unpublishedPosts); }); -it('can remove a filter', function () { +it('can remove a filter', function (): void { $posts = Post::factory()->count(10)->create(); $unpublishedPosts = $posts->where('is_published', false); @@ -77,7 +77,7 @@ it('can remove a filter', function () { ->assertCanSeeTableRecords($posts); }); -it('can remove all table filters', function () { +it('can remove all table filters', function (): void { $posts = Post::factory()->count(10)->create(); $unpublishedPosts = $posts->where('is_published', false); @@ -90,7 +90,7 @@ it('can remove all table filters', function () { ->assertCanSeeTableRecords($posts); }); -it('can use a custom attribute for the `SelectFilter`', function () { +it('can use a custom attribute for the `SelectFilter`', function (): void { $posts = Post::factory()->count(10)->create(); $unpublishedPosts = $posts->where('is_published', false); @@ -103,7 +103,7 @@ it('can use a custom attribute for the `SelectFilter`', function () { ->assertCanNotSeeTableRecords($unpublishedPosts); }); -it('can assert a filter exists with a given configuration', function () { +it('can assert a filter exists with a given configuration', function (): void { livewire(PostsTable::class) ->assertTableFilterExists('is_published', function (Filter $filter): bool { return $filter->getLabel() === 'Is published'; diff --git a/tests/src/Tables/Filters/TrashedFilterTest.php b/tests/src/Tables/Filters/TrashedFilterTest.php index 1865d1f924..302f8c3767 100644 --- a/tests/src/Tables/Filters/TrashedFilterTest.php +++ b/tests/src/Tables/Filters/TrashedFilterTest.php @@ -16,7 +16,7 @@ use function Pest\Laravel\assertSoftDeleted; uses(TestCase::class); -it('can filter records by trashed status', function () { +it('can filter records by trashed status', function (): void { $posts = Post::factory()->count(5)->create(); $trashedPosts = Post::factory()->count(5)->trashed()->create(); @@ -34,7 +34,7 @@ it('can filter records by trashed status', function () { ->assertCanNotSeeTableRecords($trashedPosts); }); -it('can delete records that are not already deleted', function () { +it('can delete records that are not already deleted', function (): void { $post = Post::factory()->create(); $trashedPost = Post::factory()->trashed()->create(); @@ -57,7 +57,7 @@ it('can delete records that are not already deleted', function () { assertSoftDeleted($trashedPost); }); -it('can force delete records that are already deleted', function () { +it('can force delete records that are already deleted', function (): void { $post = Post::factory()->create(); $trashedPost = Post::factory()->trashed()->create(); @@ -80,7 +80,7 @@ it('can force delete records that are already deleted', function () { assertModelMissing($trashedPost); }); -it('can restore records that are already deleted', function () { +it('can restore records that are already deleted', function (): void { $post = Post::factory()->create(); $trashedPost = Post::factory()->trashed()->create(); diff --git a/tests/src/Tables/GroupingTest.php b/tests/src/Tables/GroupingTest.php index be1d454532..9993018ebf 100644 --- a/tests/src/Tables/GroupingTest.php +++ b/tests/src/Tables/GroupingTest.php @@ -10,11 +10,11 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can group a table', function () { +it('can group a table', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) - ->tap(function (Testable $testable) { + ->tap(function (Testable $testable): void { /** @var PostsTable $livewire */ $livewire = $testable->instance(); @@ -29,7 +29,7 @@ it('can group a table', function () { ->getLabel()->toBe('Dynamic label'); }) ->set('tableGrouping', 'author.name') - ->tap(function (Testable $testable) { + ->tap(function (Testable $testable): void { /** @var PostsTable $livewire */ $livewire = $testable->instance(); diff --git a/tests/src/Tables/RecordTest.php b/tests/src/Tables/RecordTest.php index d8476ba8e4..6e42cf27e4 100644 --- a/tests/src/Tables/RecordTest.php +++ b/tests/src/Tables/RecordTest.php @@ -8,7 +8,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can list records', function () { +it('can list records', function (): void { $posts = Post::factory()->count(10)->create(); livewire(PostsTable::class) diff --git a/tests/src/Tables/SummaryTest.php b/tests/src/Tables/SummaryTest.php index 6785a77411..4e99096218 100644 --- a/tests/src/Tables/SummaryTest.php +++ b/tests/src/Tables/SummaryTest.php @@ -8,7 +8,7 @@ use function Filament\Tests\livewire; uses(TestCase::class); -it('can average values in a column', function () { +it('can average values in a column', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -16,7 +16,7 @@ it('can average values in a column', function () { ->assertTableColumnSummarySet('rating', 'average', $posts->avg('rating')); }); -it('can average values in a column on this pagination page', function () { +it('can average values in a column on this pagination page', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -24,7 +24,7 @@ it('can average values in a column on this pagination page', function () { ->assertTableColumnSummarySet('rating', 'average', $posts->take(10)->avg('rating'), isCurrentPaginationPageOnly: true); }); -it('can average subset of values in a column', function () { +it('can average subset of values in a column', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -32,7 +32,7 @@ it('can average subset of values in a column', function () { ->assertTableColumnSummarySet('rating', 'published_average', $posts->where('is_published', true)->avg('rating')); }); -it('can average subset of values in a column on this pagination page', function () { +it('can average subset of values in a column on this pagination page', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -40,7 +40,7 @@ it('can average subset of values in a column on this pagination page', function ->assertTableColumnSummarySet('rating', 'published_average', $posts->take(10)->where('is_published', true)->avg('rating'), isCurrentPaginationPageOnly: true); }); -it('can count rows', function () { +it('can count rows', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -48,7 +48,7 @@ it('can count rows', function () { ->assertTableColumnSummarySet('rating', 'count', $posts->count()); }); -it('can count rows on this pagination page', function () { +it('can count rows on this pagination page', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -56,7 +56,7 @@ it('can count rows on this pagination page', function () { ->assertTableColumnSummarySet('rating', 'count', $posts->take(10)->count(), isCurrentPaginationPageOnly: true); }); -it('can count subset of rows', function () { +it('can count subset of rows', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -64,7 +64,7 @@ it('can count subset of rows', function () { ->assertTableColumnSummarySet('is_published', 'published_count', $posts->where('is_published', true)->count()); }); -it('can count subset of rows on this pagination page', function () { +it('can count subset of rows on this pagination page', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -72,7 +72,7 @@ it('can count subset of rows on this pagination page', function () { ->assertTableColumnSummarySet('is_published', 'published_count', $posts->take(10)->where('is_published', true)->count(), isCurrentPaginationPageOnly: true); }); -it('can get the range of values in a column', function () { +it('can get the range of values in a column', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -80,7 +80,7 @@ it('can get the range of values in a column', function () { ->assertTableColumnSummarySet('rating', 'range', [$posts->min('rating'), $posts->max('rating')]); }); -it('can get the range of values in a column on this pagination page', function () { +it('can get the range of values in a column on this pagination page', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -88,7 +88,7 @@ it('can get the range of values in a column on this pagination page', function ( ->assertTableColumnSummarySet('rating', 'range', [$posts->take(10)->min('rating'), $posts->take(10)->max('rating')], isCurrentPaginationPageOnly: true); }); -it('can get the range of a subset of values in a column', function () { +it('can get the range of a subset of values in a column', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -96,7 +96,7 @@ it('can get the range of a subset of values in a column', function () { ->assertTableColumnSummarySet('rating', 'published_range', [$posts->where('is_published', true)->min('rating'), $posts->where('is_published', true)->max('rating')]); }); -it('can get the range of a subset of values in a column on this pagination page', function () { +it('can get the range of a subset of values in a column on this pagination page', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -104,7 +104,7 @@ it('can get the range of a subset of values in a column on this pagination page' ->assertTableColumnSummarySet('rating', 'published_range', [$posts->take(10)->where('is_published', true)->min('rating'), $posts->take(10)->where('is_published', true)->max('rating')], isCurrentPaginationPageOnly: true); }); -it('can get the range of values from a relationship in a column', function () { +it('can get the range of values from a relationship in a column', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -112,7 +112,7 @@ it('can get the range of values from a relationship in a column', function () { ->assertTableColumnSummarySet('author.name', 'range', [$posts->min('author.name'), $posts->max('author.name')]); }); -it('can get the range of values from a relationship in a column on this pagination page', function () { +it('can get the range of values from a relationship in a column on this pagination page', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -120,7 +120,7 @@ it('can get the range of values from a relationship in a column on this paginati ->assertTableColumnSummarySet('author.name', 'range', [$posts->take(10)->min('author.name'), $posts->take(10)->max('author.name')], isCurrentPaginationPageOnly: true); }); -it('can sum values in a column', function () { +it('can sum values in a column', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -128,7 +128,7 @@ it('can sum values in a column', function () { ->assertTableColumnSummarySet('rating', 'sum', $posts->sum('rating')); }); -it('can sum values in a column on this pagination page', function () { +it('can sum values in a column on this pagination page', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -136,7 +136,7 @@ it('can sum values in a column on this pagination page', function () { ->assertTableColumnSummarySet('rating', 'sum', $posts->take(10)->sum('rating'), isCurrentPaginationPageOnly: true); }); -it('can sum subset of values in a column', function () { +it('can sum subset of values in a column', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class) @@ -144,7 +144,7 @@ it('can sum subset of values in a column', function () { ->assertTableColumnSummarySet('rating', 'published_sum', $posts->where('is_published', true)->sum('rating')); }); -it('can sum subset of values in a column on this pagination page', function () { +it('can sum subset of values in a column on this pagination page', function (): void { $posts = Post::factory()->count(20)->create(); livewire(PostsTable::class)