From 40b4681eae9b028b23eed1864d673e496d884082 Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:02:04 +0100 Subject: [PATCH 01/12] Fix ChangeLog, SP --- CHANGELOG.md | 15 ++++++++++++++- src/LaravelLivewireTablesServiceProvider.php | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 794f3a21d..f1452ac48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ All notable changes to `laravel-livewire-tables` will be documented in this file +## [v3.2.5] - 2024-04-30 +### New Features +- Add setConfigurableArea by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1706 +- Add User prompt for missing inputs by @achyutkneupane in https://github.com/rappasoft/laravel-livewire-tables/pull/1681 + +### Bug Fixes +- UI patch: toolbar fix for reordering by @itsLeonB in https://github.com/rappasoft/laravel-livewire-tables/pull/1690 + +### Tweaks +- Adjust Workflow behaviour for PCOV by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1706 +- Updated nl language by @Jerimu in https://github.com/rappasoft/laravel-livewire-tables/pull/1695 +- Updated nl language by @Jerimu in https://github.com/rappasoft/laravel-livewire-tables/pull/1694 + ## [v3.2.4] - 2024-03-01 ### Bug Fixes - Collapsing Columns fix when multiple tables are displayed on a page by @lrljoe @@ -1160,4 +1173,4 @@ Ground Up Rebuild [0.1.4]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.1.3...v0.1.4 [0.1.3]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.1.2...v0.1.3 [0.1.2]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.1.1...v0.1.2 -[0.1.1]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.1.0...v0.1.1 \ No newline at end of file +[0.1.1]: https://github.com/rappasoft/laravel-livewire-tables/compare/v0.1.0...v0.1.1 diff --git a/src/LaravelLivewireTablesServiceProvider.php b/src/LaravelLivewireTablesServiceProvider.php index 015ba8684..f7fab2887 100644 --- a/src/LaravelLivewireTablesServiceProvider.php +++ b/src/LaravelLivewireTablesServiceProvider.php @@ -14,7 +14,7 @@ class LaravelLivewireTablesServiceProvider extends ServiceProvider public function boot(): void { - AboutCommand::add('Rappasoft Laravel Livewire Tables', fn () => ['Version' => '3.2.4']); + AboutCommand::add('Rappasoft Laravel Livewire Tables', fn () => ['Version' => '3.2.5']); $this->mergeConfigFrom( __DIR__.'/../config/livewire-tables.php', 'livewire-tables' From d0f4a7689c1b06263ed71e3fc943a507851e93b3 Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:18:17 +0100 Subject: [PATCH 02/12] Filters - Set wire:model Method per-filter (#1699) * Add wireableMethod tests --------- Co-authored-by: lrljoe --- CHANGELOG.md | 4 + docs/filters/available-methods.md | 60 +++++++++++++ .../components/tools/filters/date.blade.php | 3 +- .../tools/filters/datetime.blade.php | 1 - .../filters/multi-select-dropdown.blade.php | 4 +- .../tools/filters/multi-select.blade.php | 5 +- .../components/tools/filters/number.blade.php | 3 +- .../components/tools/filters/select.blade.php | 3 +- .../tools/filters/text-field.blade.php | 3 +- src/Views/Filters/DateFilter.php | 4 + src/Views/Filters/DateRangeFilter.php | 4 + src/Views/Filters/DateTimeFilter.php | 4 + src/Views/Filters/LivewireComponentFilter.php | 5 ++ .../Filters/MultiSelectDropdownFilter.php | 4 + src/Views/Filters/MultiSelectFilter.php | 4 + src/Views/Filters/NumberFilter.php | 4 + src/Views/Filters/NumberRangeFilter.php | 4 + src/Views/Filters/SelectFilter.php | 4 + src/Views/Filters/TextFilter.php | 4 + src/Views/Traits/Core/HasWireables.php | 85 +++++++++++++++++++ tests/Views/Filters/DateFilterTest.php | 37 ++++++++ tests/Views/Filters/DateTimeFilterTest.php | 37 ++++++++ .../Filters/MultiSelectDropdownFilterTest.php | 41 +++++++++ tests/Views/Filters/MultiSelectFilterTest.php | 38 +++++++++ tests/Views/Filters/SelectFilterTest.php | 36 ++++++++ tests/Views/Filters/TextFilterTest.php | 39 +++++++++ 26 files changed, 427 insertions(+), 13 deletions(-) create mode 100644 src/Views/Traits/Core/HasWireables.php diff --git a/CHANGELOG.md b/CHANGELOG.md index f1452ac48..c9981213c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `laravel-livewire-tables` will be documented in this file +## [v3.2.6] - UNRELEASED +### New Features +- Add configurable wire:model for filters by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1699 + ## [v3.2.5] - 2024-04-30 ### New Features - Add setConfigurableArea by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1706 diff --git a/docs/filters/available-methods.md b/docs/filters/available-methods.md index 30a82eee7..53701d07b 100644 --- a/docs/filters/available-methods.md +++ b/docs/filters/available-methods.md @@ -398,3 +398,63 @@ If the filter takes any config options, you can set them with the `config` metho 'max' => '2021-12-31', ]) ``` + +### Customising Wireable Behaviour + +For the following Filters, you may customise how the input is wire:model into the Table Component: + +- DateFilter (Defaults to Live) +- DateTimeFilter (Defaults to Live) +- MultiSelectDropdownFilter (Defaults to live.debounce.250ms) +- MultiSelectFilter (Defaults to live.debounce.250ms) +- NumberFilter (Defaults to Blur) +- SelectFilter (Defaults to Live) +- TextFilter (Defaults to Blur) + +You may override this using the following methods, on any of the above Filter types: + +#### setWireBlur() +Forces the filter to use a wire:model.blur approach +``` + TextFilter::make('Name') + ->config([ + 'placeholder' => 'Search Name', + 'maxlength' => '25', + ]) + ->setWireBlur() +``` + +#### setWireDefer() +Forces the filter to use a wire:model approach +``` + TextFilter::make('Name') + ->config([ + 'placeholder' => 'Search Name', + 'maxlength' => '25', + ]) + ->setWireDefer() +``` + +#### setWireLive() +Forces the fitler to use a wire:model.live approach +``` + TextFilter::make('Name') + ->config([ + 'placeholder' => 'Search Name', + 'maxlength' => '25', + ]) + ->setWireLive() +``` + +#### setWireDebounce(int $debounceDelay) +Allows you to pass a string to use a wire:model.live.debounce.Xms approach +``` +``` + TextFilter::make('Name') + ->config([ + 'placeholder' => 'Search Name', + 'maxlength' => '25', + ]) + ->setWireDebounce(50) +``` +``` \ No newline at end of file diff --git a/resources/views/components/tools/filters/date.blade.php b/resources/views/components/tools/filters/date.blade.php index 947bb9b61..6191a299e 100644 --- a/resources/views/components/tools/filters/date.blade.php +++ b/resources/views/components/tools/filters/date.blade.php @@ -4,8 +4,7 @@ "rounded-md shadow-sm" => $isTailwind, "mb-3 mb-md-0 input-group" => $isBootstrap, ])> - getWireMethod("filterComponents.".$filter->getKey()) }} wire:key="{{ $filter->generateWireKey($tableName, 'date') }}" id="{{ $tableName }}-filter-{{ $filter->getKey() }}@if($filter->hasCustomPosition())-{{ $filter->getCustomPosition() }}@endif" type="date" diff --git a/resources/views/components/tools/filters/datetime.blade.php b/resources/views/components/tools/filters/datetime.blade.php index d05f0e087..5abd43c94 100644 --- a/resources/views/components/tools/filters/datetime.blade.php +++ b/resources/views/components/tools/filters/datetime.blade.php @@ -6,7 +6,6 @@ "mb-3 mb-md-0 input-group" => $isBootstrap, ])> getWireMethod("filterComponents.".$filter->getKey()) }} wire:key="{{ $filter->generateWireKey($tableName, 'multiselectdropdown') }}" id="{{ $tableName }}-filter-{{ $filter->getKey() }}@if($filter->hasCustomPosition())-{{ $filter->getCustomPosition() }}@endif" class="{{ $isBootstrap4 ? 'form-control' : 'form-select' }}" diff --git a/resources/views/components/tools/filters/multi-select.blade.php b/resources/views/components/tools/filters/multi-select.blade.php index 4e2ec329b..884a84441 100644 --- a/resources/views/components/tools/filters/multi-select.blade.php +++ b/resources/views/components/tools/filters/multi-select.blade.php @@ -27,7 +27,7 @@ class="text-indigo-600 rounded border-gray-300 shadow-sm transition duration-150 id="{{ $tableName }}-filter-{{ $filter->getKey() }}-{{ $loop->index }}-@if($filter->hasCustomPosition()){{ $filter->getCustomPosition() }}@endif" value="{{ $key }}" wire:key="{{ $tableName }}-filter-{{ $filter->getKey() }}-{{ $loop->index }}-@if($filter->hasCustomPosition()){{ $filter->getCustomPosition() }}@endif" - wire:model.live.debounce.250ms="filterComponents.{{ $filter->getKey() }}" + {{ $filter->getWireMethod("filterComponents.".$filter->getKey()) }} class="text-indigo-600 rounded border-gray-300 shadow-sm transition duration-150 ease-in-out focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 dark:bg-gray-900 dark:text-white dark:border-gray-600 dark:hover:bg-gray-600 dark:focus:bg-gray-600 disabled:opacity-50 disabled:cursor-wait" > @@ -53,7 +53,8 @@ class="form-check-input" id="{{ $tableName }}-filter-{{ $filter->getKey() }}-{{ $loop->index }}-@if($filter->hasCustomPosition()){{ $filter->getCustomPosition() }}@endif" value="{{ $key }}" wire:key="{{ $tableName }}-filter-{{ $filter->getKey() }}-{{ $loop->index }}-@if($filter->hasCustomPosition()){{ $filter->getCustomPosition() }}@endif" - wire:model.live.debounce.250ms="filterComponents.{{ $filter->getKey() }}" + {{ $filter->getWireMethod("filterComponents.".$filter->getKey()) }} + > diff --git a/resources/views/components/tools/filters/number.blade.php b/resources/views/components/tools/filters/number.blade.php index b5903ab6d..e31854848 100644 --- a/resources/views/components/tools/filters/number.blade.php +++ b/resources/views/components/tools/filters/number.blade.php @@ -6,8 +6,7 @@ "rounded-md shadow-sm" => $isTailwind, "mb-3 mb-md-0 input-group" => $isBootstrap, ])> - getWireMethod("filterComponents.".$filter->getKey()) }} wire:key="{{ $filter->generateWireKey($tableName, 'number') }}" id="{{ $tableName }}-filter-{{ $filter->getKey() }}@if($filter->hasCustomPosition())-{{ $filter->getCustomPosition() }}@endif" type="number" diff --git a/resources/views/components/tools/filters/select.blade.php b/resources/views/components/tools/filters/select.blade.php index 55952ed88..42fcdad08 100644 --- a/resources/views/components/tools/filters/select.blade.php +++ b/resources/views/components/tools/filters/select.blade.php @@ -5,8 +5,7 @@ 'rounded-md shadow-sm' => $isTailwind, 'inline' => $isBootstrap, ])> - getWireMethod("filterComponents.".$filter->getKey()) }} wire:key="{{ $filter->generateWireKey($tableName, 'text') }}" id="{{ $tableName }}-filter-{{ $filter->getKey() }}@if($filter->hasCustomPosition())-{{ $filter->getCustomPosition() }}@endif" type="text" diff --git a/src/Views/Filters/DateFilter.php b/src/Views/Filters/DateFilter.php index 574a4f739..99d6a7ba0 100644 --- a/src/Views/Filters/DateFilter.php +++ b/src/Views/Filters/DateFilter.php @@ -4,12 +4,16 @@ use DateTime; use Rappasoft\LaravelLivewireTables\Views\Filter; +use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasWireables; use Rappasoft\LaravelLivewireTables\Views\Traits\Filters\{HasConfig, IsStringFilter}; class DateFilter extends Filter { use HasConfig, IsStringFilter; + use HasWireables; + + public string $wireMethod = 'live'; protected string $view = 'livewire-tables::components.tools.filters.date'; diff --git a/src/Views/Filters/DateRangeFilter.php b/src/Views/Filters/DateRangeFilter.php index 7f46f0f20..e08c4bfe5 100644 --- a/src/Views/Filters/DateRangeFilter.php +++ b/src/Views/Filters/DateRangeFilter.php @@ -3,12 +3,16 @@ namespace Rappasoft\LaravelLivewireTables\Views\Filters; use Rappasoft\LaravelLivewireTables\Views\Filter; +use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasWireables; use Rappasoft\LaravelLivewireTables\Views\Traits\Filters\{HasConfig,HasOptions}; class DateRangeFilter extends Filter { use HasOptions, HasConfig; + use HasWireables; + + public string $wireMethod = 'blur'; protected string $view = 'livewire-tables::components.tools.filters.date-range'; diff --git a/src/Views/Filters/DateTimeFilter.php b/src/Views/Filters/DateTimeFilter.php index 8a1e06675..1d266549e 100644 --- a/src/Views/Filters/DateTimeFilter.php +++ b/src/Views/Filters/DateTimeFilter.php @@ -4,12 +4,16 @@ use DateTime; use Rappasoft\LaravelLivewireTables\Views\Filter; +use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasWireables; use Rappasoft\LaravelLivewireTables\Views\Traits\Filters\{HasConfig, IsStringFilter}; class DateTimeFilter extends Filter { use HasConfig, IsStringFilter; + use HasWireables; + + public string $wireMethod = 'live'; protected string $view = 'livewire-tables::components.tools.filters.datetime'; diff --git a/src/Views/Filters/LivewireComponentFilter.php b/src/Views/Filters/LivewireComponentFilter.php index 25544ac45..cfcf29e8c 100644 --- a/src/Views/Filters/LivewireComponentFilter.php +++ b/src/Views/Filters/LivewireComponentFilter.php @@ -4,9 +4,14 @@ use Rappasoft\LaravelLivewireTables\Exceptions\DataTableConfigurationException; use Rappasoft\LaravelLivewireTables\Views\Filter; +use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasWireables; class LivewireComponentFilter extends Filter { + use HasWireables; + + public string $wireMethod = 'blur'; + protected string $view = 'livewire-tables::components.tools.filters.livewire-component-filter'; public string $livewireComponent = ''; diff --git a/src/Views/Filters/MultiSelectDropdownFilter.php b/src/Views/Filters/MultiSelectDropdownFilter.php index 4954ad676..ae784b58c 100644 --- a/src/Views/Filters/MultiSelectDropdownFilter.php +++ b/src/Views/Filters/MultiSelectDropdownFilter.php @@ -3,12 +3,16 @@ namespace Rappasoft\LaravelLivewireTables\Views\Filters; use Rappasoft\LaravelLivewireTables\Views\Filter; +use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasWireables; use Rappasoft\LaravelLivewireTables\Views\Traits\Filters\{HasOptions,IsArrayFilter}; class MultiSelectDropdownFilter extends Filter { use HasOptions, IsArrayFilter; + use HasWireables; + + public string $wireMethod = 'live.debounce.250ms'; protected string $view = 'livewire-tables::components.tools.filters.multi-select-dropdown'; diff --git a/src/Views/Filters/MultiSelectFilter.php b/src/Views/Filters/MultiSelectFilter.php index 594b4ead0..f43b37302 100644 --- a/src/Views/Filters/MultiSelectFilter.php +++ b/src/Views/Filters/MultiSelectFilter.php @@ -3,12 +3,16 @@ namespace Rappasoft\LaravelLivewireTables\Views\Filters; use Rappasoft\LaravelLivewireTables\Views\Filter; +use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasWireables; use Rappasoft\LaravelLivewireTables\Views\Traits\Filters\{HasOptions,IsArrayFilter}; class MultiSelectFilter extends Filter { use HasOptions, IsArrayFilter; + use HasWireables; + + public string $wireMethod = 'live.debounce.250ms'; protected string $view = 'livewire-tables::components.tools.filters.multi-select'; diff --git a/src/Views/Filters/NumberFilter.php b/src/Views/Filters/NumberFilter.php index 75929520a..6af596822 100644 --- a/src/Views/Filters/NumberFilter.php +++ b/src/Views/Filters/NumberFilter.php @@ -3,11 +3,15 @@ namespace Rappasoft\LaravelLivewireTables\Views\Filters; use Rappasoft\LaravelLivewireTables\Views\Filter; +use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasWireables; use Rappasoft\LaravelLivewireTables\Views\Traits\Filters\{IsStringFilter}; class NumberFilter extends Filter { use IsStringFilter; + use HasWireables; + + public string $wireMethod = 'blur'; protected string $view = 'livewire-tables::components.tools.filters.number'; diff --git a/src/Views/Filters/NumberRangeFilter.php b/src/Views/Filters/NumberRangeFilter.php index f8b44ee6b..a95be42c3 100644 --- a/src/Views/Filters/NumberRangeFilter.php +++ b/src/Views/Filters/NumberRangeFilter.php @@ -3,11 +3,15 @@ namespace Rappasoft\LaravelLivewireTables\Views\Filters; use Rappasoft\LaravelLivewireTables\Views\Filter; +use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasWireables; use Rappasoft\LaravelLivewireTables\Views\Traits\Filters\{HasOptions}; class NumberRangeFilter extends Filter { use HasOptions; + use HasWireables; + + public string $wireMethod = 'blur'; protected string $view = 'livewire-tables::components.tools.filters.number-range'; diff --git a/src/Views/Filters/SelectFilter.php b/src/Views/Filters/SelectFilter.php index 6e67daa81..a62260dd9 100644 --- a/src/Views/Filters/SelectFilter.php +++ b/src/Views/Filters/SelectFilter.php @@ -3,12 +3,16 @@ namespace Rappasoft\LaravelLivewireTables\Views\Filters; use Rappasoft\LaravelLivewireTables\Views\Filter; +use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasWireables; use Rappasoft\LaravelLivewireTables\Views\Traits\Filters\{HasOptions,IsStringFilter}; class SelectFilter extends Filter { use HasOptions, IsStringFilter; + use HasWireables; + + public string $wireMethod = 'live'; protected string $view = 'livewire-tables::components.tools.filters.select'; diff --git a/src/Views/Filters/TextFilter.php b/src/Views/Filters/TextFilter.php index 2a8561150..fcfe26db9 100644 --- a/src/Views/Filters/TextFilter.php +++ b/src/Views/Filters/TextFilter.php @@ -3,11 +3,15 @@ namespace Rappasoft\LaravelLivewireTables\Views\Filters; use Rappasoft\LaravelLivewireTables\Views\Filter; +use Rappasoft\LaravelLivewireTables\Views\Traits\Core\HasWireables; use Rappasoft\LaravelLivewireTables\Views\Traits\Filters\{IsStringFilter}; class TextFilter extends Filter { use IsStringFilter; + use HasWireables; + + public string $wireMethod = 'blur'; protected string $view = 'livewire-tables::components.tools.filters.text-field'; diff --git a/src/Views/Traits/Core/HasWireables.php b/src/Views/Traits/Core/HasWireables.php new file mode 100644 index 000000000..c0a7e34af --- /dev/null +++ b/src/Views/Traits/Core/HasWireables.php @@ -0,0 +1,85 @@ +checkWireMethod($wireMethod); + + $this->{$wireMethod} = 'live.debounce.'.$debouncePeriod.'ms'; + + return $this; + } + + public function setWireBlur(string $wireMethod = 'wireMethod'): self + { + $wireMethod = $this->checkWireMethod($wireMethod); + + $this->{$wireMethod} = 'blur'; + + return $this; + } + + public function setWireDefer(string $wireMethod = 'wireMethod'): self + { + $wireMethod = $this->checkWireMethod($wireMethod); + + $this->{$wireMethod} = 'defer'; + + return $this; + } + + public function setWireLive(string $wireMethod = 'wireMethod'): self + { + $wireMethod = $this->checkWireMethod($wireMethod); + + $this->{$wireMethod} = 'live'; + + return $this; + } + + public function setWireMethod(string $definedWireMethod, string $wireMethod = 'wireMethod'): self + { + $wireMethod = $this->checkWireMethod($wireMethod); + + $this->{$wireMethod} = $definedWireMethod; + + return $this; + } + + public function getWireableMethod(string $wireMethod = 'wireMethod'): string + { + $wireMethod = $this->checkWireMethod($wireMethod); + + return $this->{$wireMethod}; + } + + public function getWireMethod(string $wireableElement, string $wireMethod = 'wireMethod'): string + { + $wireMethod = $this->checkWireMethod($wireMethod); + + return $this->getWireMethodString($this->{$wireMethod} ?? 'blur', $wireableElement); + } + + public function getWireMethodString(string $wireMethod, string $wireableElement): string + { + + if ($wireMethod != 'defer') { + return 'wire:model.'.$wireMethod.'='.$wireableElement; + } + + return 'wire:model='.$wireableElement; + + } +} diff --git a/tests/Views/Filters/DateFilterTest.php b/tests/Views/Filters/DateFilterTest.php index 78155c9c7..e86ebc1d4 100644 --- a/tests/Views/Filters/DateFilterTest.php +++ b/tests/Views/Filters/DateFilterTest.php @@ -177,4 +177,41 @@ public function test_can_not_get_filter_pills_invalid_value(): void $this->assertNull(self::$filterInstance->getFilterPillValue('2022-2111')); } + + /** + * @test + */ + public function test_can_set_text_filter_wireable_live(): void + { + + $this->assertSame('live', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model.live=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireBlur(); + + $this->assertSame('blur', self::$filterInstance->getWireableMethod()); + + $this->assertSame('wire:model.blur=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireLive(); + + $this->assertSame('live', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model.live=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireDefer(); + + $this->assertSame('defer', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireDebounce(250); + + $this->assertSame('live.debounce.250ms', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model.live.debounce.250ms=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireDebounce(500); + + $this->assertSame('live.debounce.500ms', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model.live.debounce.500ms=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + } } diff --git a/tests/Views/Filters/DateTimeFilterTest.php b/tests/Views/Filters/DateTimeFilterTest.php index 4b24d04e9..01a2643e8 100644 --- a/tests/Views/Filters/DateTimeFilterTest.php +++ b/tests/Views/Filters/DateTimeFilterTest.php @@ -156,4 +156,41 @@ public function test_can_not_get_filter_pills_invalid_value(): void $this->assertNull(self::$filterInstance->getFilterPillValue('2022-1111')); } + + /** + * @test + */ + public function test_can_set_text_filter_wireable_live(): void + { + + $this->assertSame('live', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model.live=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireBlur(); + + $this->assertSame('blur', self::$filterInstance->getWireableMethod()); + + $this->assertSame('wire:model.blur=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireLive(); + + $this->assertSame('live', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model.live=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireDefer(); + + $this->assertSame('defer', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireDebounce(250); + + $this->assertSame('live.debounce.250ms', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model.live.debounce.250ms=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireDebounce(500); + + $this->assertSame('live.debounce.500ms', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model.live.debounce.500ms=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + } } diff --git a/tests/Views/Filters/MultiSelectDropdownFilterTest.php b/tests/Views/Filters/MultiSelectDropdownFilterTest.php index fbb9bb615..6e6504f8c 100644 --- a/tests/Views/Filters/MultiSelectDropdownFilterTest.php +++ b/tests/Views/Filters/MultiSelectDropdownFilterTest.php @@ -259,4 +259,45 @@ public function can_set_custom_filter_view(array $optionsArray): void $filter->setCustomView('test-custom-filter-view'); $this->assertSame('test-custom-filter-view', $filter->getViewPath()); } + + /** + * @test + * + * @depends testArraySetup + */ + public function test_can_set_select_filter_wireable_live(array $optionsArray): void + { + + $filter = MultiSelectDropdownFilter::make('Active')->options($optionsArray); + + $this->assertSame('live.debounce.250ms', $filter->getWireableMethod()); + + $this->assertSame('wire:model.live.debounce.250ms=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireBlur(); + + $this->assertSame('blur', $filter->getWireableMethod()); + $this->assertSame('wire:model.blur=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireLive(); + + $this->assertSame('live', $filter->getWireableMethod()); + $this->assertSame('wire:model.live=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireDefer(); + + $this->assertSame('defer', $filter->getWireableMethod()); + $this->assertSame('wire:model=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireDebounce(250); + + $this->assertSame('live.debounce.250ms', $filter->getWireableMethod()); + $this->assertSame('wire:model.live.debounce.250ms=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireDebounce(500); + + $this->assertSame('live.debounce.500ms', $filter->getWireableMethod()); + $this->assertSame('wire:model.live.debounce.500ms=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + } } diff --git a/tests/Views/Filters/MultiSelectFilterTest.php b/tests/Views/Filters/MultiSelectFilterTest.php index 2479c95b6..e9fbd31ea 100644 --- a/tests/Views/Filters/MultiSelectFilterTest.php +++ b/tests/Views/Filters/MultiSelectFilterTest.php @@ -215,4 +215,42 @@ public function can_set_custom_filter_view(): void $filter->setCustomView('test-custom-filter-view'); $this->assertSame('test-custom-filter-view', $filter->getViewPath()); } + + /** + * @test + */ + public function test_can_set_select_filter_wireable_live(): void + { + $filter = MultiSelectFilter::make('Active'); + + $this->assertSame('live.debounce.250ms', $filter->getWireableMethod()); + + $this->assertSame('wire:model.live.debounce.250ms=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireBlur(); + + $this->assertSame('blur', $filter->getWireableMethod()); + $this->assertSame('wire:model.blur=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireLive(); + + $this->assertSame('live', $filter->getWireableMethod()); + $this->assertSame('wire:model.live=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireDefer(); + + $this->assertSame('defer', $filter->getWireableMethod()); + $this->assertSame('wire:model=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireDebounce(250); + + $this->assertSame('live.debounce.250ms', $filter->getWireableMethod()); + $this->assertSame('wire:model.live.debounce.250ms=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireDebounce(500); + + $this->assertSame('live.debounce.500ms', $filter->getWireableMethod()); + $this->assertSame('wire:model.live.debounce.500ms=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + } } diff --git a/tests/Views/Filters/SelectFilterTest.php b/tests/Views/Filters/SelectFilterTest.php index 0d5b4fb6f..fb68f46f0 100644 --- a/tests/Views/Filters/SelectFilterTest.php +++ b/tests/Views/Filters/SelectFilterTest.php @@ -91,4 +91,40 @@ public function can_set_custom_filter_view(): void self::$filterInstance->setCustomView('test-custom-filter-view'); $this->assertSame('test-custom-filter-view', self::$filterInstance->getViewPath()); } + + /** + * @test + */ + public function test_can_set_select_filter_wireable_live(): void + { + $this->assertSame('live', self::$filterInstance->getWireableMethod()); + + $this->assertSame('wire:model.live=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireBlur(); + + $this->assertSame('blur', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model.blur=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireDefer(); + + $this->assertSame('defer', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireLive(); + $this->assertSame('live', self::$filterInstance->getWireableMethod()); + + $this->assertSame('wire:model.live=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireDebounce(250); + + $this->assertSame('live.debounce.250ms', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model.live.debounce.250ms=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + self::$filterInstance->setWireDebounce(500); + + $this->assertSame('live.debounce.500ms', self::$filterInstance->getWireableMethod()); + $this->assertSame('wire:model.live.debounce.500ms=filterComponents.active', self::$filterInstance->getWireMethod('filterComponents.'.self::$filterInstance->getKey())); + + } } diff --git a/tests/Views/Filters/TextFilterTest.php b/tests/Views/Filters/TextFilterTest.php index 4f4044f6e..0f8c35720 100644 --- a/tests/Views/Filters/TextFilterTest.php +++ b/tests/Views/Filters/TextFilterTest.php @@ -71,4 +71,43 @@ public function can_set_custom_filter_view(): void $filter->setCustomView('test-custom-filter-view'); $this->assertSame('test-custom-filter-view', $filter->getViewPath()); } + + /** + * @test + */ + public function test_can_set_text_filter_wireable_live(): void + { + $filter = TextFilter::make('Active'); + + $this->assertSame('blur', $filter->getWireableMethod()); + + $this->assertSame('wire:model.blur=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireLive(); + + $this->assertSame('live', $filter->getWireableMethod()); + $this->assertSame('wire:model.live=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireDefer(); + + $this->assertSame('defer', $filter->getWireableMethod()); + $this->assertSame('wire:model=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireBlur(); + + $this->assertSame('blur', $filter->getWireableMethod()); + + $this->assertSame('wire:model.blur=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireDebounce(250); + + $this->assertSame('live.debounce.250ms', $filter->getWireableMethod()); + $this->assertSame('wire:model.live.debounce.250ms=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + $filter->setWireDebounce(500); + + $this->assertSame('live.debounce.500ms', $filter->getWireableMethod()); + $this->assertSame('wire:model.live.debounce.500ms=filterComponents.active', $filter->getWireMethod('filterComponents.'.$filter->getKey())); + + } } From 9c5a6ddef7ab343990828dda0e5e60e75463e86e Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Fri, 17 May 2024 04:50:06 +0100 Subject: [PATCH 03/12] Removing broken test (#1719) --- tests/Traits/Visuals/ReorderingVisualsTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/Traits/Visuals/ReorderingVisualsTest.php b/tests/Traits/Visuals/ReorderingVisualsTest.php index 15ba9b83f..914755e38 100644 --- a/tests/Traits/Visuals/ReorderingVisualsTest.php +++ b/tests/Traits/Visuals/ReorderingVisualsTest.php @@ -204,7 +204,8 @@ public function search_hides_on_reorder(array $filterDefaultArray): void ->assertSee('Search'); } - /** @test */ + /** broken test **/ + /* public function current_page_gets_reset_on_reorder(): void { Livewire::test(PetsTable::class) @@ -219,7 +220,7 @@ public function current_page_gets_reset_on_reorder(): void ->assertSet('page', 1); // ->call('disableReordering') // TODO: Don't work // ->assertSet('page', 3); - } + }*/ /** @test */ public function bulk_actions_dropdown_gets_hidden_on_reorder(): void From 6e4ce7d93b2e4a6a2a5fcb57432a9f5e2ca8b39a Mon Sep 17 00:00:00 2001 From: marvoh Date: Fri, 17 May 2024 06:54:37 +0300 Subject: [PATCH 04/12] Scan provided path for all available FQCNs in paths within and outside app folder (#1714) * Updated the make command to scan paths provided and check whether class of the model provided exists in the file. This works with paths that are both within the app folder and outside such as vendor directory --------- Co-authored-by: Marvin Ochieng --- CHANGELOG.md | 1 + src/Commands/MakeCommand.php | 47 +++++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9981213c..3af991f2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ All notable changes to `laravel-livewire-tables` will be documented in this file +======= ## [v3.2.6] - UNRELEASED ### New Features - Add configurable wire:model for filters by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1699 diff --git a/src/Commands/MakeCommand.php b/src/Commands/MakeCommand.php index 47b8d3e68..cc6a1f1f0 100644 --- a/src/Commands/MakeCommand.php +++ b/src/Commands/MakeCommand.php @@ -127,9 +127,14 @@ public function getModelImport(): string } if (isset($this->modelPath)) { - if (File::exists(rtrim($this->modelPath, '/').'/'.$this->model.'.php')) { - - return Str::studly(str_replace('/', '\\', $this->modelPath)).$this->model; + $filename = rtrim($this->modelPath, '/').'/'.$this->model.'.php'; + if (File::exists($filename)) { + //In case the file has more than one class which is highly unlikely but still possible + $classes = array_filter($this->getClassesList($filename), function($class) { + return substr($class,strrpos($class,'\\')+1) == $this->model; + }); + if(count($classes) == 1) + return $classes[0]; } } @@ -138,6 +143,42 @@ public function getModelImport(): string return 'App\Models\\'.$this->model; } + /* + * Credits to Harm Smits: https://stackoverflow.com/a/67099502/2263114 + */ + private function getClassesList($file): array + { + $classes = []; + $namespace = ''; + $tokens = \PhpToken::tokenize(file_get_contents($file)); + + for ($i = 0; $i < count($tokens); $i++) { + if ($tokens[$i]->getTokenName() === 'T_NAMESPACE') { + for ($j = $i + 1; $j < count($tokens); $j++) { + if ($tokens[$j]->getTokenName() === 'T_NAME_QUALIFIED') { + $namespace = $tokens[$j]->text; + break; + } + } + } + + if ($tokens[$i]->getTokenName() === 'T_CLASS') { + for ($j = $i + 1; $j < count($tokens); $j++) { + if ($tokens[$j]->getTokenName() === 'T_WHITESPACE') { + continue; + } + + if ($tokens[$j]->getTokenName() === 'T_STRING') { + $classes[] = $namespace . '\\' . $tokens[$j]->text; + } else { + break; + } + } + } + } + return $classes; + } + /** * @throws \Exception */ From 1a15be70361407c29e7929fc7f17c3a6b28a61b3 Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Thu, 30 May 2024 03:24:31 +0100 Subject: [PATCH 05/12] Add fix for DateColumn when empty (#1726) * Add fix for DateColumn when empty --------- Co-authored-by: lrljoe --- CHANGELOG.md | 9 ++++++ src/Commands/MakeCommand.php | 14 +++++---- src/LaravelLivewireTablesServiceProvider.php | 2 +- src/Views/Columns/DateColumn.php | 33 +++++++++++--------- 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3af991f2c..21d986add 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,15 @@ All notable changes to `laravel-livewire-tables` will be documented in this file ## [v3.2.6] - UNRELEASED ### New Features - Add configurable wire:model for filters by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1699 +- Customisable Model paths for Make command by @marvoh in https://github.com/rappasoft/laravel-livewire-tables/pull/1714 + +### Bug Fixes +- Fix error with DateColumn when empty by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1726 + +### Tweaks +- Migrate to PHPUnit Attributes rather than Doc Comments by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1727 +- Remove broken test by @lrljoe in https://github.com/rappasoft/laravel-livewire-tables/pull/1719 + ## [v3.2.5] - 2024-04-30 ### New Features diff --git a/src/Commands/MakeCommand.php b/src/Commands/MakeCommand.php index cc6a1f1f0..cdaa67130 100644 --- a/src/Commands/MakeCommand.php +++ b/src/Commands/MakeCommand.php @@ -130,11 +130,12 @@ public function getModelImport(): string $filename = rtrim($this->modelPath, '/').'/'.$this->model.'.php'; if (File::exists($filename)) { //In case the file has more than one class which is highly unlikely but still possible - $classes = array_filter($this->getClassesList($filename), function($class) { - return substr($class,strrpos($class,'\\')+1) == $this->model; + $classes = array_filter($this->getClassesList($filename), function ($class) { + return substr($class, strrpos($class, '\\') + 1) == $this->model; }); - if(count($classes) == 1) + if (count($classes) == 1) { return $classes[0]; + } } } @@ -148,9 +149,9 @@ public function getModelImport(): string */ private function getClassesList($file): array { - $classes = []; + $classes = []; $namespace = ''; - $tokens = \PhpToken::tokenize(file_get_contents($file)); + $tokens = \PhpToken::tokenize(file_get_contents($file)); for ($i = 0; $i < count($tokens); $i++) { if ($tokens[$i]->getTokenName() === 'T_NAMESPACE') { @@ -169,13 +170,14 @@ private function getClassesList($file): array } if ($tokens[$j]->getTokenName() === 'T_STRING') { - $classes[] = $namespace . '\\' . $tokens[$j]->text; + $classes[] = $namespace.'\\'.$tokens[$j]->text; } else { break; } } } } + return $classes; } diff --git a/src/LaravelLivewireTablesServiceProvider.php b/src/LaravelLivewireTablesServiceProvider.php index f7fab2887..0cdd740db 100644 --- a/src/LaravelLivewireTablesServiceProvider.php +++ b/src/LaravelLivewireTablesServiceProvider.php @@ -14,7 +14,7 @@ class LaravelLivewireTablesServiceProvider extends ServiceProvider public function boot(): void { - AboutCommand::add('Rappasoft Laravel Livewire Tables', fn () => ['Version' => '3.2.5']); + AboutCommand::add('Rappasoft Laravel Livewire Tables', fn () => ['Version' => '3.2.6']); $this->mergeConfigFrom( __DIR__.'/../config/livewire-tables.php', 'livewire-tables' diff --git a/src/Views/Columns/DateColumn.php b/src/Views/Columns/DateColumn.php index badbbcf67..e6866db57 100644 --- a/src/Views/Columns/DateColumn.php +++ b/src/Views/Columns/DateColumn.php @@ -2,6 +2,8 @@ namespace Rappasoft\LaravelLivewireTables\Views\Columns; +use Carbon\Carbon; +use DateTime; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\HtmlString; use Rappasoft\LaravelLivewireTables\Exceptions\DataTableConfigurationException; @@ -28,25 +30,26 @@ public function getContents(Model $row): null|string|\BackedEnum|HtmlString|Data { $dateTime = $this->getValue($row); - if (! ($dateTime instanceof \DateTime)) { - try { - // Check if format matches what is expected - if (! \Carbon\Carbon::hasFormatWithModifiers($dateTime, $this->getInputFormat())) { - throw new \Exception('DateColumn Received Invalid Format'); - } - // Create DateTime Object - $dateTime = \DateTime::createFromFormat($this->getInputFormat(), $dateTime); - } catch (\Exception $exception) { - report($exception); + if ($dateTime != '' && $dateTime != null) { + if ($dateTime instanceof DateTime) { + return $dateTime->format($this->getOutputFormat()); + } else { + try { + // Check if format matches what is expected + if (Carbon::canBeCreatedFromFormat($dateTime, $this->getInputFormat())) { + return Carbon::createFromFormat($this->getInputFormat(), $dateTime)->format($this->getOutputFormat()); + } + } catch (\Exception $exception) { + report($exception); + + // Return Null + return $this->getEmptyValue(); + } - // Return Null - return $this->getEmptyValue(); } } - // Return - return $dateTime->format($this->getOutputFormat()); - + return $this->getEmptyValue(); } } From 7bff9450671ea98b3913ccf566c9321bb4fa9a76 Mon Sep 17 00:00:00 2001 From: Joe <104938042+lrljoe@users.noreply.github.com> Date: Thu, 30 May 2024 03:24:49 +0100 Subject: [PATCH 06/12] PHPUnit - Migrate from Doc Comment Configuration (#1727) * Migrate from Doc Comments to Attributes for PHPUnit --------- Co-authored-by: lrljoe --- tests/DataTableComponentTest.php | 21 +- .../DebuggableDataTest.php | 6 +- tests/Events/ColumnsSelectedTest.php | 6 +- .../AutoInjectRappasoftAssetsTest.php | 14 +- .../RappasoftFrontendAssetsTest.php | 181 +++++------------- .../BulkActionsConfigurationTest.php | 41 ++-- .../ColumnSelectConfigurationTest.php | 26 +-- .../ComponentConfigurationTest.php | 65 +++---- .../CustomisationsConfigurationTest.php | 14 +- .../DebuggingConfigurationTest.php | 5 +- .../Configuration/FilterConfigurationTest.php | 17 +- .../FingerprintConfigurationTest.php | 8 +- .../Configuration/FooterConfigurationTest.php | 14 +- .../LoadingPlaceholderConfigurationTest.php | 23 +-- .../PaginationConfigurationTest.php | 26 +-- .../QueryStringAliasConfigurationTest.php | 8 +- .../RefreshConfigurationTest.php | 14 +- .../ReorderingConfigurationTest.php | 17 +- .../Configuration/SearchConfigurationTest.php | 53 ++--- .../SecondaryHeaderConfigurationTest.php | 11 +- .../SortingConfigurationTest.php | 17 +- .../Traits/Helpers/BulkActionsHelpersTest.php | 65 +++---- tests/Traits/Helpers/ColumnHelpersTest.php | 91 +++------ .../Helpers/ColumnSelectHelpersTest.php | 14 +- tests/Traits/Helpers/ComponentHelpersTest.php | 70 +++---- tests/Traits/Helpers/DebugHelpersTest.php | 5 +- tests/Traits/Helpers/FilterHelpersTest.php | 56 ++---- tests/Traits/Helpers/FooterHelpersTest.php | 8 +- .../Helpers/LoadingPlaceholderHelpersTest.php | 5 +- .../Traits/Helpers/PaginationHelpersTest.php | 38 ++-- tests/Traits/Helpers/RefreshHelpersTest.php | 8 +- .../Helpers/RelationshipHelpersTest.php | 14 +- .../Traits/Helpers/ReorderingHelpersTest.php | 32 ++-- tests/Traits/Helpers/SearchHelpersTest.php | 35 ++-- .../Helpers/SecondaryHeaderHelpersTest.php | 5 +- tests/Traits/Helpers/SortingHelpersTest.php | 50 ++--- .../Traits/Visuals/BulkActionsVisualsTest.php | 20 +- tests/Traits/Visuals/ComponentVisualsTest.php | 32 ++-- tests/Traits/Visuals/FilterVisualsTest.php | 40 ++-- .../Visuals/LoadingPlaceholderVisualsTest.php | 14 +- .../Traits/Visuals/PaginationVisualsTest.php | 98 ++++------ tests/Traits/Visuals/RefreshVisualsTest.php | 17 +- .../Traits/Visuals/ReorderingVisualsTest.php | 98 ++++------ tests/Traits/Visuals/SearchVisualsTest.php | 29 +-- tests/Traits/Visuals/SortingVisualsTest.php | 83 +++----- tests/Traits/WithMountTest.php | 5 +- tests/Traits/WithSearchTest.php | 11 +- tests/Traits/WithSortingTest.php | 26 +-- tests/Views/BooleanColumnTest.php | 8 +- tests/Views/ColumnTest.php | 38 ++-- tests/Views/Columns/BooleanColumnTest.php | 29 +-- tests/Views/Columns/ButtonGroupColumnTest.php | 14 +- tests/Views/Columns/ColorColumnTest.php | 41 ++-- tests/Views/Columns/ComponentColumnTest.php | 11 +- tests/Views/Columns/DateColumnTest.php | 26 +-- tests/Views/Columns/ImageColumnTest.php | 17 +- tests/Views/Columns/LinkColumnTest.php | 17 +- tests/Views/ComponentColumnTest.php | 11 +- tests/Views/Filters/DateFilterTest.php | 47 +---- tests/Views/Filters/DateRangeFilterTest.php | 103 ++++------ tests/Views/Filters/DateTimeFilterTest.php | 47 +---- tests/Views/Filters/FilterTestCase.php | 35 ++-- .../Filters/MultiSelectDropdownFilterTest.php | 99 +++------- tests/Views/Filters/MultiSelectFilterTest.php | 71 +++---- tests/Views/Filters/NumberFilterTest.php | 58 ++---- tests/Views/Filters/NumberRangeFilterTest.php | 97 ++++------ tests/Views/Filters/SelectFilterTest.php | 36 +--- tests/Views/Filters/TextFilterTest.php | 23 +-- .../BooleanColumnConfigurationTest.php | 11 +- .../ButtonGroupColumnConfigurationTest.php | 5 +- .../Configuration/ColumnConfigurationTest.php | 32 ++-- .../ComponentColumnConfigurationTest.php | 8 +- .../Configuration/FilterConfigurationTest.php | 29 +-- .../Traits/Helpers/ColumnHelpersTest.php | 80 +++----- .../Traits/Helpers/FilterHelpersTest.php | 98 ++++------ 75 files changed, 852 insertions(+), 1795 deletions(-) diff --git a/tests/DataTableComponentTest.php b/tests/DataTableComponentTest.php index 7de02c27c..c62fa4e09 100644 --- a/tests/DataTableComponentTest.php +++ b/tests/DataTableComponentTest.php @@ -9,8 +9,7 @@ class DataTableComponentTest extends TestCase { - /** @test */ - public function primary_key_can_be_set(): void + public function test_primary_key_can_be_set(): void { $this->assertSame('id', $this->basicTable->getPrimaryKey()); @@ -19,8 +18,7 @@ public function primary_key_can_be_set(): void $this->assertSame('name', $this->basicTable->getPrimaryKey()); } - /** @test */ - public function primary_key_can_be_checked_for_existence(): void + public function test_primary_key_can_be_checked_for_existence(): void { $this->assertTrue($this->basicTable->hasPrimaryKey()); @@ -29,16 +27,14 @@ public function primary_key_can_be_checked_for_existence(): void $this->assertFalse($this->basicTable->hasPrimaryKey()); } - /** @test */ - public function primary_key_has_to_be_set(): void + public function test_primary_key_has_to_be_set(): void { $this->expectException(\Illuminate\View\ViewException::class); Livewire::test(NoPrimaryKeyTable::class) ->call('setSearch', 'abcd'); } - /** @test */ - public function default_fingerprint_will_always_be_the_same_for_same_datatable(): void + public function test_default_fingerprint_will_always_be_the_same_for_same_datatable(): void { $this->assertSame( [ @@ -57,8 +53,7 @@ public function default_fingerprint_will_always_be_the_same_for_same_datatable() } - /** @test */ - public function default_datatable_fingerprints_will_be_different_for_each_table(): void + public function test_default_datatable_fingerprints_will_be_different_for_each_table(): void { $mockTable = new class() extends PetsTable { @@ -67,8 +62,7 @@ public function default_datatable_fingerprints_will_be_different_for_each_table( $this->assertNotSame($this->basicTable->getDataTableFingerprint(), $mockTable->getDataTableFingerprint()); } - /** @test */ - public function default_fingerprint_will_be_url_friendy(): void + public function test_default_fingerprint_will_be_url_friendy(): void { $mocks = []; for ($i = 0; $i < 9; $i++) { @@ -81,8 +75,7 @@ public function default_fingerprint_will_be_url_friendy(): void $this->assertTrue(filter_var('http://[9/$].dev', FILTER_VALIDATE_URL) === false); } - /** @test */ - public function minimum_one_column_expected(): void + public function test_minimum_one_column_expected(): void { $this->expectException(\Rappasoft\LaravelLivewireTables\Exceptions\NoColumnsException::class); $table = new NoColumnsTable(); diff --git a/tests/DataTransferObjects/DebuggableDataTest.php b/tests/DataTransferObjects/DebuggableDataTest.php index efb0b24e2..cd0bbd4f6 100644 --- a/tests/DataTransferObjects/DebuggableDataTest.php +++ b/tests/DataTransferObjects/DebuggableDataTest.php @@ -5,21 +5,18 @@ use Rappasoft\LaravelLivewireTables\DataTransferObjects\DebuggableData; use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class DebuggableDataTest extends TestCase +final class DebuggableDataTest extends TestCase { - /** @test */ public function test_example() { $this->assertTrue(true); } - /** @test */ public function test_example2() { $this->assertSame($this->basicTable->sortBy('id'), 'asc'); } - /** @test */ public function test_check_all_default_dto_elements() { $debuggableDTO = new DebuggableData($this->basicTable); @@ -34,7 +31,6 @@ public function test_check_all_default_dto_elements() $this->assertSame($debuggableArray['selected'], []); } - /** @test */ public function test_check_dto_returns_filters_correctly() { $debuggableDTO = new DebuggableData($this->basicTable); diff --git a/tests/Events/ColumnsSelectedTest.php b/tests/Events/ColumnsSelectedTest.php index fceb88761..2f623935f 100644 --- a/tests/Events/ColumnsSelectedTest.php +++ b/tests/Events/ColumnsSelectedTest.php @@ -5,18 +5,16 @@ use Illuminate\Support\Facades\Event; use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class ColumnsSelectedTest extends TestCase +final class ColumnsSelectedTest extends TestCase { - /** @test */ public function test_example() { $this->assertTrue(true); } - /** @test */ /* Temporary Removal - Suitable Replacement Inbound */ /* - public function an_event_is_emitted_when_a_column_selection_are_updated() + public function test_an_event_is_emitted_when_a_column_selection_are_updated() { Event::fake([ ColumnsSelected::class, diff --git a/tests/Features/AutoInjectRappasoftAssetsTest.php b/tests/Features/AutoInjectRappasoftAssetsTest.php index 4d196eac0..88c790b83 100644 --- a/tests/Features/AutoInjectRappasoftAssetsTest.php +++ b/tests/Features/AutoInjectRappasoftAssetsTest.php @@ -5,10 +5,9 @@ use Rappasoft\LaravelLivewireTables\Features\AutoInjectRappasoftAssets; use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class AutoInjectRappasoftAssetsTest extends TestCase +final class AutoInjectRappasoftAssetsTest extends TestCase { - /** @test */ - public function shouldInjectRappasoftAndThirdParty() + public function test_shouldInjectRappasoftAndThirdParty() { config()->set('livewire-tables.inject_core_assets_enabled', true); config()->set('livewire-tables.inject_third_party_assets_enabled', true); @@ -21,8 +20,7 @@ public function shouldInjectRappasoftAndThirdParty() $this->assertStringContainsStringIgnoringCase('', $injectionReturn); } - /** @test */ - public function shouldNotInjectRappasoftOrThirdParty() + public function test_shouldNotInjectRappasoftOrThirdParty() { config()->set('livewire-tables.inject_core_assets_enabled', false); config()->set('livewire-tables.inject_third_party_assets_enabled', false); @@ -32,8 +30,7 @@ public function shouldNotInjectRappasoftOrThirdParty() $this->assertEquals(' ', AutoInjectRappasoftAssets::injectAssets('')); } - /** @test */ - public function shouldOnlyInjectThirdParty() + public function test_shouldOnlyInjectThirdParty() { config()->set('livewire-tables.inject_core_assets_enabled', false); config()->set('livewire-tables.inject_third_party_assets_enabled', true); @@ -44,8 +41,7 @@ public function shouldOnlyInjectThirdParty() $this->assertStringContainsStringIgnoringCase('', $injectionReturn); } - /** @test */ - public function shouldOnlyInjectRappasoft() + public function test_shouldOnlyInjectRappasoft() { config()->set('livewire-tables.inject_core_assets_enabled', true); config()->set('livewire-tables.inject_third_party_assets_enabled', false); diff --git a/tests/Mechanisms/RappasoftFrontendAssetsTest.php b/tests/Mechanisms/RappasoftFrontendAssetsTest.php index 1ed997fd7..2b53fc1fa 100644 --- a/tests/Mechanisms/RappasoftFrontendAssetsTest.php +++ b/tests/Mechanisms/RappasoftFrontendAssetsTest.php @@ -2,15 +2,13 @@ namespace Rappasoft\LaravelLivewireTables\Tests\Mechanisms; +use PHPUnit\Framework\Attributes\Depends; use Rappasoft\LaravelLivewireTables\Mechanisms\RappasoftFrontendAssets; use Rappasoft\LaravelLivewireTables\Tests\TestCase; class RappasoftFrontendAssetsTest extends TestCase { - /** - * @test - */ - public function jsResponseSetupCacheEnabled(): array + public function test_JsResponseSetupCacheEnabled(): array { config()->set('livewire-tables.cache_assets', true); $lastModified = \Carbon\Carbon::now()->timestamp; @@ -24,10 +22,7 @@ public function jsResponseSetupCacheEnabled(): array return ['lastModified' => $lastModified, 'responseHeaders' => $response->headers->all()]; } - /** - * @test - */ - public function jsResponseSetupCacheDisabled(): array + public function test_JsResponseSetupCacheDisabled(): array { config()->set('livewire-tables.cache_assets', false); $date = date_create(); @@ -41,10 +36,7 @@ public function jsResponseSetupCacheDisabled(): array return ['lastModified' => date_timestamp_get($date), 'responseHeaders' => $response->headers->all()]; } - /** - * @test - */ - public function cssResponseSetupCacheEnabled(): array + public function test_CssResponseSetupCacheEnabled(): array { config()->set('livewire-tables.cache_assets', true); $date = date_create(); @@ -58,10 +50,7 @@ public function cssResponseSetupCacheEnabled(): array return ['lastModified' => date_timestamp_get($date), 'responseHeaders' => $response->headers->all()]; } - /** - * @test - */ - public function cssResponseSetupCacheDisabled(): array + public function test_CssResponseSetupCacheDisabled(): array { config()->set('livewire-tables.cache_assets', false); @@ -77,10 +66,7 @@ public function cssResponseSetupCacheDisabled(): array return ['lastModified' => date_timestamp_get($date), 'responseHeaders' => $response->headers->all()]; } - /** - * @test - */ - public function thirdPartyCssResponseSetupCacheEnabled(): array + public function test_ThirdPartyCssResponseSetupCacheEnabled(): array { config()->set('livewire-tables.cache_assets', true); @@ -96,10 +82,7 @@ public function thirdPartyCssResponseSetupCacheEnabled(): array return ['lastModified' => date_timestamp_get($date), 'responseHeaders' => $response->headers->all()]; } - /** - * @test - */ - public function thirdPartyCssResponseSetupCacheDisabled(): array + public function test_ThirdPartyCssResponseSetupCacheDisabled(): array { config()->set('livewire-tables.cache_assets', false); @@ -115,10 +98,7 @@ public function thirdPartyCssResponseSetupCacheDisabled(): array return ['lastModified' => date_timestamp_get($date), 'responseHeaders' => $response->headers->all()]; } - /** - * @test - */ - public function thirdPartyJsResponseSetupCacheEnabled(): array + public function test_ThirdPartyJsResponseSetupCacheEnabled(): array { config()->set('livewire-tables.cache_assets', true); $lastModified = \Carbon\Carbon::now()->timestamp; @@ -132,10 +112,7 @@ public function thirdPartyJsResponseSetupCacheEnabled(): array return ['lastModified' => $lastModified, 'responseHeaders' => $response->headers->all()]; } - /** - * @test - */ - public function thirdPartyJsResponseSetupCacheDisabled(): array + public function test_ThirdPartyJsResponseSetupCacheDisabled(): array { config()->set('livewire-tables.cache_assets', false); $date = date_create(); @@ -149,8 +126,7 @@ public function thirdPartyJsResponseSetupCacheDisabled(): array return ['lastModified' => date_timestamp_get($date), 'responseHeaders' => $response->headers->all()]; } - /** @test */ - public function styles() + public function test_styles() { $assets = app(RappasoftFrontendAssets::class); @@ -161,8 +137,7 @@ public function styles() $this->assertTrue($assets->hasRenderedRappsoftTableStyles); } - /** @test */ - public function scripts() + public function test_scripts() { $assets = app(RappasoftFrontendAssets::class); @@ -173,8 +148,7 @@ public function scripts() $this->assertTrue($assets->hasRenderedRappsoftTableScripts); } - /** @test */ - public function thirdPartystyles() + public function test_thirdPartystyles() { $assets = app(RappasoftFrontendAssets::class); @@ -185,8 +159,7 @@ public function thirdPartystyles() $this->assertTrue($assets->hasRenderedRappsoftTableThirdPartyStyles); } - /** @test */ - public function thirdPartyscripts() + public function test_thirdPartyscripts() { $assets = app(RappasoftFrontendAssets::class); @@ -197,162 +170,98 @@ public function thirdPartyscripts() $this->assertTrue($assets->hasRenderedRappsoftTableThirdPartyScripts); } - /** - * @test - * - * @depends jsResponseSetupCacheEnabled - */ - public function check_pretend_response_is_js_returns_correct_cache_control_cache_enabled(array $jsResponseSetupCacheEnabled) + #[Depends('test_JsResponseSetupCacheEnabled')] + public function test_check_pretend_response_is_js_returns_correct_cache_control_cache_enabled(array $jsResponseSetupCacheEnabled) { $this->assertSame('max-age=86400, public', $jsResponseSetupCacheEnabled['responseHeaders']['cache-control'][0]); } - /** - * @test - * - * @depends jsResponseSetupCacheEnabled - */ - public function check_pretend_response_is_js_returns_correct_content_type_cache_enabled(array $jsResponseSetupCacheEnabled) + #[Depends('test_JsResponseSetupCacheEnabled')] + public function test_check_pretend_response_is_js_returns_correct_content_type_cache_enabled(array $jsResponseSetupCacheEnabled) { $this->assertSame('application/javascript; charset=utf-8', $jsResponseSetupCacheEnabled['responseHeaders']['content-type'][0]); } - /** - * @test - * - * @depends jsResponseSetupCacheDisabled - */ - public function check_pretend_response_is_js_returns_correct_cache_control_cache_disabled(array $jsResponseSetupCacheDisabled) + #[Depends('test_JsResponseSetupCacheDisabled')] + public function test_check_pretend_response_is_js_returns_correct_cache_control_cache_disabled(array $jsResponseSetupCacheDisabled) { $this->assertSame('max-age=1, public', $jsResponseSetupCacheDisabled['responseHeaders']['cache-control'][0]); } - /** - * @test - * - * @depends jsResponseSetupCacheDisabled - */ - public function check_pretend_response_is_js_returns_correct_content_type_cache_disabled(array $jsResponseSetupCacheDisabled) + #[Depends('test_JsResponseSetupCacheDisabled')] + public function test_check_pretend_response_is_js_returns_correct_content_type_cache_disabled(array $jsResponseSetupCacheDisabled) { $this->assertSame('application/javascript; charset=utf-8', $jsResponseSetupCacheDisabled['responseHeaders']['content-type'][0]); } - /** - * @test - * - * @depends cssResponseSetupCacheEnabled - */ - public function check_pretend_response_is_css_returns_correct_cache_control_caching_enabled(array $cssResponseSetupCacheEnabled) + #[Depends('test_CssResponseSetupCacheEnabled')] + public function test_check_pretend_response_is_css_returns_correct_cache_control_caching_enabled(array $cssResponseSetupCacheEnabled) { $this->assertSame('max-age=86400, public', $cssResponseSetupCacheEnabled['responseHeaders']['cache-control'][0]); } - /** - * @test - * - * @depends cssResponseSetupCacheEnabled - */ - public function check_pretend_response_is_css_returns_correct_content_type_caching_enabled(array $cssResponseSetupCacheEnabled) + #[Depends('test_CssResponseSetupCacheEnabled')] + public function test_check_pretend_response_is_css_returns_correct_content_type_caching_enabled(array $cssResponseSetupCacheEnabled) { $this->assertSame('text/css; charset=utf-8', $cssResponseSetupCacheEnabled['responseHeaders']['content-type'][0]); } - /** - * @test - * - * @depends cssResponseSetupCacheDisabled - */ - public function check_pretend_response_is_css_returns_correct_cache_control_caching_disabled(array $cssResponseSetupCacheDisabled) + #[Depends('test_CssResponseSetupCacheDisabled')] + public function test_check_pretend_response_is_css_returns_correct_cache_control_caching_disabled(array $cssResponseSetupCacheDisabled) { $this->assertSame('max-age=1, public', $cssResponseSetupCacheDisabled['responseHeaders']['cache-control'][0]); } - /** - * @test - * - * @depends cssResponseSetupCacheDisabled - */ - public function check_pretend_response_is_css_returns_correct_content_type_caching_disabled(array $cssResponseSetupCacheDisabled) + #[Depends('test_CssResponseSetupCacheDisabled')] + public function test_check_pretend_response_is_css_returns_correct_content_type_caching_disabled(array $cssResponseSetupCacheDisabled) { $this->assertSame('text/css; charset=utf-8', $cssResponseSetupCacheDisabled['responseHeaders']['content-type'][0]); } - /** - * @test - * - * @depends thirdPartyCssResponseSetupCacheEnabled - */ - public function tp_check_pretend_response_is_css_returns_correct_cache_control_caching_enabled(array $thirdPartyCssResponseSetupCacheEnabled) + #[Depends('test_ThirdPartyCssResponseSetupCacheEnabled')] + public function test_tp_check_pretend_response_is_css_returns_correct_cache_control_caching_enabled(array $thirdPartyCssResponseSetupCacheEnabled) { $this->assertSame('max-age=86400, public', $thirdPartyCssResponseSetupCacheEnabled['responseHeaders']['cache-control'][0]); } - /** - * @test - * - * @depends thirdPartyCssResponseSetupCacheEnabled - */ - public function tp_check_pretend_response_is_css_returns_correct_content_type_caching_enabled(array $thirdPartyCssResponseSetupCacheEnabled) + #[Depends('test_ThirdPartyCssResponseSetupCacheEnabled')] + public function test_tp_check_pretend_response_is_css_returns_correct_content_type_caching_enabled(array $thirdPartyCssResponseSetupCacheEnabled) { $this->assertSame('text/css; charset=utf-8', $thirdPartyCssResponseSetupCacheEnabled['responseHeaders']['content-type'][0]); } - /** - * @test - * - * @depends thirdPartyCssResponseSetupCacheDisabled - */ - public function tp_check_pretend_response_is_css_returns_correct_cache_control_caching_disabled(array $thirdPartyCssResponseSetupCacheDisabled) + #[Depends('test_ThirdPartyCssResponseSetupCacheDisabled')] + public function test_tp_check_pretend_response_is_css_returns_correct_cache_control_caching_disabled(array $thirdPartyCssResponseSetupCacheDisabled) { $this->assertSame('max-age=1, public', $thirdPartyCssResponseSetupCacheDisabled['responseHeaders']['cache-control'][0]); } - /** - * @test - * - * @depends thirdPartyCssResponseSetupCacheDisabled - */ - public function tp_check_pretend_response_is_css_returns_correct_content_type_caching_disabled(array $thirdPartyCssResponseSetupCacheDisabled) + #[Depends('test_ThirdPartyCssResponseSetupCacheDisabled')] + public function test_tp_check_pretend_response_is_css_returns_correct_content_type_caching_disabled(array $thirdPartyCssResponseSetupCacheDisabled) { $this->assertSame('text/css; charset=utf-8', $thirdPartyCssResponseSetupCacheDisabled['responseHeaders']['content-type'][0]); } - /** - * @test - * - * @depends thirdPartyJsResponseSetupCacheEnabled - */ - public function tp_check_pretend_response_is_js_returns_correct_cache_control_cache_enabled(array $thirdPartyJsResponseSetupCacheEnabled) + #[Depends('test_ThirdPartyJsResponseSetupCacheEnabled')] + public function test_tp_check_pretend_response_is_js_returns_correct_cache_control_cache_enabled(array $thirdPartyJsResponseSetupCacheEnabled) { $this->assertSame('max-age=86400, public', $thirdPartyJsResponseSetupCacheEnabled['responseHeaders']['cache-control'][0]); } - /** - * @test - * - * @depends thirdPartyJsResponseSetupCacheEnabled - */ - public function tp_check_pretend_response_is_js_returns_correct_content_type_cache_enabled(array $thirdPartyJsResponseSetupCacheEnabled) + #[Depends('test_ThirdPartyJsResponseSetupCacheEnabled')] + public function test_tp_check_pretend_response_is_js_returns_correct_content_type_cache_enabled(array $thirdPartyJsResponseSetupCacheEnabled) { $this->assertSame('application/javascript; charset=utf-8', $thirdPartyJsResponseSetupCacheEnabled['responseHeaders']['content-type'][0]); } - /** - * @test - * - * @depends thirdPartyJsResponseSetupCacheDisabled - */ - public function tp_check_pretend_response_is_js_returns_correct_cache_control_cache_disabled(array $thirdPartyJsResponseSetupCacheDisabled) + #[Depends('test_ThirdPartyJsResponseSetupCacheDisabled')] + public function test_tp_check_pretend_response_is_js_returns_correct_cache_control_cache_disabled(array $thirdPartyJsResponseSetupCacheDisabled) { $this->assertSame('max-age=1, public', $thirdPartyJsResponseSetupCacheDisabled['responseHeaders']['cache-control'][0]); } - /** - * @test - * - * @depends thirdPartyJsResponseSetupCacheDisabled - */ - public function tp_check_pretend_response_is_js_returns_correct_content_type_cache_disabled(array $thirdPartyJsResponseSetupCacheDisabled) + #[Depends('test_ThirdPartyJsResponseSetupCacheDisabled')] + public function test_tp_check_pretend_response_is_js_returns_correct_content_type_cache_disabled(array $thirdPartyJsResponseSetupCacheDisabled) { $this->assertSame('application/javascript; charset=utf-8', $thirdPartyJsResponseSetupCacheDisabled['responseHeaders']['content-type'][0]); } diff --git a/tests/Traits/Configuration/BulkActionsConfigurationTest.php b/tests/Traits/Configuration/BulkActionsConfigurationTest.php index 488a36fac..b2f24a499 100644 --- a/tests/Traits/Configuration/BulkActionsConfigurationTest.php +++ b/tests/Traits/Configuration/BulkActionsConfigurationTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class BulkActionsConfigurationTest extends TestCase +final class BulkActionsConfigurationTest extends TestCase { - /** @test */ - public function variables_are_correct_types(): void + public function test_variables_are_correct_types(): void { $this->assertIsBool($this->basicTable->bulkActionsStatus); $this->assertIsBool($this->basicTable->selectAll); @@ -16,8 +15,7 @@ public function variables_are_correct_types(): void $this->assertIsArray($this->basicTable->selected); } - /** @test */ - public function can_set_bulk_actions_status(): void + public function test_can_set_bulk_actions_status(): void { $this->assertTrue($this->basicTable->getBulkActionsStatus()); @@ -38,8 +36,7 @@ public function can_set_bulk_actions_status(): void $this->assertTrue($this->basicTable->getBulkActionsStatus()); } - /** @test */ - public function can_set_select_all_status(): void + public function test_can_set_select_all_status(): void { $this->assertFalse($this->basicTable->getSelectAllStatus()); @@ -60,8 +57,7 @@ public function can_set_select_all_status(): void $this->assertFalse($this->basicTable->getSelectAllStatus()); } - /** @test */ - public function can_set_hide_bulk_action_dropdown_status(): void + public function test_can_set_hide_bulk_action_dropdown_status(): void { $this->assertFalse($this->basicTable->getHideBulkActionsWhenEmptyStatus()); @@ -82,8 +78,7 @@ public function can_set_hide_bulk_action_dropdown_status(): void $this->assertFalse($this->basicTable->getHideBulkActionsWhenEmptyStatus()); } - /** @test */ - public function can_set_bulk_actions(): void + public function test_can_set_bulk_actions(): void { $this->assertFalse($this->basicTable->hasBulkActions()); @@ -92,8 +87,7 @@ public function can_set_bulk_actions(): void $this->assertTrue($this->basicTable->hasBulkActions()); } - /** @test */ - public function can_set_bulk_action_confirms(): void + public function test_can_set_bulk_action_confirms(): void { $this->assertSame([], $this->basicTable->getBulkActionConfirms()); @@ -103,8 +97,7 @@ public function can_set_bulk_action_confirms(): void } - /** @test */ - public function can_set_bulk_action_custom_message(): void + public function test_can_set_bulk_action_custom_message(): void { $this->basicTable->setBulkActionConfirms(['deactivate', 'delete']); @@ -118,8 +111,7 @@ public function can_set_bulk_action_custom_message(): void } - /** @test */ - public function can_set_bulk_action_custom_messages(): void + public function test_can_set_bulk_action_custom_messages(): void { $this->basicTable->setBulkActionConfirms(['purge', 'delete', 'reassign', 'deactivate']); @@ -140,8 +132,7 @@ public function can_set_bulk_action_custom_messages(): void $this->assertSame('Are you sure you want to purge these items?', $this->basicTable->getBulkActionConfirmMessage('purge')); } - /** @test */ - public function can_set_bulk_action_default_confirmation_message(): void + public function test_can_set_bulk_action_default_confirmation_message(): void { $this->assertSame('Are you sure?', $this->basicTable->getBulkActionDefaultConfirmationMessage()); @@ -151,8 +142,7 @@ public function can_set_bulk_action_default_confirmation_message(): void } - /** @test */ - public function can_set_bulk_actions_td_attributes(): void + public function test_can_set_bulk_actions_td_attributes(): void { $this->assertSame(['default' => true], $this->basicTable->getBulkActionsTdAttributes()); @@ -165,8 +155,7 @@ public function can_set_bulk_actions_td_attributes(): void $this->assertSame(['default' => false, 'class' => 'bg-blue-500'], $this->basicTable->getBulkActionsTdAttributes()); } - /** @test */ - public function can_set_bulk_actions_td_checkbox_attributes(): void + public function test_can_set_bulk_actions_td_checkbox_attributes(): void { $this->assertSame(['default' => true], $this->basicTable->getBulkActionsTdCheckboxAttributes()); @@ -179,8 +168,7 @@ public function can_set_bulk_actions_td_checkbox_attributes(): void $this->assertSame(['default' => false, 'class' => 'bg-gray-500'], $this->basicTable->getBulkActionsTdCheckboxAttributes()); } - /** @test */ - public function can_set_bulk_actions_th_attributes(): void + public function test_can_set_bulk_actions_th_attributes(): void { $this->assertSame(['default' => true], $this->basicTable->getBulkActionsThAttributes()); @@ -193,8 +181,7 @@ public function can_set_bulk_actions_th_attributes(): void $this->assertSame(['default' => false, 'class' => 'bg-red-500'], $this->basicTable->getBulkActionsThAttributes()); } - /** @test */ - public function can_set_bulk_actions_th_checkbox_attributes(): void + public function test_can_set_bulk_actions_th_checkbox_attributes(): void { $this->assertSame(['default' => true], $this->basicTable->getBulkActionsThCheckboxAttributes()); diff --git a/tests/Traits/Configuration/ColumnSelectConfigurationTest.php b/tests/Traits/Configuration/ColumnSelectConfigurationTest.php index d570995ad..380a6ecc0 100644 --- a/tests/Traits/Configuration/ColumnSelectConfigurationTest.php +++ b/tests/Traits/Configuration/ColumnSelectConfigurationTest.php @@ -2,25 +2,23 @@ namespace Rappasoft\LaravelLivewireTables\Tests\Traits\Configuration; +use PHPUnit\Framework\Attributes\Depends; use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class ColumnSelectConfigurationTest extends TestCase +final class ColumnSelectConfigurationTest extends TestCase { - /** @test */ - public function variables_are_correct_types(): void + public function test_variables_are_correct_types(): void { $this->assertIsArray($this->basicTable->selectedColumns); } - /** @test */ - public function check_protected_fields_columnSelectStatus(): void + public function test_check_protected_fields_columnSelectStatus(): void { $this->expectException(\Livewire\Exceptions\PropertyNotFoundException::class); $this->assertIsBool($this->basicTable->columnSelectStatus); } - /** @test */ - public function can_set_column_select_status(): void + public function test_can_set_column_select_status(): void { $this->assertTrue($this->basicTable->getColumnSelectStatus()); @@ -41,8 +39,7 @@ public function can_set_column_select_status(): void $this->assertTrue($this->basicTable->getColumnSelectStatus()); } - /** @test */ - public function can_set_remember_column_selection_status(): void + public function test_can_set_remember_column_selection_status(): void { $this->assertTrue($this->basicTable->getRememberColumnSelectionStatus()); @@ -63,8 +60,7 @@ public function can_set_remember_column_selection_status(): void $this->assertTrue($this->basicTable->getRememberColumnSelectionStatus()); } - /** @test */ - public function can_deselect_all_columns(): void + public function test_can_deselect_all_columns(): void { $this->assertTrue($this->basicTable->getColumnSelectStatus()); @@ -73,8 +69,7 @@ public function can_deselect_all_columns(): void $this->assertSame([], $this->basicTable->selectedColumns); } - /** @test */ - public function can_exclude_deselected_columns_from_query_enabled(): void + public function test_can_exclude_deselected_columns_from_query_enabled(): void { $this->basicTable->setExcludeDeselectedColumnsFromQueryEnabled(); @@ -90,8 +85,7 @@ public function can_exclude_deselected_columns_from_query_enabled(): void } - /** @test */ - public function can_check_all_columns_get_selected(): void + public function test_can_check_all_columns_get_selected(): void { $this->basicTable->deselectAllColumns(); @@ -105,7 +99,7 @@ public function can_check_all_columns_get_selected(): void } - public function check_get_selected_columns() + public function test_check_get_selected_columns() { $this->basicTable->deselectAllColumns(); diff --git a/tests/Traits/Configuration/ComponentConfigurationTest.php b/tests/Traits/Configuration/ComponentConfigurationTest.php index b5dae8289..001cea2a0 100644 --- a/tests/Traits/Configuration/ComponentConfigurationTest.php +++ b/tests/Traits/Configuration/ComponentConfigurationTest.php @@ -7,10 +7,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; use Rappasoft\LaravelLivewireTables\Views\Column; -class ComponentConfigurationTest extends TestCase +final class ComponentConfigurationTest extends TestCase { - /** @test */ - public function initial_wrapper_attributes_get_set(): void + public function test_initial_wrapper_attributes_get_set(): void { $this->assertSame(['id' => 'datatable-'.$this->basicTable->getId()], $this->basicTable->getComponentWrapperAttributes()); @@ -19,8 +18,7 @@ public function initial_wrapper_attributes_get_set(): void $this->assertSame($this->basicTable->getComponentWrapperAttributes(), ['this' => 'that']); } - /** @test */ - public function can_set_table_wrapper_attributes(): void + public function test_can_set_table_wrapper_attributes(): void { $this->assertSame($this->basicTable->getTableWrapperAttributes(), ['default' => true]); @@ -29,8 +27,7 @@ public function can_set_table_wrapper_attributes(): void $this->assertSame($this->basicTable->getTableWrapperAttributes(), ['this' => 'that']); } - /** @test */ - public function can_set_table_attributes(): void + public function test_can_set_table_attributes(): void { $this->assertSame($this->basicTable->getTableAttributes(), ['id' => 'table-'.$this->basicTable->getTableName(), 'default' => true]); @@ -39,8 +36,7 @@ public function can_set_table_attributes(): void $this->assertSame($this->basicTable->getTableAttributes(), ['id' => 'table-'.$this->basicTable->getTableName(), 'this' => 'that']); } - /** @test */ - public function can_override_table_default_id(): void + public function test_can_override_table_default_id(): void { $this->assertSame($this->basicTable->getTableAttributes(), ['id' => 'table-'.$this->basicTable->getTableName(), 'default' => true]); @@ -49,8 +45,7 @@ public function can_override_table_default_id(): void $this->assertSame($this->basicTable->getTableAttributes(), ['id' => 'newTableID', 'this' => 'that']); } - /** @test */ - public function can_set_thead_attributes(): void + public function test_can_set_thead_attributes(): void { $this->assertSame($this->basicTable->getTheadAttributes(), ['default' => true]); @@ -59,8 +54,7 @@ public function can_set_thead_attributes(): void $this->assertSame($this->basicTable->getTheadAttributes(), ['this' => 'that']); } - /** @test */ - public function can_set_tbody_attributes(): void + public function test_can_set_tbody_attributes(): void { $this->assertSame($this->basicTable->getTbodyAttributes(), ['default' => true]); @@ -69,8 +63,7 @@ public function can_set_tbody_attributes(): void $this->assertSame($this->basicTable->getTbodyAttributes(), ['this' => 'that']); } - /** @test */ - public function can_set_th_attributes(): void + public function test_can_set_th_attributes(): void { $this->basicTable->setThAttributes(function (Column $column) { if ($column->isField('id')) { @@ -84,8 +77,7 @@ public function can_set_th_attributes(): void $this->assertSame($this->basicTable->getThAttributes($this->basicTable->columns()[1]), ['default' => true, 'here' => 'there']); } - /** @test */ - public function can_set_th_sort_button_attributes(): void + public function test_can_set_th_sort_button_attributes(): void { $this->basicTable->setThSortButtonAttributes(function (Column $column) { if ($column->isField('id')) { @@ -99,8 +91,7 @@ public function can_set_th_sort_button_attributes(): void $this->assertSame($this->basicTable->getThSortButtonAttributes($this->basicTable->columns()[1]), ['default' => true, 'here' => 'there']); } - /** @test */ - public function can_set_tr_attributes(): void + public function test_can_set_tr_attributes(): void { $this->basicTable->setTrAttributes(function (Model $row, $index) { if ($index === 0) { @@ -114,8 +105,7 @@ public function can_set_tr_attributes(): void $this->assertSame($this->basicTable->getTrAttributes(Pet::find(2), 1), ['default' => true, 'here' => 'there']); } - /** @test */ - public function can_set_td_attributes(): void + public function test_can_set_td_attributes(): void { $this->basicTable->setTdAttributes(function (Column $column, Model $row, $index) { if ($column->isField('id') && $index === 1) { @@ -129,16 +119,14 @@ public function can_set_td_attributes(): void $this->assertSame($this->basicTable->getTdAttributes($this->basicTable->columns()[0], Pet::find(2), 1, 1), ['default' => false, 'this' => 'that']); } - /** @test */ - public function can_set_empty_message(): void + public function test_can_set_empty_message(): void { $this->basicTable->setEmptyMessage('My empty message'); $this->assertEquals('My empty message', $this->basicTable->getEmptyMessage()); } - /** @test */ - public function can_set_offline_indicator_status(): void + public function test_can_set_offline_indicator_status(): void { $this->assertTrue($this->basicTable->getOfflineIndicatorStatus()); @@ -159,8 +147,7 @@ public function can_set_offline_indicator_status(): void $this->basicTable->setOfflineIndicatorStatus(true); } - /** @test */ - public function can_set_default_sorting_labels(): void + public function test_can_set_default_sorting_labels(): void { $this->assertSame('A-Z', $this->basicTable->getDefaultSortingLabelAsc()); $this->assertSame('Z-A', $this->basicTable->getDefaultSortingLabelDesc()); @@ -171,8 +158,7 @@ public function can_set_default_sorting_labels(): void $this->assertSame('2-1', $this->basicTable->getDefaultSortingLabelDesc()); } - /** @test */ - public function can_set_query_string_status(): void + public function test_can_set_query_string_status(): void { $this->assertTrue($this->basicTable->getQueryStringStatus()); @@ -193,8 +179,7 @@ public function can_set_query_string_status(): void $this->assertTrue($this->basicTable->getQueryStringStatus()); } - /** @test */ - public function can_set_eager_load_relations_status(): void + public function test_can_set_eager_load_relations_status(): void { $this->assertFalse($this->basicTable->getEagerLoadAllRelationsStatus()); @@ -215,8 +200,7 @@ public function can_set_eager_load_relations_status(): void $this->assertFalse($this->basicTable->getEagerLoadAllRelationsStatus()); } - /** @test */ - public function can_set_collapsing_columns_status(): void + public function test_can_set_collapsing_columns_status(): void { $this->assertTrue($this->basicTable->getCollapsingColumnsStatus()); @@ -237,8 +221,7 @@ public function can_set_collapsing_columns_status(): void $this->assertTrue($this->basicTable->getCollapsingColumnsStatus()); } - /** @test */ - public function can_set_tr_url(): void + public function test_can_set_tr_url(): void { $this->assertNull($this->basicTable->getTableRowUrl(1)); @@ -249,8 +232,7 @@ public function can_set_tr_url(): void $this->assertSame($this->basicTable->getTableRowUrl(1), 'https://example.com'); } - /** @test */ - public function can_set_tr_url_advanced(): void + public function test_can_set_tr_url_advanced(): void { $this->assertNull($this->basicTable->getTableRowUrl(1)); $this->assertNull($this->basicTable->getTableRowUrl(2)); @@ -269,8 +251,7 @@ public function can_set_tr_url_advanced(): void } - /** @test */ - public function can_set_tr_url_target(): void + public function test_can_set_tr_url_target(): void { $this->assertNull($this->basicTable->getTableRowUrlTarget(1)); @@ -282,8 +263,7 @@ public function can_set_tr_url_target(): void } - /** @test */ - public function can_set_tr_url_target_advanced(): void + public function test_can_set_tr_url_target_advanced(): void { $this->assertNull($this->basicTable->getTableRowUrl(1)); $this->assertNull($this->basicTable->getTableRowUrl(2)); @@ -300,8 +280,7 @@ public function can_set_tr_url_target_advanced(): void $this->assertSame($this->basicTable->getTableRowUrlTarget(2), 'navigate'); } - /** @test */ - public function can_set_hide_configurable_areas_when_reordering_status(): void + public function test_can_set_hide_configurable_areas_when_reordering_status(): void { $this->assertTrue($this->basicTable->getHideConfigurableAreasWhenReorderingStatus()); diff --git a/tests/Traits/Configuration/CustomisationsConfigurationTest.php b/tests/Traits/Configuration/CustomisationsConfigurationTest.php index 35b9f69d1..3ea6350c2 100644 --- a/tests/Traits/Configuration/CustomisationsConfigurationTest.php +++ b/tests/Traits/Configuration/CustomisationsConfigurationTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class CustomisationsConfigurationTest extends TestCase +final class CustomisationsConfigurationTest extends TestCase { - /** @test */ - public function can_set_extends(): void + public function test_can_set_extends(): void { $this->assertFalse($this->basicTable->hasExtends()); $this->assertNull($this->basicTable->getExtends()); @@ -16,8 +15,7 @@ public function can_set_extends(): void $this->assertEquals('app.layout', $this->basicTable->getExtends()); } - /** @test */ - public function can_set_layout(): void + public function test_can_set_layout(): void { $this->assertFalse($this->basicTable->hasLayout()); $this->assertNull($this->basicTable->getLayout()); @@ -26,8 +24,7 @@ public function can_set_layout(): void $this->assertEquals('app.layout', $this->basicTable->getLayout()); } - /** @test */ - public function can_set_section(): void + public function test_can_set_section(): void { $this->assertNull($this->basicTable->getSection()); $this->assertFalse($this->basicTable->hasSection()); @@ -36,8 +33,7 @@ public function can_set_section(): void $this->assertEquals('content', $this->basicTable->getSection()); } - /** @test */ - public function can_set_slot(): void + public function test_can_set_slot(): void { $this->assertFalse($this->basicTable->hasSlot()); $this->assertNull($this->basicTable->getSlot()); diff --git a/tests/Traits/Configuration/DebuggingConfigurationTest.php b/tests/Traits/Configuration/DebuggingConfigurationTest.php index 669efdb3d..9e30f41cb 100644 --- a/tests/Traits/Configuration/DebuggingConfigurationTest.php +++ b/tests/Traits/Configuration/DebuggingConfigurationTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class DebuggingConfigurationTest extends TestCase +final class DebuggingConfigurationTest extends TestCase { - /** @test */ - public function debug_status_can_be_set(): void + public function test_debug_status_can_be_set(): void { $this->assertFalse($this->basicTable->getDebugStatus()); diff --git a/tests/Traits/Configuration/FilterConfigurationTest.php b/tests/Traits/Configuration/FilterConfigurationTest.php index 47431c5e0..02ee86828 100644 --- a/tests/Traits/Configuration/FilterConfigurationTest.php +++ b/tests/Traits/Configuration/FilterConfigurationTest.php @@ -5,10 +5,9 @@ use Rappasoft\LaravelLivewireTables\Exceptions\DataTableConfigurationException; use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class FilterConfigurationTest extends TestCase +final class FilterConfigurationTest extends TestCase { - /** @test */ - public function filters_status_can_be_set(): void + public function test_filters_status_can_be_set(): void { $this->assertTrue($this->basicTable->getFiltersStatus()); @@ -29,8 +28,7 @@ public function filters_status_can_be_set(): void $this->assertTrue($this->basicTable->getFiltersStatus()); } - /** @test */ - public function filters_visibility_status_can_be_set(): void + public function test_filters_visibility_status_can_be_set(): void { $this->assertTrue($this->basicTable->getFiltersVisibilityStatus()); @@ -51,8 +49,7 @@ public function filters_visibility_status_can_be_set(): void $this->assertTrue($this->basicTable->getFiltersVisibilityStatus()); } - /** @test */ - public function filters_pills_status_can_be_set(): void + public function test_filters_pills_status_can_be_set(): void { $this->assertTrue($this->basicTable->getFilterPillsStatus()); @@ -73,8 +70,7 @@ public function filters_pills_status_can_be_set(): void $this->assertTrue($this->basicTable->getFilterPillsStatus()); } - /** @test */ - public function filters_layout_can_be_set(): void + public function test_filters_layout_can_be_set(): void { $this->expectException(DataTableConfigurationException::class); @@ -101,8 +97,7 @@ public function filters_layout_can_be_set(): void $this->basicTable->setFilterLayout('popover'); } - /** @test */ - public function filters_layout_popover_default_can_be_set(): void + public function test_filters_layout_popover_default_can_be_set(): void { $this->assertFalse($this->basicTable->filterSlideDownDefaultVisible); diff --git a/tests/Traits/Configuration/FingerprintConfigurationTest.php b/tests/Traits/Configuration/FingerprintConfigurationTest.php index 33a84ceb0..3387e0580 100644 --- a/tests/Traits/Configuration/FingerprintConfigurationTest.php +++ b/tests/Traits/Configuration/FingerprintConfigurationTest.php @@ -5,16 +5,14 @@ use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\PetsTable; use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class FingerprintConfigurationTest extends TestCase +final class FingerprintConfigurationTest extends TestCase { - /** @test */ - public function can_set_fingerprint(): void + public function test_can_set_fingerprint(): void { $this->assertSame('test', $this->basicTable->setDataTableFingerprint('test')->getDataTableFingerprint()); } - /** @test */ - public function can_set_fingerprint_in_configure_method(): void + public function test_can_set_fingerprint_in_configure_method(): void { $mock = new class extends PetsTable { diff --git a/tests/Traits/Configuration/FooterConfigurationTest.php b/tests/Traits/Configuration/FooterConfigurationTest.php index eb760df7e..eadc0bd3e 100644 --- a/tests/Traits/Configuration/FooterConfigurationTest.php +++ b/tests/Traits/Configuration/FooterConfigurationTest.php @@ -5,10 +5,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; use Rappasoft\LaravelLivewireTables\Views\Column; -class FooterConfigurationTest extends TestCase +final class FooterConfigurationTest extends TestCase { - /** @test */ - public function can_set_footer_status(): void + public function test_can_set_footer_status(): void { $this->assertTrue($this->basicTable->getFooterStatus()); @@ -29,8 +28,7 @@ public function can_set_footer_status(): void $this->assertTrue($this->basicTable->getFooterStatus()); } - /** @test */ - public function can_set_use_header_as_footer_status(): void + public function test_can_set_use_header_as_footer_status(): void { $this->assertFalse($this->basicTable->getUseHeaderAsFooterStatus()); @@ -51,8 +49,7 @@ public function can_set_use_header_as_footer_status(): void $this->assertFalse($this->basicTable->getUseHeaderAsFooterStatus()); } - /** @test */ - public function can_set_secondary_footer_tr_attributes(): void + public function test_can_set_secondary_footer_tr_attributes(): void { $this->basicTable->setFooterTrAttributes(function ($rows) { return ['default' => true, 'here' => 'there']; @@ -61,8 +58,7 @@ public function can_set_secondary_footer_tr_attributes(): void $this->assertSame($this->basicTable->getFooterTrAttributes([]), ['default' => true, 'here' => 'there']); } - /** @test */ - public function can_set_footer_td_attributes(): void + public function test_can_set_footer_td_attributes(): void { $this->basicTable->setFooterTdAttributes(function (Column $column, $rows) { return ['default' => true, 'here' => 'there']; diff --git a/tests/Traits/Configuration/LoadingPlaceholderConfigurationTest.php b/tests/Traits/Configuration/LoadingPlaceholderConfigurationTest.php index e5b033f99..1206f1608 100644 --- a/tests/Traits/Configuration/LoadingPlaceholderConfigurationTest.php +++ b/tests/Traits/Configuration/LoadingPlaceholderConfigurationTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class LoadingPlaceholderConfigurationTest extends TestCase +final class LoadingPlaceholderConfigurationTest extends TestCase { - /** @test */ - public function can_set_loading_placeholder_status_enabled(): void + public function test_can_set_loading_placeholder_status_enabled(): void { $this->assertFalse($this->basicTable->hasDisplayLoadingPlaceholder()); @@ -17,8 +16,7 @@ public function can_set_loading_placeholder_status_enabled(): void } - /** @test */ - public function can_set_loading_placeholder_status_disabled(): void + public function test_can_set_loading_placeholder_status_disabled(): void { $this->assertFalse($this->basicTable->hasDisplayLoadingPlaceholder()); @@ -32,8 +30,7 @@ public function can_set_loading_placeholder_status_disabled(): void } - /** @test */ - public function can_set_loading_placeholder_content(): void + public function test_can_set_loading_placeholder_content(): void { $this->basicTable->setLoadingPlaceholderEnabled(); @@ -47,8 +44,7 @@ public function can_set_loading_placeholder_content(): void } - /** @test */ - public function can_set_loading_placeholder_attributes(): void + public function test_can_set_loading_placeholder_attributes(): void { $this->basicTable->setLoadingPlaceholderEnabled(); @@ -60,8 +56,7 @@ public function can_set_loading_placeholder_attributes(): void } - /** @test */ - public function can_set_loading_placeholder_icon_attributes(): void + public function test_can_set_loading_placeholder_icon_attributes(): void { $this->basicTable->setLoadingPlaceholderEnabled(); @@ -73,8 +68,7 @@ public function can_set_loading_placeholder_icon_attributes(): void } - /** @test */ - public function can_set_loading_placeholder_wrapper_attributes(): void + public function test_can_set_loading_placeholder_wrapper_attributes(): void { $this->basicTable->setLoadingPlaceholderEnabled(); @@ -85,8 +79,7 @@ public function can_set_loading_placeholder_wrapper_attributes(): void $this->assertSame(['class' => 'test1234567-wrapper'], $this->basicTable->getLoadingPlaceHolderWrapperAttributes()); } - /** @test */ - public function can_set_loading_placeholder_custom_blade(): void + public function test_can_set_loading_placeholder_custom_blade(): void { $this->basicTable->setLoadingPlaceholderEnabled(); diff --git a/tests/Traits/Configuration/PaginationConfigurationTest.php b/tests/Traits/Configuration/PaginationConfigurationTest.php index a19c3887a..168d07619 100644 --- a/tests/Traits/Configuration/PaginationConfigurationTest.php +++ b/tests/Traits/Configuration/PaginationConfigurationTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class PaginationConfigurationTest extends TestCase +final class PaginationConfigurationTest extends TestCase { - /** @test */ - public function pagination_theme_can_be_set(): void + public function test_pagination_theme_can_be_set(): void { $this->assertSame('tailwind', $this->basicTable->getPaginationTheme()); @@ -16,8 +15,7 @@ public function pagination_theme_can_be_set(): void $this->assertSame('bootstrap', $this->basicTable->getPaginationTheme()); } - /** @test */ - public function can_set_pagination_status(): void + public function test_can_set_pagination_status(): void { $this->assertTrue($this->basicTable->getPaginationStatus()); @@ -38,8 +36,7 @@ public function can_set_pagination_status(): void $this->assertTrue($this->basicTable->getPaginationStatus()); } - /** @test */ - public function can_set_pagination_visibility_status(): void + public function test_can_set_pagination_visibility_status(): void { $this->assertTrue($this->basicTable->getPaginationVisibilityStatus()); @@ -60,8 +57,7 @@ public function can_set_pagination_visibility_status(): void $this->assertTrue($this->basicTable->getPaginationVisibilityStatus()); } - /** @test */ - public function can_set_per_page_visibility_status(): void + public function test_can_set_per_page_visibility_status(): void { $this->assertTrue($this->basicTable->getPerPageVisibilityStatus()); @@ -82,8 +78,7 @@ public function can_set_per_page_visibility_status(): void $this->assertTrue($this->basicTable->getPerPageVisibilityStatus()); } - /** @test */ - public function can_set_per_page_selection(): void + public function test_can_set_per_page_selection(): void { $this->assertSame(10, $this->basicTable->getPerPage()); @@ -92,8 +87,7 @@ public function can_set_per_page_selection(): void $this->assertSame(25, $this->basicTable->getPerPage()); } - /** @test */ - public function can_set_per_page_accepted_values(): void + public function test_can_set_per_page_accepted_values(): void { $this->assertSame([10, 25, 50], $this->basicTable->getPerPageAccepted()); @@ -102,8 +96,7 @@ public function can_set_per_page_accepted_values(): void $this->assertSame([10, 25, 50, -1], $this->basicTable->getPerPageAccepted()); } - /** @test */ - public function can_set_per_page_manually(): void + public function test_can_set_per_page_manually(): void { $this->assertSame(10, $this->basicTable->getPerPage()); @@ -112,8 +105,7 @@ public function can_set_per_page_manually(): void $this->assertSame(25, $this->basicTable->getPerPage()); } - /** @test */ - public function can_set_default_per_page(): void + public function test_can_set_default_per_page(): void { $this->assertSame(10, $this->unpaginatedTable->getPerPage()); $this->unpaginatedTable->setDefaultPerPage(50); diff --git a/tests/Traits/Configuration/QueryStringAliasConfigurationTest.php b/tests/Traits/Configuration/QueryStringAliasConfigurationTest.php index 1f80c0c31..1053f42b1 100644 --- a/tests/Traits/Configuration/QueryStringAliasConfigurationTest.php +++ b/tests/Traits/Configuration/QueryStringAliasConfigurationTest.php @@ -5,16 +5,14 @@ use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\PetsTable; use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class QueryStringAliasConfigurationTest extends TestCase +final class QueryStringAliasConfigurationTest extends TestCase { - /** @test */ - public function can_set_query_string_alias(): void + public function test_can_set_query_string_alias(): void { $this->assertSame('test', $this->basicTable->setQueryStringAlias('test')->getQueryStringAlias()); } - /** @test */ - public function can_set_query_string_in_configure_method(): void + public function test_can_set_query_string_in_configure_method(): void { $mock = new class extends PetsTable { diff --git a/tests/Traits/Configuration/RefreshConfigurationTest.php b/tests/Traits/Configuration/RefreshConfigurationTest.php index 4187f8747..4aec6fb3d 100644 --- a/tests/Traits/Configuration/RefreshConfigurationTest.php +++ b/tests/Traits/Configuration/RefreshConfigurationTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class RefreshConfigurationTest extends TestCase +final class RefreshConfigurationTest extends TestCase { - /** @test */ - public function refresh_time_can_be_set(): void + public function test_refresh_time_can_be_set(): void { $this->assertFalse($this->basicTable->getRefreshStatus()); @@ -16,8 +15,7 @@ public function refresh_time_can_be_set(): void $this->assertSame('5000', $this->basicTable->getRefreshStatus()); } - /** @test */ - public function refresh_keep_alive_can_be_set(): void + public function test_refresh_keep_alive_can_be_set(): void { $this->assertFalse($this->basicTable->getRefreshStatus()); @@ -26,8 +24,7 @@ public function refresh_keep_alive_can_be_set(): void $this->assertSame('keep-alive', $this->basicTable->getRefreshStatus()); } - /** @test */ - public function refresh_visible_can_be_set(): void + public function test_refresh_visible_can_be_set(): void { $this->assertFalse($this->basicTable->getRefreshStatus()); @@ -36,8 +33,7 @@ public function refresh_visible_can_be_set(): void $this->assertSame('visible', $this->basicTable->getRefreshStatus()); } - /** @test */ - public function refresh_method_can_be_set(): void + public function test_refresh_method_can_be_set(): void { $this->assertFalse($this->basicTable->getRefreshStatus()); diff --git a/tests/Traits/Configuration/ReorderingConfigurationTest.php b/tests/Traits/Configuration/ReorderingConfigurationTest.php index 78af33f91..848e4945a 100644 --- a/tests/Traits/Configuration/ReorderingConfigurationTest.php +++ b/tests/Traits/Configuration/ReorderingConfigurationTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class ReorderingConfigurationTest extends TestCase +final class ReorderingConfigurationTest extends TestCase { - /** @test */ - public function can_set_reorder_status(): void + public function test_can_set_reorder_status(): void { $this->assertFalse($this->basicTable->getReorderStatus()); @@ -28,8 +27,7 @@ public function can_set_reorder_status(): void $this->assertFalse($this->basicTable->getReorderStatus()); } - /** @test */ - public function can_set_currently_reordering_status(): void + public function test_can_set_currently_reordering_status(): void { $this->assertFalse($this->basicTable->getCurrentlyReorderingStatus()); @@ -50,8 +48,7 @@ public function can_set_currently_reordering_status(): void $this->assertFalse($this->basicTable->getCurrentlyReorderingStatus()); } - /** @test */ - public function can_set_hide_reorder_column_unless_reordering_status(): void + public function test_can_set_hide_reorder_column_unless_reordering_status(): void { $this->assertFalse($this->basicTable->getHideReorderColumnUnlessReorderingStatus()); @@ -72,8 +69,7 @@ public function can_set_hide_reorder_column_unless_reordering_status(): void $this->assertFalse($this->basicTable->getHideReorderColumnUnlessReorderingStatus()); } - /** @test */ - public function can_set_reorder_method(): void + public function test_can_set_reorder_method(): void { $this->assertSame('reorder', $this->basicTable->getReorderMethod()); @@ -82,8 +78,7 @@ public function can_set_reorder_method(): void $this->assertSame('reorderMe', $this->basicTable->getReorderMethod()); } - /** @test */ - public function can_set_default_reorder_column_and_direction(): void + public function test_can_set_default_reorder_column_and_direction(): void { $this->assertSame('sort', $this->basicTable->getDefaultReorderColumn()); $this->assertSame('asc', $this->basicTable->getDefaultReorderDirection()); diff --git a/tests/Traits/Configuration/SearchConfigurationTest.php b/tests/Traits/Configuration/SearchConfigurationTest.php index e79bf0fd2..b89461e15 100644 --- a/tests/Traits/Configuration/SearchConfigurationTest.php +++ b/tests/Traits/Configuration/SearchConfigurationTest.php @@ -5,10 +5,9 @@ use Rappasoft\LaravelLivewireTables\Exceptions\DataTableConfigurationException; use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class SearchConfigurationTest extends TestCase +final class SearchConfigurationTest extends TestCase { - /** @test */ - public function can_set_default_search_term(): void + public function test_can_set_default_search_term(): void { $this->assertSame('', $this->basicTable->getSearch()); @@ -17,8 +16,7 @@ public function can_set_default_search_term(): void $this->assertSame('Anthony', $this->basicTable->getSearch()); } - /** @test */ - public function can_set_search_status_status(): void + public function test_can_set_search_status_status(): void { $this->assertTrue($this->basicTable->getSearchStatus()); @@ -39,8 +37,7 @@ public function can_set_search_status_status(): void $this->assertTrue($this->basicTable->getSearchStatus()); } - /** @test */ - public function can_set_search_visibility_status_status(): void + public function test_can_set_search_visibility_status_status(): void { $this->assertTrue($this->basicTable->getSearchVisibilityStatus()); @@ -61,8 +58,7 @@ public function can_set_search_visibility_status_status(): void $this->assertTrue($this->basicTable->getSearchVisibilityStatus()); } - /** @test */ - public function can_set_search_debounce(): void + public function test_can_set_search_debounce(): void { $this->assertFalse($this->basicTable->hasSearchDebounce()); @@ -73,8 +69,7 @@ public function can_set_search_debounce(): void $this->assertSame('.live.debounce.1000ms', $this->basicTable->getSearchOptions()); } - /** @test */ - public function cant_set_search_debounce_with_other_search_modifiers(): void + public function test_cant_set_search_debounce_with_other_search_modifiers(): void { $this->expectException(DataTableConfigurationException::class); @@ -82,8 +77,7 @@ public function cant_set_search_debounce_with_other_search_modifiers(): void $this->basicTable->setSearchDefer(); } - /** @test */ - public function can_set_search_defer(): void + public function test_can_set_search_defer(): void { $this->assertFalse($this->basicTable->hasSearchDefer()); @@ -93,8 +87,7 @@ public function can_set_search_defer(): void $this->assertSame('', $this->basicTable->getSearchOptions()); } - /** @test */ - public function cant_set_search_defer_with_other_search_modifiers(): void + public function test_cant_set_search_defer_with_other_search_modifiers(): void { $this->expectException(DataTableConfigurationException::class); @@ -102,8 +95,7 @@ public function cant_set_search_defer_with_other_search_modifiers(): void $this->basicTable->setSearchDebounce(1000); } - /** @test */ - /*public function can_set_search_lazy(): void + /*public function test_can_set_search_lazy(): void { $this->assertFalse($this->basicTable->hasSearchLazy()); @@ -113,8 +105,7 @@ public function cant_set_search_defer_with_other_search_modifiers(): void $this->assertSame('.lazy', $this->basicTable->getSearchOptions()); }*/ - /** @test */ - /*public function cant_set_search_lazy_with_other_search_modifiers(): void + /*public function test_cant_set_search_lazy_with_other_search_modifiers(): void { $this->expectException(DataTableConfigurationException::class); @@ -122,8 +113,7 @@ public function cant_set_search_defer_with_other_search_modifiers(): void $this->basicTable->setSearchDebounce(1000); }*/ - /** @test */ - public function can_set_search_live(): void + public function test_can_set_search_live(): void { $this->assertFalse($this->basicTable->hasSearchLive()); @@ -133,8 +123,7 @@ public function can_set_search_live(): void $this->assertSame('.live', $this->basicTable->getSearchOptions()); } - /** @test */ - public function cant_set_search_live_with_other_search_modifiers(): void + public function test_cant_set_search_live_with_other_search_modifiers(): void { $this->expectException(DataTableConfigurationException::class); @@ -142,8 +131,7 @@ public function cant_set_search_live_with_other_search_modifiers(): void $this->basicTable->setSearchDebounce(1000); } - /** @test */ - public function can_set_search_blur(): void + public function test_can_set_search_blur(): void { $this->assertFalse($this->basicTable->hasSearchBlur()); @@ -153,8 +141,7 @@ public function can_set_search_blur(): void $this->assertSame('.blur', $this->basicTable->getSearchOptions()); } - /** @test */ - public function cant_set_search_blur_with_other_search_modifiers(): void + public function test_cant_set_search_blur_with_other_search_modifiers(): void { $this->expectException(DataTableConfigurationException::class); @@ -162,8 +149,7 @@ public function cant_set_search_blur_with_other_search_modifiers(): void $this->basicTable->setSearchDefer(); } - /** @test */ - public function can_set_search_throttle(): void + public function test_can_set_search_throttle(): void { $this->assertFalse($this->basicTable->hasSearchThrottle()); @@ -174,8 +160,7 @@ public function can_set_search_throttle(): void $this->assertSame('.live.throttle.1000ms', $this->basicTable->getSearchOptions()); } - /** @test */ - public function cant_set_search_throttle_with_other_search_modifiers(): void + public function test_cant_set_search_throttle_with_other_search_modifiers(): void { $this->expectException(DataTableConfigurationException::class); @@ -183,8 +168,7 @@ public function cant_set_search_throttle_with_other_search_modifiers(): void $this->basicTable->setSearchDefer(); } - /** @test */ - public function can_set_search_placeholder(): void + public function test_can_set_search_placeholder(): void { $this->assertSame(__('Search'), $this->basicTable->getSearchPlaceholder()); @@ -194,8 +178,7 @@ public function can_set_search_placeholder(): void } - /** @test */ - public function can_set_search_field_attributes(): void + public function test_can_set_search_field_attributes(): void { $this->assertSame(['default' => true], $this->basicTable->getSearchFieldAttributes()); diff --git a/tests/Traits/Configuration/SecondaryHeaderConfigurationTest.php b/tests/Traits/Configuration/SecondaryHeaderConfigurationTest.php index e069314ac..fc34b8878 100644 --- a/tests/Traits/Configuration/SecondaryHeaderConfigurationTest.php +++ b/tests/Traits/Configuration/SecondaryHeaderConfigurationTest.php @@ -5,10 +5,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; use Rappasoft\LaravelLivewireTables\Views\Column; -class SecondaryHeaderConfigurationTest extends TestCase +final class SecondaryHeaderConfigurationTest extends TestCase { - /** @test */ - public function can_set_secondary_header_status(): void + public function test_can_set_secondary_header_status(): void { $this->assertTrue($this->basicTable->getSecondaryHeaderStatus()); @@ -29,8 +28,7 @@ public function can_set_secondary_header_status(): void $this->assertTrue($this->basicTable->getSecondaryHeaderStatus()); } - /** @test */ - public function can_set_secondary_header_tr_attributes(): void + public function test_can_set_secondary_header_tr_attributes(): void { $this->basicTable->setSecondaryHeaderTrAttributes(function ($rows) { return ['default' => true, 'here' => 'there']; @@ -39,8 +37,7 @@ public function can_set_secondary_header_tr_attributes(): void $this->assertSame($this->basicTable->getSecondaryHeaderTrAttributes([]), ['default' => true, 'here' => 'there']); } - /** @test */ - public function can_set_secondary_header_td_attributes(): void + public function test_can_set_secondary_header_td_attributes(): void { $this->basicTable->setSecondaryHeaderTdAttributes(function (Column $column, $rows) { return ['default' => true, 'here' => 'there']; diff --git a/tests/Traits/Configuration/SortingConfigurationTest.php b/tests/Traits/Configuration/SortingConfigurationTest.php index afbeffc83..b83b19d2f 100644 --- a/tests/Traits/Configuration/SortingConfigurationTest.php +++ b/tests/Traits/Configuration/SortingConfigurationTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class SortingConfigurationTest extends TestCase +final class SortingConfigurationTest extends TestCase { - /** @test */ - public function can_set_sorting_status(): void + public function test_can_set_sorting_status(): void { $this->assertTrue($this->basicTable->getSortingStatus()); @@ -28,8 +27,7 @@ public function can_set_sorting_status(): void $this->assertTrue($this->basicTable->getSortingStatus()); } - /** @test */ - public function can_set_single_sorting_status(): void + public function test_can_set_single_sorting_status(): void { $this->assertTrue($this->basicTable->getSingleSortingStatus()); @@ -50,8 +48,7 @@ public function can_set_single_sorting_status(): void $this->assertTrue($this->basicTable->getSingleSortingStatus()); } - /** @test */ - public function can_set_default_sort(): void + public function test_can_set_default_sort(): void { $this->assertNull($this->basicTable->getDefaultSortColumn()); $this->assertSame('asc', $this->basicTable->getDefaultSortDirection()); @@ -62,8 +59,7 @@ public function can_set_default_sort(): void $this->assertSame('desc', $this->basicTable->getDefaultSortDirection()); } - /** @test */ - public function can_remove_default_sort(): void + public function test_can_remove_default_sort(): void { $this->basicTable->setDefaultSort('id', 'desc'); @@ -76,8 +72,7 @@ public function can_remove_default_sort(): void $this->assertSame('asc', $this->basicTable->getDefaultSortDirection()); } - /** @test */ - public function can_set_sorting_pill_status(): void + public function test_can_set_sorting_pill_status(): void { $this->assertTrue($this->basicTable->getSortingPillsStatus()); diff --git a/tests/Traits/Helpers/BulkActionsHelpersTest.php b/tests/Traits/Helpers/BulkActionsHelpersTest.php index 237ad441d..bf4cc9e6e 100644 --- a/tests/Traits/Helpers/BulkActionsHelpersTest.php +++ b/tests/Traits/Helpers/BulkActionsHelpersTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class BulkActionsHelpersTest extends TestCase +final class BulkActionsHelpersTest extends TestCase { - /** @test */ - public function can_get_bulk_actions_status(): void + public function test_can_get_bulk_actions_status(): void { $this->assertTrue($this->basicTable->bulkActionsAreEnabled()); @@ -20,8 +19,7 @@ public function can_get_bulk_actions_status(): void $this->assertTrue($this->basicTable->bulkActionsAreEnabled()); } - /** @test */ - public function can_get_select_all_status(): void + public function test_can_get_select_all_status(): void { $this->assertTrue($this->basicTable->selectAllIsDisabled()); @@ -34,8 +32,7 @@ public function can_get_select_all_status(): void $this->assertTrue($this->basicTable->selectAllIsDisabled()); } - /** @test */ - public function can_get_hide_bulk_actions_on_empty_status(): void + public function test_can_get_hide_bulk_actions_on_empty_status(): void { $this->assertTrue($this->basicTable->hideBulkActionsWhenEmptyIsDisabled()); @@ -48,8 +45,7 @@ public function can_get_hide_bulk_actions_on_empty_status(): void $this->assertTrue($this->basicTable->hideBulkActionsWhenEmptyIsDisabled()); } - /** @test */ - public function can_get_bulk_actions_array(): void + public function test_can_get_bulk_actions_array(): void { $this->assertSame([], $this->basicTable->getBulkActions()); @@ -58,8 +54,7 @@ public function can_get_bulk_actions_array(): void $this->assertSame(['activate' => 'Activate'], $this->basicTable->getBulkActions()); } - /** @test */ - public function can_get_bulk_actions_array_direct(): void + public function test_can_get_bulk_actions_array_direct(): void { $this->assertSame([], $this->basicTable->bulkActions()); @@ -68,8 +63,7 @@ public function can_get_bulk_actions_array_direct(): void $this->assertSame(['activate' => 'Activate'], $this->basicTable->bulkActions()); } - /** @test */ - public function can_check_if_bulk_actions_dropdown_should_bw_shown(): void + public function test_can_check_if_bulk_actions_dropdown_should_bw_shown(): void { $this->basicTable->setBulkActionsDisabled(); @@ -96,8 +90,7 @@ public function can_check_if_bulk_actions_dropdown_should_bw_shown(): void $this->assertTrue($this->basicTable->showBulkActionsDropdown()); } - /** @test */ - public function can_set_selected_bulk_items(): void + public function test_can_set_selected_bulk_items(): void { $this->assertSame([], $this->basicTable->getSelected()); @@ -106,8 +99,7 @@ public function can_set_selected_bulk_items(): void $this->assertSame([1, 2, 3], $this->basicTable->getSelected()); } - /** @test */ - public function can_check_if_there_are_selected_items(): void + public function test_can_check_if_there_are_selected_items(): void { $this->assertFalse($this->basicTable->hasSelected()); @@ -116,8 +108,7 @@ public function can_check_if_there_are_selected_items(): void $this->assertTrue($this->basicTable->hasSelected()); } - /** @test */ - public function can_get_selected_count(): void + public function test_can_get_selected_count(): void { $this->assertEquals(0, $this->basicTable->getSelectedCount()); @@ -126,8 +117,7 @@ public function can_get_selected_count(): void $this->assertEquals(3, $this->basicTable->getSelectedCount()); } - /** @test */ - public function can_clear_selected(): void + public function test_can_clear_selected(): void { $this->basicTable->setSelected([1, 2, 3]); @@ -144,8 +134,7 @@ public function can_clear_selected(): void $this->assertTrue($this->basicTable->selectAllIsDisabled()); } - /** @test */ - public function select_all_disabled_when_selected_updated(): void + public function test_select_all_disabled_when_selected_updated(): void { $this->basicTable->setSelectAllEnabled(); @@ -157,8 +146,7 @@ public function select_all_disabled_when_selected_updated(): void $this->assertTrue($this->basicTable->selectAllIsDisabled()); } - /** @test */ - public function update_select_all_clears_or_selects_all_depending_on_status(): void + public function test_update_select_all_clears_or_selects_all_depending_on_status(): void { $this->basicTable->setSelected([1, 2, 3, 4, 5]); @@ -169,8 +157,7 @@ public function update_select_all_clears_or_selects_all_depending_on_status(): v $this->assertSame([1], $this->basicTable->getSelected()); } - /** @test */ - public function set_select_all_selects_all(): void + public function test_set_select_all_selects_all(): void { $this->assertSame([], $this->basicTable->getSelected()); @@ -181,50 +168,42 @@ public function set_select_all_selects_all(): void $this->assertSame(['1', '2', '3', '4', '5'], $this->basicTable->getSelected()); } - /** @test */ - public function can_get_bulk_action_confirms(): void + public function test_can_get_bulk_action_confirms(): void { $this->assertSame([], $this->basicTable->getBulkActionConfirms()); } - /** @test */ - public function can_find_if_bulk_action_has_confirm_message(): void + public function test_can_find_if_bulk_action_has_confirm_message(): void { $this->assertFalse($this->basicTable->hasConfirmationMessage('test123')); } - /** @test */ - public function bulk_action_confirm_returns_default_message_if_not_set(): void + public function test_bulk_action_confirm_returns_default_message_if_not_set(): void { $this->assertSame($this->basicTable->getBulkActionDefaultConfirmationMessage(), $this->basicTable->getBulkActionConfirmMessage('test')); } - /** @test */ - public function can_get_bulk_action_default_confirmation_message(): void + public function test_can_get_bulk_action_default_confirmation_message(): void { $this->assertSame('Are you sure?', $this->basicTable->getBulkActionDefaultConfirmationMessage()); } - /** @test */ - public function bulk_actions_td_attributes_returns_default_true_if_not_set(): void + public function test_bulk_actions_td_attributes_returns_default_true_if_not_set(): void { $this->assertSame(['default' => true], $this->basicTable->getBulkActionsTdAttributes()); } - /** @test */ - public function bulk_actions_td_checkbox_attributes_returns_default_true_if_not_set(): void + public function test_bulk_actions_td_checkbox_attributes_returns_default_true_if_not_set(): void { $this->assertSame(['default' => true], $this->basicTable->getBulkActionsTdCheckboxAttributes()); } - /** @test */ - public function bulk_actions_th_attributes_returns_default_true_if_not_set(): void + public function test_bulk_actions_th_attributes_returns_default_true_if_not_set(): void { $this->assertSame(['default' => true], $this->basicTable->getBulkActionsThAttributes()); } - /** @test */ - public function bulk_actions_th_checkbox_attributes_returns_default_true_if_not_set(): void + public function test_bulk_actions_th_checkbox_attributes_returns_default_true_if_not_set(): void { $this->assertSame(['default' => true], $this->basicTable->getBulkActionsThCheckboxAttributes()); } diff --git a/tests/Traits/Helpers/ColumnHelpersTest.php b/tests/Traits/Helpers/ColumnHelpersTest.php index 16b3c7ab2..fd68faec6 100644 --- a/tests/Traits/Helpers/ColumnHelpersTest.php +++ b/tests/Traits/Helpers/ColumnHelpersTest.php @@ -7,16 +7,14 @@ use Rappasoft\LaravelLivewireTables\Views\Column; use Rappasoft\LaravelLivewireTables\Views\Filters\TextFilter; -class ColumnHelpersTest extends TestCase +final class ColumnHelpersTest extends TestCase { - /** @test */ - public function can_get_column_list(): void + public function test_can_get_column_list(): void { $this->assertCount(9, $this->basicTable->getColumns()->toArray()); } - /** @test */ - public function can_append_column(): void + public function test_can_append_column(): void { $this->assertCount(9, $this->basicTable->getColumns()->toArray()); @@ -30,8 +28,7 @@ public function can_append_column(): void } - /** @test */ - public function can_prepend_column(): void + public function test_can_prepend_column(): void { $this->assertCount(9, $this->basicTable->getColumns()->toArray()); @@ -44,30 +41,26 @@ public function can_prepend_column(): void $this->assertCount(10, $this->basicTable->getColumns()->toArray()); } - /** @test */ - public function can_get_column_by_column(): void + public function test_can_get_column_by_column(): void { $column = $this->basicTable->getColumn('pets.id'); $this->assertSame('id', $column->getField()); } - /** @test */ - public function can_get_column_by_select_name(): void + public function test_can_get_column_by_select_name(): void { $column = $this->basicTable->getColumnBySelectName('id'); $this->assertSame('id', $column->getField()); } - /** @test */ - public function can_get_column_count(): void + public function test_can_get_column_count(): void { $this->assertSame(9, $this->basicTable->getColumnCount()); } - /** @test */ - public function can_tell_if_there_are_collapsable_columns(): void + public function test_can_tell_if_there_are_collapsable_columns(): void { $this->assertFalse($this->basicTable->hasCollapsedColumns()); @@ -82,8 +75,7 @@ public function can_tell_if_there_are_collapsable_columns(): void $this->assertTrue($this->basicTable->hasCollapsedColumns()); } - /** @test */ - public function can_tell_if_columns_should_collapse_on_mobile(): void + public function test_can_tell_if_columns_should_collapse_on_mobile(): void { $this->assertFalse($this->basicTable->shouldCollapseOnMobile()); @@ -94,8 +86,7 @@ public function can_tell_if_columns_should_collapse_on_mobile(): void $this->assertTrue($this->basicTable->shouldCollapseOnMobile()); } - /** @test */ - public function can_get_collapsed_mobile_columns(): void + public function test_can_get_collapsed_mobile_columns(): void { $this->assertCount(0, $this->basicTable->getCollapsedMobileColumns()); @@ -109,8 +100,7 @@ public function can_get_collapsed_mobile_columns(): void $this->assertSame('Name', $this->basicTable->getCollapsedMobileColumns()[1]->getTitle()); } - /** @test */ - public function can_get_collapsed_mobile_columns_count(): void + public function test_can_get_collapsed_mobile_columns_count(): void { $this->assertSame(0, $this->basicTable->getCollapsedMobileColumnsCount()); @@ -122,8 +112,7 @@ public function can_get_collapsed_mobile_columns_count(): void $this->assertSame(2, $this->basicTable->getCollapsedMobileColumnsCount()); } - /** @test */ - public function can_get_visible_mobile_columns(): void + public function test_can_get_visible_mobile_columns(): void { $this->assertCount(9, $this->basicTable->getVisibleMobileColumns()); @@ -139,8 +128,7 @@ public function can_get_visible_mobile_columns(): void $this->assertSame('Other', $this->basicTable->getVisibleMobileColumns()->values()[3]->getTitle()); } - /** @test */ - public function can_get_visible_mobile_columns_count(): void + public function test_can_get_visible_mobile_columns_count(): void { $this->assertSame(9, $this->basicTable->getVisibleMobileColumnsCount()); @@ -150,8 +138,7 @@ public function can_get_visible_mobile_columns_count(): void $this->assertSame(7, $this->basicTable->getVisibleMobileColumnsCount()); } - /** @test */ - public function can_tell_if_columns_should_collapse_on_tablet(): void + public function test_can_tell_if_columns_should_collapse_on_tablet(): void { $this->assertFalse($this->basicTable->shouldCollapseOnTablet()); @@ -162,8 +149,7 @@ public function can_tell_if_columns_should_collapse_on_tablet(): void $this->assertTrue($this->basicTable->shouldCollapseOnTablet()); } - /** @test */ - public function can_get_collapsed_tablet_columns(): void + public function test_can_get_collapsed_tablet_columns(): void { $this->assertCount(0, $this->basicTable->getCollapsedTabletColumns()); @@ -177,8 +163,7 @@ public function can_get_collapsed_tablet_columns(): void $this->assertSame('Name', $this->basicTable->getCollapsedTabletColumns()[1]->getTitle()); } - /** @test */ - public function can_get_collapsed_tablet_columns_count(): void + public function test_can_get_collapsed_tablet_columns_count(): void { $this->assertSame(0, $this->basicTable->getCollapsedTabletColumnsCount()); @@ -190,8 +175,7 @@ public function can_get_collapsed_tablet_columns_count(): void $this->assertSame(2, $this->basicTable->getCollapsedTabletColumnsCount()); } - /** @test */ - public function can_get_visible_tablet_columns(): void + public function test_can_get_visible_tablet_columns(): void { $this->assertCount(9, $this->basicTable->getVisibleTabletColumns()); @@ -207,8 +191,7 @@ public function can_get_visible_tablet_columns(): void $this->assertSame('Other', $this->basicTable->getVisibleTabletColumns()->values()[3]->getTitle()); } - /** @test */ - public function can_get_visible_tablet_columns_count(): void + public function test_can_get_visible_tablet_columns_count(): void { $this->assertSame(9, $this->basicTable->getVisibleTabletColumnsCount()); @@ -222,7 +205,7 @@ public function can_get_visible_tablet_columns_count(): void /// *** ** // - public function can_tell_if_columns_should_collapse_always(): void + public function test_can_tell_if_columns_should_collapse_always(): void { $this->assertFalse($this->basicTable->shouldCollapseAlways()); @@ -233,8 +216,7 @@ public function can_tell_if_columns_should_collapse_always(): void $this->assertTrue($this->basicTable->shouldCollapseAlways()); } - /** @test */ - public function can_get_always_collapsed_columns(): void + public function test_can_get_always_collapsed_columns(): void { $this->assertCount(0, $this->basicTable->getCollapsedAlwaysColumns()); @@ -248,8 +230,7 @@ public function can_get_always_collapsed_columns(): void $this->assertSame('Name', $this->basicTable->getCollapsedAlwaysColumns()[1]->getTitle()); } - /** @test */ - public function can_get_always_collapsed_columns_count(): void + public function test_can_get_always_collapsed_columns_count(): void { $this->assertSame(0, $this->basicTable->getCollapsedAlwaysColumnsCount()); @@ -261,8 +242,7 @@ public function can_get_always_collapsed_columns_count(): void $this->assertSame(2, $this->basicTable->getCollapsedAlwaysColumnsCount()); } - /** @test */ - /*public function can_get_selectable_columns(): void + /*public function test_can_get_selectable_columns(): void { $selectable = $this->basicTable->getSelectableColumns() ->map(fn (Column $column) => $column->getColumnSelectName()) @@ -271,8 +251,7 @@ public function can_get_always_collapsed_columns_count(): void $this->assertSame(['id', 'name', 'age', 'breed.name', 'last_visit'], $selectable); }*/ - /** @test */ - public function can_get_searchable_columns(): void + public function test_can_get_searchable_columns(): void { $selectable = $this->basicTable->getSearchableColumns() ->map(fn (Column $column) => $column->getColumnSelectName()) @@ -281,20 +260,17 @@ public function can_get_searchable_columns(): void $this->assertSame(['name', 'breed.name'], $selectable); } - /** @test */ - public function can_get_a_list_of_column_relations(): void + public function test_can_get_a_list_of_column_relations(): void { $this->assertSame([['breed']], $this->basicTable->getColumnRelations()); } - /** @test */ - public function can_get_a_list_of_column_relation_strings(): void + public function test_can_get_a_list_of_column_relation_strings(): void { $this->assertSame(['breed'], $this->basicTable->getColumnRelationStrings()); } - /** @test */ - public function can_check_if_column_is_reorder_column(): void + public function test_can_check_if_column_is_reorder_column(): void { $column = Column::make('ID', 'id'); $column->setComponent($this->basicTable); @@ -307,8 +283,7 @@ public function can_check_if_column_is_reorder_column(): void $this->assertTrue($column->isReorderColumn()); } - /** @test */ - public function can_check_if_column_has_secondary_header(): void + public function test_can_check_if_column_has_secondary_header(): void { $column = $this->basicTable->getColumnBySelectName('name'); $this->assertTrue($column->hasSecondaryHeaderCallback()); @@ -316,8 +291,7 @@ public function can_check_if_column_has_secondary_header(): void $this->assertTrue($callback instanceof TextFilter); } - /** @test */ - public function can_check_if_column_has_secondary_header_filter(): void + public function test_can_check_if_column_has_secondary_header_filter(): void { $column = $this->basicTable->getColumnBySelectName('breed.name'); $this->assertTrue($column->hasSecondaryHeader()); @@ -325,8 +299,7 @@ public function can_check_if_column_has_secondary_header_filter(): void $this->assertStringContainsString('id="table-filter-breed-8-header"', $contents); } - /** @test */ - public function can_check_if_column_has_custom_slug(): void + public function test_can_check_if_column_has_custom_slug(): void { $column = Column::make('Name'); @@ -337,8 +310,7 @@ public function can_check_if_column_has_custom_slug(): void $this->assertTrue($column->hasCustomSlug()); } - /** @test */ - public function can_column_custom_slug_returns(): void + public function test_can_column_custom_slug_returns(): void { $column = Column::make('Name'); @@ -349,8 +321,7 @@ public function can_column_custom_slug_returns(): void $this->assertSame(\Illuminate\Support\Str::slug('test123'), $column->getSlug()); } - /** @test */ - public function can_check_if_column_label_should_be_shown(): void + public function test_can_check_if_column_label_should_be_shown(): void { $column = Column::make('ID', 'id'); diff --git a/tests/Traits/Helpers/ColumnSelectHelpersTest.php b/tests/Traits/Helpers/ColumnSelectHelpersTest.php index ece99d5ba..7d0a13dc2 100644 --- a/tests/Traits/Helpers/ColumnSelectHelpersTest.php +++ b/tests/Traits/Helpers/ColumnSelectHelpersTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class ColumnSelectHelpersTest extends TestCase +final class ColumnSelectHelpersTest extends TestCase { - /** @test */ - public function can_get_column_select_status(): void + public function test_can_get_column_select_status(): void { $this->assertTrue($this->basicTable->columnSelectIsEnabled()); @@ -20,8 +19,7 @@ public function can_get_column_select_status(): void $this->assertTrue($this->basicTable->columnSelectIsEnabled()); } - /** @test */ - public function can_get_remember_column_selection_status(): void + public function test_can_get_remember_column_selection_status(): void { $this->assertTrue($this->basicTable->rememberColumnSelectionIsEnabled()); @@ -34,8 +32,7 @@ public function can_get_remember_column_selection_status(): void $this->assertTrue($this->basicTable->rememberColumnSelectionIsEnabled()); } - /** @test */ - public function can_set_column_select_hidden_on_mobile_status(): void + public function test_can_set_column_select_hidden_on_mobile_status(): void { $this->assertFalse($this->basicTable->getColumnSelectIsHiddenOnMobile()); @@ -48,8 +45,7 @@ public function can_set_column_select_hidden_on_mobile_status(): void $this->assertFalse($this->basicTable->getColumnSelectIsHiddenOnTablet()); } - /** @test */ - public function can_set_column_select_hidden_on_tablet_status(): void + public function test_can_set_column_select_hidden_on_tablet_status(): void { $this->assertFalse($this->basicTable->getColumnSelectIsHiddenOnMobile()); diff --git a/tests/Traits/Helpers/ComponentHelpersTest.php b/tests/Traits/Helpers/ComponentHelpersTest.php index 4d5272166..48a65b2a1 100644 --- a/tests/Traits/Helpers/ComponentHelpersTest.php +++ b/tests/Traits/Helpers/ComponentHelpersTest.php @@ -5,34 +5,29 @@ use Rappasoft\LaravelLivewireTables\Tests\Models\Pet; use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class ComponentHelpersTest extends TestCase +final class ComponentHelpersTest extends TestCase { - /** @test */ - public function can_see_if_component_has_model(): void + public function test_can_see_if_component_has_model(): void { $this->assertTrue($this->basicTable->hasModel()); } - /** @test */ - public function can_get_component_model(): void + public function test_can_get_component_model(): void { $this->assertSame(Pet::class, $this->basicTable->getModel()); } - /** @test */ - public function can_get_current_theme(): void + public function test_can_get_current_theme(): void { $this->assertEquals('tailwind', $this->basicTable->getTheme()); } - /** @test */ - public function can_get_empty_message(): void + public function test_can_get_empty_message(): void { $this->assertEquals('No items found. Try to broaden your search.', $this->basicTable->getEmptyMessage()); } - /** @test */ - public function can_get_offline_status(): void + public function test_can_get_offline_status(): void { $this->assertTrue($this->basicTable->getOfflineIndicatorStatus()); @@ -45,15 +40,13 @@ public function can_get_offline_status(): void $this->assertFalse($this->basicTable->getOfflineIndicatorStatus()); } - /** @test */ - public function can_get_default_sorting_labels(): void + public function test_can_get_default_sorting_labels(): void { $this->assertSame('A-Z', $this->basicTable->getDefaultSortingLabelAsc()); $this->assertSame('Z-A', $this->basicTable->getDefaultSortingLabelDesc()); } - /** @test */ - public function can_get_query_string_status(): void + public function test_can_get_query_string_status(): void { $this->assertTrue($this->basicTable->getQueryStringStatus()); @@ -66,8 +59,7 @@ public function can_get_query_string_status(): void $this->assertFalse($this->basicTable->getQueryStringStatus()); } - /** @test */ - public function can_get_table_name(): void + public function test_can_get_table_name(): void { $this->assertSame('table', $this->basicTable->getTableName()); @@ -76,8 +68,7 @@ public function can_get_table_name(): void $this->assertSame('table2', $this->basicTable->getTableName()); } - /** @test */ - public function can_get_page_name(): void + public function test_can_get_page_name(): void { $this->assertNull($this->basicTable->getPageName()); @@ -86,8 +77,7 @@ public function can_get_page_name(): void $this->assertSame('page2', $this->basicTable->getPageName()); } - /** @test */ - public function can_check_if_table_equals_name(): void + public function test_can_check_if_table_equals_name(): void { $this->assertTrue($this->basicTable->isTableNamed('table')); $this->assertFalse($this->basicTable->isTableNamed('table2')); @@ -97,8 +87,7 @@ public function can_check_if_table_equals_name(): void $this->assertTrue($this->basicTable->isTableNamed('table2')); } - /** @test */ - public function can_check_if_table_has_page_name(): void + public function test_can_check_if_table_has_page_name(): void { $this->assertFalse($this->basicTable->hasPageName()); @@ -107,8 +96,7 @@ public function can_check_if_table_has_page_name(): void $this->assertTrue($this->basicTable->hasPageName()); } - /** @test */ - public function can_get_eager_load_relations_status(): void + public function test_can_get_eager_load_relations_status(): void { $this->assertFalse($this->basicTable->eagerLoadAllRelationsIsEnabled()); @@ -125,8 +113,7 @@ public function can_get_eager_load_relations_status(): void $this->assertTrue($this->basicTable->eagerLoadAllRelationsIsDisabled()); } - /** @test */ - public function can_get_collapsing_columns_status(): void + public function test_can_get_collapsing_columns_status(): void { $this->assertTrue($this->basicTable->getCollapsingColumnsStatus()); @@ -139,8 +126,7 @@ public function can_get_collapsing_columns_status(): void $this->assertFalse($this->basicTable->getCollapsingColumnsStatus()); } - /** @test */ - public function can_check_for_tr_url(): void + public function test_can_check_for_tr_url(): void { $this->assertFalse($this->basicTable->hasTableRowUrl()); @@ -151,8 +137,7 @@ public function can_check_for_tr_url(): void $this->assertTrue($this->basicTable->hasTableRowUrl()); } - /** @test */ - public function can_get_additional_selects(): void + public function test_can_get_additional_selects(): void { $this->assertEquals([], $this->basicTable->getAdditionalSelects()); @@ -161,8 +146,7 @@ public function can_get_additional_selects(): void $this->assertEquals(['id', 'name'], $this->basicTable->getAdditionalSelects()); } - /** @test */ - public function can_get_additional_selects_nonarray(): void + public function test_can_get_additional_selects_nonarray(): void { $this->assertEquals([], $this->basicTable->getAdditionalSelects()); @@ -171,8 +155,7 @@ public function can_get_additional_selects_nonarray(): void $this->assertEquals(['name'], $this->basicTable->getAdditionalSelects()); } - /** @test */ - public function can_add_additional_selects(): void + public function test_can_add_additional_selects(): void { $this->assertEquals([], $this->basicTable->getAdditionalSelects()); @@ -185,8 +168,7 @@ public function can_add_additional_selects(): void $this->assertEquals(['id', 'name', 'updated_at'], $this->basicTable->getAdditionalSelects()); } - /** @test */ - public function can_add_additional_selects_nonarray(): void + public function test_can_add_additional_selects_nonarray(): void { $this->assertEquals([], $this->basicTable->getAdditionalSelects()); @@ -199,8 +181,7 @@ public function can_add_additional_selects_nonarray(): void $this->assertEquals(['name', 'updated_at'], $this->basicTable->getAdditionalSelects()); } - /** @test */ - public function can_get_configurable_areas(): void + public function test_can_get_configurable_areas(): void { $this->assertEquals([ 'before-tools' => null, @@ -227,8 +208,7 @@ public function can_get_configurable_areas(): void $this->assertEquals('includes.areas.toolbar-left-start', $this->basicTable->getConfigurableAreaFor('toolbar-left-start')); } - /** @test */ - public function can_get_configurable_area_parameters(): void + public function test_can_get_configurable_area_parameters(): void { $this->basicTable->setConfigurableAreas([ 'toolbar-left-start' => 'includes.areas.toolbar-left-start', @@ -243,8 +223,7 @@ public function can_get_configurable_area_parameters(): void $this->assertEquals(['param1' => 'hello'], $this->basicTable->getParametersForConfigurableArea('toolbar-left-start')); } - /** @test */ - public function can_get_hide_configurable_areas_when_reordering_status(): void + public function test_can_get_hide_configurable_areas_when_reordering_status(): void { $this->assertTrue($this->basicTable->getHideConfigurableAreasWhenReorderingStatus()); @@ -264,13 +243,12 @@ public function can_get_hide_configurable_areas_when_reordering_status(): void } // Exists in DataTableComponentTest - // public function can_get_dataTable_fingerprint(): void + // public function test_can_get_dataTable_fingerprint(): void //{ // $this->assertSame($this->defaultFingerPrintingAlgo($this->basicTable::class), $this->basicTable->getDataTableFingerprint()); // } - /** @test */ - public function can_get_query_string_alias_and_it_will_be_the_same_as_table_name_by_default(): void + public function test_can_get_query_string_alias_and_it_will_be_the_same_as_table_name_by_default(): void { $this->assertSame($this->basicTable->getTableName(), $this->basicTable->getQueryStringAlias()); } diff --git a/tests/Traits/Helpers/DebugHelpersTest.php b/tests/Traits/Helpers/DebugHelpersTest.php index 2778dca4a..fcfca12b7 100644 --- a/tests/Traits/Helpers/DebugHelpersTest.php +++ b/tests/Traits/Helpers/DebugHelpersTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class DebugHelpersTest extends TestCase +final class DebugHelpersTest extends TestCase { - /** @test */ - public function can_get_debug_status(): void + public function test_can_get_debug_status(): void { $this->assertTrue($this->basicTable->debugIsDisabled()); diff --git a/tests/Traits/Helpers/FilterHelpersTest.php b/tests/Traits/Helpers/FilterHelpersTest.php index 2b7cff29e..fee1bea06 100644 --- a/tests/Traits/Helpers/FilterHelpersTest.php +++ b/tests/Traits/Helpers/FilterHelpersTest.php @@ -10,10 +10,9 @@ use Rappasoft\LaravelLivewireTables\Views\Filters\SelectFilter; use Rappasoft\LaravelLivewireTables\Views\Filters\TextFilter; -class FilterHelpersTest extends TestCase +final class FilterHelpersTest extends TestCase { - /** @test */ - public function can_get_filters_status(): void + public function test_can_get_filters_status(): void { $this->assertTrue($this->basicTable->filtersAreEnabled()); @@ -26,8 +25,7 @@ public function can_get_filters_status(): void $this->assertTrue($this->basicTable->filtersAreEnabled()); } - /** @test */ - public function can_get_filters_visibility_status(): void + public function test_can_get_filters_visibility_status(): void { $this->assertTrue($this->basicTable->filtersVisibilityIsEnabled()); @@ -40,8 +38,7 @@ public function can_get_filters_visibility_status(): void $this->assertTrue($this->basicTable->filtersVisibilityIsEnabled()); } - /** @test */ - public function can_get_filter_pills_status(): void + public function test_can_get_filter_pills_status(): void { $this->assertTrue($this->basicTable->filterPillsAreEnabled()); @@ -54,14 +51,12 @@ public function can_get_filter_pills_status(): void $this->assertTrue($this->basicTable->filterPillsAreEnabled()); } - /** @test */ - public function can_check_if_component_has_filters(): void + public function test_can_check_if_component_has_filters(): void { $this->assertTrue($this->basicTable->hasFilters()); } - /** @test */ - public function can_get_component_filters(): void + public function test_can_get_component_filters(): void { $this->assertInstanceOf(MultiSelectFilter::class, $this->basicTable->getFilters()[0]); $this->assertInstanceOf(NumberFilter::class, $this->basicTable->getFilters()[2]); @@ -71,14 +66,12 @@ public function can_get_component_filters(): void $this->assertInstanceOf(SelectFilter::class, $this->basicTable->getFilters()[6]); } - /** @test */ - public function can_get_component_filter_count(): void + public function test_can_get_component_filter_count(): void { $this->assertEquals(7, $this->basicTable->getFiltersCount()); } - /** @test */ - public function can_get_component_filter_by_key(): void + public function test_can_get_component_filter_by_key(): void { $this->assertInstanceOf(MultiSelectFilter::class, $this->basicTable->getFilterByKey('breed')); @@ -105,8 +98,7 @@ public function can_get_component_filter_by_key(): void $this->assertNotInstanceOf(SelectFilter::class, $this->basicTable->getFilterByKey('last_visit_datetime_filter')); } - /** @test */ - public function can_set_filter_value(): void + public function test_can_set_filter_value(): void { $this->basicTable->setFilter('breed', ['1']); @@ -121,8 +113,7 @@ public function can_set_filter_value(): void $this->assertSame('Test', $this->basicTable->getAppliedFilterWithValue('pet_name_filter')); } - /** @test */ - public function can_select_all_filter_options(): void + public function test_can_select_all_filter_options(): void { $this->basicTable->selectAllFilterOptions('breed'); @@ -140,8 +131,7 @@ public function can_select_all_filter_options(): void ], $this->basicTable->getAppliedFilterWithValue('breed')); } - /** @test */ - public function can_set_filter_defaults(): void + public function test_can_set_filter_defaults(): void { $this->basicTable->setFilter('breed', ['1']); @@ -152,8 +142,7 @@ public function can_set_filter_defaults(): void $this->assertSame(['breed' => [], 'species' => [], 'breed_id_filter' => null, 'pet_name_filter' => null, 'last_visit_date_filter' => null, 'last_visit_datetime_filter' => null, 'breed_select_filter' => null], $this->basicTable->getAppliedFilters()); } - /** @test */ - public function can_not_set_invalid_filter(): void + public function test_can_not_set_invalid_filter(): void { $this->basicTable->setFilter('invalid-filter', ['1']); @@ -162,8 +151,7 @@ public function can_not_set_invalid_filter(): void $this->assertArrayNotHasKey('invalid-filter', $this->basicTable->getAppliedFilters()); } - /** @test */ - public function can_see_if_filters_set_with_values(): void + public function test_can_see_if_filters_set_with_values(): void { $this->assertFalse($this->basicTable->hasAppliedFiltersWithValues()); @@ -172,16 +160,14 @@ public function can_see_if_filters_set_with_values(): void $this->assertTrue($this->basicTable->hasAppliedFiltersWithValues()); } - /** @test */ - public function can_get_all_applied_filters_with_values(): void + public function test_can_get_all_applied_filters_with_values(): void { $this->basicTable->setFilter('breed', ['1']); $this->assertSame(['breed' => ['1']], $this->basicTable->getAppliedFiltersWithValues()); } - /** @test */ - public function can_get_all_applied_filters_with_values_count(): void + public function test_can_get_all_applied_filters_with_values_count(): void { $this->assertSame(0, $this->basicTable->getAppliedFiltersWithValuesCount()); @@ -190,14 +176,12 @@ public function can_get_all_applied_filters_with_values_count(): void $this->assertSame(1, $this->basicTable->getAppliedFiltersWithValuesCount()); } - /** @test */ - public function can_check_if_filter_layout_is_popover(): void + public function test_can_check_if_filter_layout_is_popover(): void { $this->assertTrue($this->basicTable->isFilterLayoutPopover()); } - /** @test */ - public function can_check_if_filter_layout_is_slidedown(): void + public function test_can_check_if_filter_layout_is_slidedown(): void { $this->assertFalse($this->basicTable->isFilterLayoutSlideDown()); @@ -206,8 +190,7 @@ public function can_check_if_filter_layout_is_slidedown(): void $this->assertTrue($this->basicTable->isFilterLayoutSlideDown()); } - /** @test */ - public function can_check_if_filter_layout_slidedown_is_visible(): void + public function test_can_check_if_filter_layout_slidedown_is_visible(): void { $this->assertFalse($this->basicTable->getFilterSlideDownDefaultStatus()); @@ -216,8 +199,7 @@ public function can_check_if_filter_layout_slidedown_is_visible(): void $this->assertTrue($this->basicTable->getFilterSlideDownDefaultStatus()); } - /** @test */ - public function can_check_if_filter_layout_slidedown_is_hidden(): void + public function test_can_check_if_filter_layout_slidedown_is_hidden(): void { $this->assertFalse($this->basicTable->getFilterSlideDownDefaultStatus()); diff --git a/tests/Traits/Helpers/FooterHelpersTest.php b/tests/Traits/Helpers/FooterHelpersTest.php index 23cc55e0b..b0d5d7c97 100644 --- a/tests/Traits/Helpers/FooterHelpersTest.php +++ b/tests/Traits/Helpers/FooterHelpersTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class FooterHelpersTest extends TestCase +final class FooterHelpersTest extends TestCase { - /** @test */ - public function can_get_footer_status(): void + public function test_can_get_footer_status(): void { $this->assertTrue($this->basicTable->footerIsEnabled()); @@ -20,8 +19,7 @@ public function can_get_footer_status(): void $this->assertTrue($this->basicTable->footerIsEnabled()); } - /** @test */ - public function can_get_use_header_as_footer_status(): void + public function test_can_get_use_header_as_footer_status(): void { $this->assertTrue($this->basicTable->useHeaderAsFooterIsDisabled()); diff --git a/tests/Traits/Helpers/LoadingPlaceholderHelpersTest.php b/tests/Traits/Helpers/LoadingPlaceholderHelpersTest.php index 5d3b92c28..d49a2f364 100644 --- a/tests/Traits/Helpers/LoadingPlaceholderHelpersTest.php +++ b/tests/Traits/Helpers/LoadingPlaceholderHelpersTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class LoadingPlaceholderHelpersTest extends TestCase +final class LoadingPlaceholderHelpersTest extends TestCase { - /** @test */ - public function can_get_loading_placeholder_status(): void + public function test_can_get_loading_placeholder_status(): void { $this->assertFalse($this->basicTable->hasDisplayLoadingPlaceholder()); diff --git a/tests/Traits/Helpers/PaginationHelpersTest.php b/tests/Traits/Helpers/PaginationHelpersTest.php index e55040ecb..471ee0d7f 100644 --- a/tests/Traits/Helpers/PaginationHelpersTest.php +++ b/tests/Traits/Helpers/PaginationHelpersTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class PaginationHelpersTest extends TestCase +final class PaginationHelpersTest extends TestCase { - /** @test */ - public function can_get_pagination_status(): void + public function test_can_get_pagination_status(): void { $this->assertTrue($this->basicTable->paginationIsEnabled()); @@ -20,8 +19,7 @@ public function can_get_pagination_status(): void $this->assertTrue($this->basicTable->paginationIsEnabled()); } - /** @test */ - public function can_get_pagination_visibility_status(): void + public function test_can_get_pagination_visibility_status(): void { $this->assertTrue($this->basicTable->paginationVisibilityIsEnabled()); @@ -34,8 +32,7 @@ public function can_get_pagination_visibility_status(): void $this->assertTrue($this->basicTable->paginationVisibilityIsEnabled()); } - /** @test */ - public function can_get_computed_page_name(): void + public function test_can_get_computed_page_name(): void { $this->assertSame('page', $this->basicTable->getComputedPageName()); @@ -48,20 +45,17 @@ public function can_get_computed_page_name(): void $this->assertSame('newPage', $this->basicTable->getComputedPageName()); } - /** @test */ - public function can_get_per_page_selection(): void + public function test_can_get_per_page_selection(): void { $this->assertSame(10, $this->basicTable->getPerPage()); } - /** @test */ - public function can_get_per_page_accepted(): void + public function test_can_get_per_page_accepted(): void { $this->assertSame([10, 25, 50], $this->basicTable->getPerPageAccepted()); } - /** @test */ - public function can_get_per_page_visibility_status(): void + public function test_can_get_per_page_visibility_status(): void { $this->assertTrue($this->basicTable->perPageVisibilityIsEnabled()); @@ -74,8 +68,7 @@ public function can_get_per_page_visibility_status(): void $this->assertTrue($this->basicTable->perPageVisibilityIsEnabled()); } - /** @test */ - public function can_check_and_set_pagination_method(): void + public function test_can_check_and_set_pagination_method(): void { $this->assertTrue($this->basicTable->isPaginationMethod('standard')); @@ -88,22 +81,19 @@ public function can_check_and_set_pagination_method(): void $this->assertTrue($this->basicTable->isPaginationMethod('standard')); } - /** @test */ - public function can_check_per_page_displayed_item_count(): void + public function test_can_check_per_page_displayed_item_count(): void { $this->assertSame(5, $this->basicTable->getPerPageDisplayedItemCount()); } - /** @test */ - public function can_check_per_page_displayed_items(): void + public function test_can_check_per_page_displayed_items(): void { $this->assertSame([1, 2, 3, 4, 5], $this->basicTable->getPerPageDisplayedItemIds()); } - /** @test */ - public function can_enable_detailed_pagination(): void + public function test_can_enable_detailed_pagination(): void { $this->assertTrue($this->basicTable->showPaginationDetails()); @@ -117,8 +107,7 @@ public function can_enable_detailed_pagination(): void $this->assertTrue($this->basicTable->showPaginationDetails()); } - /** @test */ - public function can_disable_detailed_pagination(): void + public function test_can_disable_detailed_pagination(): void { $this->assertTrue($this->basicTable->showPaginationDetails()); @@ -129,8 +118,7 @@ public function can_disable_detailed_pagination(): void } - /** @test */ - public function can_get_pagination_field_attributes(): void + public function test_can_get_pagination_field_attributes(): void { $this->assertSame(['default-styling' => true, 'default-colors' => true, 'class' => ''], $this->basicTable->getPerPageFieldAttributes()); diff --git a/tests/Traits/Helpers/RefreshHelpersTest.php b/tests/Traits/Helpers/RefreshHelpersTest.php index c8169a032..f661d13fb 100644 --- a/tests/Traits/Helpers/RefreshHelpersTest.php +++ b/tests/Traits/Helpers/RefreshHelpersTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class RefreshHelpersTest extends TestCase +final class RefreshHelpersTest extends TestCase { - /** @test */ - public function can_check_if_refresh_is_set(): void + public function test_can_check_if_refresh_is_set(): void { $this->assertFalse($this->basicTable->hasRefresh()); @@ -16,8 +15,7 @@ public function can_check_if_refresh_is_set(): void $this->assertTrue($this->basicTable->hasRefresh()); } - /** @test */ - public function can_get_refresh_options(): void + public function test_can_get_refresh_options(): void { $this->assertNull($this->basicTable->getRefreshOptions()); diff --git a/tests/Traits/Helpers/RelationshipHelpersTest.php b/tests/Traits/Helpers/RelationshipHelpersTest.php index f7eb482be..ff6eb2abe 100644 --- a/tests/Traits/Helpers/RelationshipHelpersTest.php +++ b/tests/Traits/Helpers/RelationshipHelpersTest.php @@ -5,10 +5,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; use Rappasoft\LaravelLivewireTables\Views\Column; -class RelationshipHelpersTest extends TestCase +final class RelationshipHelpersTest extends TestCase { - /** @test */ - public function can_check_if_base_column(): void + public function test_can_check_if_base_column(): void { $column = Column::make('ID'); @@ -19,8 +18,7 @@ public function can_check_if_base_column(): void $this->assertFalse($column->isBaseColumn()); } - /** @test */ - public function can_check_if_column_has_relations(): void + public function test_can_check_if_column_has_relations(): void { $column = Column::make('ID'); @@ -31,8 +29,7 @@ public function can_check_if_column_has_relations(): void $this->assertTrue($column->hasRelations()); } - /** @test */ - public function can_get_column_relations(): void + public function test_can_get_column_relations(): void { $column = Column::make('ID'); @@ -43,8 +40,7 @@ public function can_get_column_relations(): void $this->assertSame(['pets', 'species'], $column->getRelations()->toArray()); } - /** @test */ - public function can_get_column_relation_string(): void + public function test_can_get_column_relation_string(): void { $column = Column::make('ID', 'pets.species.id'); diff --git a/tests/Traits/Helpers/ReorderingHelpersTest.php b/tests/Traits/Helpers/ReorderingHelpersTest.php index cfd26397e..4771f8317 100644 --- a/tests/Traits/Helpers/ReorderingHelpersTest.php +++ b/tests/Traits/Helpers/ReorderingHelpersTest.php @@ -4,16 +4,14 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class ReorderingHelpersTest extends TestCase +final class ReorderingHelpersTest extends TestCase { - /** @test */ - public function can_get_reorder_method(): void + public function test_can_get_reorder_method(): void { $this->assertSame('reorder', $this->basicTable->getReorderMethod()); } - /** @test */ - public function can_get_reorder_status(): void + public function test_can_get_reorder_status(): void { $this->assertTrue($this->basicTable->reorderIsDisabled()); @@ -26,8 +24,7 @@ public function can_get_reorder_status(): void $this->assertTrue($this->basicTable->reorderIsDisabled()); } - /** @test */ - public function can_get_currently_reordering_status(): void + public function test_can_get_currently_reordering_status(): void { $this->assertTrue($this->basicTable->currentlyReorderingIsDisabled()); @@ -40,8 +37,7 @@ public function can_get_currently_reordering_status(): void $this->assertTrue($this->basicTable->currentlyReorderingIsDisabled()); } - /** @test */ - public function can_get_hide_reorder_column_unless_reordering_status(): void + public function test_can_get_hide_reorder_column_unless_reordering_status(): void { $this->assertTrue($this->basicTable->hideReorderColumnUnlessReorderingIsDisabled()); @@ -54,28 +50,24 @@ public function can_get_hide_reorder_column_unless_reordering_status(): void $this->assertTrue($this->basicTable->hideReorderColumnUnlessReorderingIsDisabled()); } - /** @test */ - public function can_get_default_reorder_column(): void + public function test_can_get_default_reorder_column(): void { $this->assertSame('sort', $this->basicTable->getDefaultReorderColumn()); } - /** @test */ - public function can_get_default_reorder_direction(): void + public function test_can_get_default_reorder_direction(): void { $this->assertSame('asc', $this->basicTable->getDefaultReorderDirection()); } - /** @test */ - public function can_set_reordering_session(): void + public function test_can_set_reordering_session(): void { $this->basicTable->setReorderingSession(); $this->assertTrue($this->basicTable->hasReorderingSession()); } - /** @test */ - public function can_forget_reordering_session(): void + public function test_can_forget_reordering_session(): void { $this->basicTable->setReorderingSession(); @@ -86,14 +78,12 @@ public function can_forget_reordering_session(): void $this->assertFalse($this->basicTable->hasReorderingSession()); } - /** @test */ - public function can_get_reordering_session_key(): void + public function test_can_get_reordering_session_key(): void { $this->assertSame('table-reordering', $this->basicTable->getReorderingSessionKey()); } - /** @test */ - public function can_get_reordering_backup_session_key(): void + public function test_can_get_reordering_backup_session_key(): void { $this->assertSame('table-reordering-backup', $this->basicTable->getReorderingBackupSessionKey()); } diff --git a/tests/Traits/Helpers/SearchHelpersTest.php b/tests/Traits/Helpers/SearchHelpersTest.php index fc139076e..08e2ad00e 100644 --- a/tests/Traits/Helpers/SearchHelpersTest.php +++ b/tests/Traits/Helpers/SearchHelpersTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class SearchHelpersTest extends TestCase +final class SearchHelpersTest extends TestCase { - /** @test */ - public function can_see_if_there_is_a_search_term(): void + public function test_can_see_if_there_is_a_search_term(): void { $this->assertFalse($this->basicTable->hasSearch()); @@ -16,16 +15,14 @@ public function can_see_if_there_is_a_search_term(): void $this->assertTrue($this->basicTable->hasSearch()); } - /** @test */ - public function can_get_search_term(): void + public function test_can_get_search_term(): void { $this->basicTable->setSearch('Anthony'); $this->assertSame('Anthony', $this->basicTable->getSearch()); } - /** @test */ - public function can_clear_current_search(): void + public function test_can_clear_current_search(): void { $this->basicTable->setSearch('Anthony'); @@ -36,8 +33,7 @@ public function can_clear_current_search(): void $this->assertFalse($this->basicTable->hasSearch()); } - /** @test */ - public function can_get_search_status(): void + public function test_can_get_search_status(): void { $this->assertTrue($this->basicTable->searchIsEnabled()); @@ -50,8 +46,7 @@ public function can_get_search_status(): void $this->assertTrue($this->basicTable->searchIsEnabled()); } - /** @test */ - public function can_get_search_visibility_status(): void + public function test_can_get_search_visibility_status(): void { $this->assertTrue($this->basicTable->searchVisibilityIsEnabled()); @@ -64,8 +59,7 @@ public function can_get_search_visibility_status(): void $this->assertTrue($this->basicTable->searchVisibilityIsEnabled()); } - /** @test */ - public function can_check_if_search_debounce_is_set(): void + public function test_can_check_if_search_debounce_is_set(): void { $this->assertFalse($this->basicTable->hasSearchDebounce()); @@ -74,8 +68,7 @@ public function can_check_if_search_debounce_is_set(): void $this->assertTrue($this->basicTable->hasSearchDebounce()); } - /** @test */ - public function can_check_if_search_defer_is_set(): void + public function test_can_check_if_search_defer_is_set(): void { $this->assertFalse($this->basicTable->hasSearchDefer()); @@ -84,8 +77,7 @@ public function can_check_if_search_defer_is_set(): void $this->assertTrue($this->basicTable->hasSearchDefer()); } - /** @test */ - public function can_check_if_search_blur_is_set(): void + public function test_can_check_if_search_blur_is_set(): void { $this->assertFalse($this->basicTable->hasSearchBlur()); @@ -94,8 +86,7 @@ public function can_check_if_search_blur_is_set(): void $this->assertTrue($this->basicTable->hasSearchBlur()); } - /** @test */ - /*public function can_check_if_search_lazy_is_set(): void + /*public function test_can_check_if_search_lazy_is_set(): void { $this->assertFalse($this->basicTable->hasSearchLazy()); @@ -104,8 +95,7 @@ public function can_check_if_search_blur_is_set(): void $this->assertTrue($this->basicTable->hasSearchLazy()); }*/ - /** @test */ - public function can_check_if_search_throttle_is_set(): void + public function test_can_check_if_search_throttle_is_set(): void { $this->assertFalse($this->basicTable->hasSearchThrottle()); @@ -114,8 +104,7 @@ public function can_check_if_search_throttle_is_set(): void $this->assertSame(180, $this->basicTable->getSearchThrottle()); } - /** @test */ - public function can_check_if_has_search_placeholder(): void + public function test_can_check_if_has_search_placeholder(): void { $this->assertFalse($this->basicTable->hasSearchPlaceholder()); diff --git a/tests/Traits/Helpers/SecondaryHeaderHelpersTest.php b/tests/Traits/Helpers/SecondaryHeaderHelpersTest.php index 6e4d3f3a8..38c8c3832 100644 --- a/tests/Traits/Helpers/SecondaryHeaderHelpersTest.php +++ b/tests/Traits/Helpers/SecondaryHeaderHelpersTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class SecondaryHeaderHelpersTest extends TestCase +final class SecondaryHeaderHelpersTest extends TestCase { - /** @test */ - public function can_get_secondary_header_status(): void + public function test_can_get_secondary_header_status(): void { $this->assertTrue($this->basicTable->secondaryHeaderIsEnabled()); diff --git a/tests/Traits/Helpers/SortingHelpersTest.php b/tests/Traits/Helpers/SortingHelpersTest.php index b6af2902a..21892b897 100644 --- a/tests/Traits/Helpers/SortingHelpersTest.php +++ b/tests/Traits/Helpers/SortingHelpersTest.php @@ -4,10 +4,9 @@ use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class SortingHelpersTest extends TestCase +final class SortingHelpersTest extends TestCase { - /** @test */ - public function can_get_sorting_status(): void + public function test_can_get_sorting_status(): void { $this->assertTrue($this->basicTable->sortingIsEnabled()); @@ -16,8 +15,7 @@ public function can_get_sorting_status(): void $this->assertTrue($this->basicTable->sortingIsDisabled()); } - /** @test */ - public function can_get_single_sorting_status(): void + public function test_can_get_single_sorting_status(): void { $this->assertTrue($this->basicTable->singleSortingIsEnabled()); @@ -26,24 +24,21 @@ public function can_get_single_sorting_status(): void $this->assertTrue($this->basicTable->singleSortingIsDisabled()); } - /** @test */ - public function can_set_sorts_array(): void + public function test_can_set_sorts_array(): void { $this->basicTable->setSorts(['id' => 'asc', 'name' => 'desc']); $this->assertSame($this->basicTable->getSorts(), ['id' => 'asc', 'name' => 'desc']); } - /** @test */ - public function can_get_sorts_array(): void + public function test_can_get_sorts_array(): void { $this->basicTable->setSorts(['id' => 'asc', 'name' => 'desc']); $this->assertSame($this->basicTable->getSorts(), ['id' => 'asc', 'name' => 'desc']); } - /** @test */ - public function can_get_single_sort_by_field(): void + public function test_can_get_single_sort_by_field(): void { $this->basicTable->setSorts(['id' => 'asc']); @@ -51,8 +46,7 @@ public function can_get_single_sort_by_field(): void $this->assertNull($this->basicTable->getSort('name')); } - /** @test */ - public function can_set_single_sort_by_field_and_direction(): void + public function test_can_set_single_sort_by_field_and_direction(): void { $this->assertEmpty($this->basicTable->getSorts()); @@ -62,8 +56,7 @@ public function can_set_single_sort_by_field_and_direction(): void $this->assertSame($this->basicTable->getSorts(), ['id' => 'asc', 'name' => 'desc']); } - /** @test */ - public function can_check_if_any_sorts(): void + public function test_can_check_if_any_sorts(): void { $this->basicTable->setSorts(['id' => 'asc', 'name' => 'desc']); @@ -74,8 +67,7 @@ public function can_check_if_any_sorts(): void $this->assertFalse($this->basicTable->hasSorts()); } - /** @test */ - public function can_check_single_sort_by_field(): void + public function test_can_check_single_sort_by_field(): void { $this->basicTable->setSorts(['id' => 'asc']); @@ -83,8 +75,7 @@ public function can_check_single_sort_by_field(): void $this->assertFalse($this->basicTable->hasSort('name')); } - /** @test */ - public function can_clear_sorts_array(): void + public function test_can_clear_sorts_array(): void { $this->basicTable->setSorts(['id' => 'asc', 'name' => 'desc']); @@ -95,8 +86,7 @@ public function can_clear_sorts_array(): void $this->assertFalse($this->basicTable->hasSorts()); } - /** @test */ - public function can_clear_single_sort_by_field(): void + public function test_can_clear_single_sort_by_field(): void { $this->basicTable->setSorts(['id' => 'asc', 'name' => 'desc']); @@ -107,8 +97,7 @@ public function can_clear_single_sort_by_field(): void $this->assertFalse($this->basicTable->hasSort('id')); } - /** @test */ - public function can_set_sort_field_asc(): void + public function test_can_set_sort_field_asc(): void { $this->basicTable->setSorts(['id' => 'desc']); @@ -119,8 +108,7 @@ public function can_set_sort_field_asc(): void $this->assertSame($this->basicTable->getSort('id'), 'asc'); } - /** @test */ - public function can_set_sort_field_desc(): void + public function test_can_set_sort_field_desc(): void { $this->basicTable->setSorts(['id' => 'asc']); @@ -131,8 +119,7 @@ public function can_set_sort_field_desc(): void $this->assertSame($this->basicTable->getSort('id'), 'desc'); } - /** @test */ - public function can_check_if_sort_field_currently_asc(): void + public function test_can_check_if_sort_field_currently_asc(): void { $this->basicTable->setSorts(['id' => 'asc']); @@ -140,8 +127,7 @@ public function can_check_if_sort_field_currently_asc(): void $this->assertFalse($this->basicTable->isSortDesc('id')); } - /** @test */ - public function can_check_if_sort_field_currently_desc(): void + public function test_can_check_if_sort_field_currently_desc(): void { $this->basicTable->setSorts(['id' => 'desc']); @@ -149,8 +135,7 @@ public function can_check_if_sort_field_currently_desc(): void $this->assertFalse($this->basicTable->isSortAsc('id')); } - /** @test */ - public function can_check_default_sort_status(): void + public function test_can_check_default_sort_status(): void { $this->assertFalse($this->basicTable->hasDefaultSort()); @@ -159,8 +144,7 @@ public function can_check_default_sort_status(): void $this->assertTrue($this->basicTable->hasDefaultSort()); } - /** @test */ - public function can_get_sorting_pills_status(): void + public function test_can_get_sorting_pills_status(): void { $this->assertTrue($this->basicTable->sortingPillsAreEnabled()); diff --git a/tests/Traits/Visuals/BulkActionsVisualsTest.php b/tests/Traits/Visuals/BulkActionsVisualsTest.php index 68bd8bc48..5447891da 100644 --- a/tests/Traits/Visuals/BulkActionsVisualsTest.php +++ b/tests/Traits/Visuals/BulkActionsVisualsTest.php @@ -6,18 +6,16 @@ use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\PetsTable; use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class BulkActionsVisualsTest extends TestCase +final class BulkActionsVisualsTest extends TestCase { - /** @test */ - public function bulk_dropdown_shows_when_necessary(): void + public function test_bulk_dropdown_shows_when_necessary(): void { Livewire::test(PetsTable::class) ->assertDontSee('No items found. Try to broaden your search.'); } - /** @test */ /* - public function bulk_dropdown_shows_when_necessary(): void + public function test_bulk_dropdown_shows_when_necessary(): void { Livewire::test(PetsTable::class) ->call('setBulkActionsDisabled') @@ -33,9 +31,8 @@ public function bulk_dropdown_shows_when_necessary(): void ->assertSee('Bulk Actions'); }*/ - /** @test */ /* - public function select_all_header_shows_if_bulk_actions_enabled_and_available(): void + public function test_select_all_header_shows_if_bulk_actions_enabled_and_available(): void { Livewire::test(PetsTable::class) ->call('setBulkActionsDisabled') @@ -46,9 +43,8 @@ public function select_all_header_shows_if_bulk_actions_enabled_and_available(): ->assertDontSee('Select All'); }*/ - /** @test */ /* - public function select_cell_shows_if_bulk_actions_enabled_and_available(): void + public function test_select_cell_shows_if_bulk_actions_enabled_and_available(): void { Livewire::test(PetsTable::class) ->call('setBulkActionsDisabled') @@ -59,8 +55,7 @@ public function select_cell_shows_if_bulk_actions_enabled_and_available(): void ->assertDontSee('Select All'); }*/ - /** @test */ - /*public function bulk_actions_row_shows_if_bulk_actions_enabled_and_available_and_selected(): void + /*public function test_bulk_actions_row_shows_if_bulk_actions_enabled_and_available_and_selected(): void { Livewire::test(PetsTable::class) ->call('setBulkActionsDisabled') @@ -73,9 +68,8 @@ public function select_cell_shows_if_bulk_actions_enabled_and_available(): void ->assertSeeHtml('wire:key="bulk-select-message-table"'); }*/ - /** @test */ /* - public function bulk_actions_row_shows_correct_for_select_some(): void + public function test_bulk_actions_row_shows_correct_for_select_some(): void { Livewire::test(PetsTable::class) ->call('setBulkActionsDisabled') diff --git a/tests/Traits/Visuals/ComponentVisualsTest.php b/tests/Traits/Visuals/ComponentVisualsTest.php index 27d827edb..62cd5cf6b 100644 --- a/tests/Traits/Visuals/ComponentVisualsTest.php +++ b/tests/Traits/Visuals/ComponentVisualsTest.php @@ -10,27 +10,24 @@ use Rappasoft\LaravelLivewireTables\Tests\Http\Livewire\{PetsTable,PetsTableAttributes}; use Rappasoft\LaravelLivewireTables\Tests\TestCase; -class ComponentVisualsTest extends TestCase +final class ComponentVisualsTest extends TestCase { private $testErrors; - /** @test */ - public function empty_message_does_not_show_with_results(): void + public function test_empty_message_does_not_show_with_results(): void { Livewire::test(PetsTable::class) ->assertDontSee('No items found. Try to broaden your search.'); } - /** @test */ - public function empty_message_shows_with_no_results(): void + public function test_empty_message_shows_with_no_results(): void { Livewire::test(PetsTable::class) ->set('search', 'sdfsdfsdfadsfasdfasdd') ->assertSee('No items found'); } - /** @test */ - public function debugging_shows_when_enabled(): void + public function test_debugging_shows_when_enabled(): void { Livewire::test(PetsTable::class) ->assertDontSee('Debugging Values') @@ -38,15 +35,13 @@ public function debugging_shows_when_enabled(): void ->assertSee('Debugging Values'); } - /** @test */ - public function offline_message_is_available_when_needed(): void + public function test_offline_message_is_available_when_needed(): void { Livewire::test(PetsTable::class) ->assertSeeHtml('