From 3279e5cfb18be6dbcb81180b02008179d05b01a9 Mon Sep 17 00:00:00 2001 From: Naffah Abdulla Rasheed Date: Mon, 1 Sep 2025 15:49:09 +0500 Subject: [PATCH 1/2] feat: Select2 filter by attribute addition --- resources/views/bootstrap-5/select.blade.php | 4 ++++ resources/views/material-admin-26/select.blade.php | 4 ++++ src/Views/Components/Select2.php | 3 +++ 3 files changed, 11 insertions(+) diff --git a/resources/views/bootstrap-5/select.blade.php b/resources/views/bootstrap-5/select.blade.php index 552a8fe..19141c6 100644 --- a/resources/views/bootstrap-5/select.blade.php +++ b/resources/views/bootstrap-5/select.blade.php @@ -62,6 +62,10 @@ data-filter-field="{{ $filterField }}" @endif + @if($filterBy) + data-filter-by="{{ $filterBy }}" + @endif + @if($tags) data-tags="true" @endif diff --git a/resources/views/material-admin-26/select.blade.php b/resources/views/material-admin-26/select.blade.php index d5d9eb7..ccbeafa 100644 --- a/resources/views/material-admin-26/select.blade.php +++ b/resources/views/material-admin-26/select.blade.php @@ -69,6 +69,10 @@ data-filter-field="{{ $filterField }}" @endif + @if($filterBy) + data-filter-by="{{ $filterBy }}" + @endif + @if($tags) data-tags="true" @endif diff --git a/src/Views/Components/Select2.php b/src/Views/Components/Select2.php index 1cd6656..4c38c95 100644 --- a/src/Views/Components/Select2.php +++ b/src/Views/Components/Select2.php @@ -12,6 +12,7 @@ class Select2 extends Select public string $ajaxUrl; public string $selectedUrl; public string $filterField; + public string $filterBy; public string $fallback; public string $parentModal; /** @@ -45,6 +46,7 @@ public function __construct( string $nameField = '', string $idField = '', string $filterField = '', + string $filterBy = '', string $fallback = '', string $parentModal = '', public string $iconPrefix = '', @@ -99,6 +101,7 @@ public function __construct( $this->ajaxUrl = $ajaxUrl; $this->selectedUrl = $selectedUrl; $this->filterField = $filterField; + $this->filterBy = $filterBy; $this->hideSearch = $hideSearch; $this->allowClear = $allowClear; $this->fallback = $fallback; From a45740677df38114a78ba8f75efae5b9d5c064fa Mon Sep 17 00:00:00 2001 From: Naffah Abdulla Rasheed Date: Mon, 1 Sep 2025 15:50:16 +0500 Subject: [PATCH 2/2] chore: Update PHPUnit test doc blocks with php attribute --- tests/Feature/AccordionTest.php | 21 ++++++----- tests/Feature/BulkTest.php | 5 ++- tests/Feature/ButtonTest.php | 17 +++++---- tests/Feature/CardTest.php | 37 ++++++++++--------- tests/Feature/CheckboxTest.php | 17 +++++---- tests/Feature/ConditionalLinkTest.php | 5 ++- tests/Feature/ConditionalWrapperTest.php | 9 +++-- tests/Feature/DateTest.php | 3 +- tests/Feature/FileTest.php | 23 ++++++------ tests/Feature/FormFilterTest.php | 5 ++- tests/Feature/FormTest.php | 3 +- tests/Feature/ImageTest.php | 7 ++-- tests/Feature/InputTest.php | 25 +++++++------ tests/Feature/JsErrorsTest.php | 5 ++- tests/Feature/LabelTest.php | 25 +++++++------ tests/Feature/MapInputTest.php | 9 +++-- tests/Feature/MultipleSelectTest.php | 3 +- tests/Feature/NavTabsTest.php | 5 ++- tests/Feature/NoItemsTest.php | 5 ++- .../OverrideFormsDefaultsMiddlewareTest.php | 3 +- tests/Feature/PerPageTest.php | 9 +++-- tests/Feature/RadioTest.php | 9 +++-- tests/Feature/SearchFormTest.php | 5 ++- tests/Feature/Select2CascadeTest.php | 11 +++--- tests/Feature/Select2Test.php | 13 ++++--- tests/Feature/SelectBooleanValueTest.php | 5 ++- tests/Feature/SelectRelationTest.php | 7 ++-- tests/Feature/SelectTest.php | 7 ++-- tests/Feature/SelectWithoutKeysTest.php | 5 ++- tests/Feature/SpoofMethodTest.php | 3 +- tests/Feature/StatusTest.php | 7 ++-- tests/Feature/TableCellTest.php | 19 +++++----- tests/Feature/TableTest.php | 9 +++-- tests/Feature/TabsTest.php | 5 ++- tests/Feature/TextEntryTest.php | 19 +++++----- tests/Feature/TextareaTest.php | 7 ++-- tests/Unit/FormsDataBinderTest.php | 5 ++- 37 files changed, 207 insertions(+), 170 deletions(-) diff --git a/tests/Feature/AccordionTest.php b/tests/Feature/AccordionTest.php index b608db6..3578614 100644 --- a/tests/Feature/AccordionTest.php +++ b/tests/Feature/AccordionTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class AccordionTest extends TestCase { - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_accordion_header() { $this->setFrameworkBootstrap5(); @@ -26,7 +27,7 @@ public function it_can_generate_bootstrap_5_accordion_header() } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_accordion_header() { $this->setFrameworkMaterialAdmin26(); @@ -39,7 +40,7 @@ public function it_can_generate_material_admin_26_accordion_header() ->seeInElement('.accordion__title#item-2', 'Accordion Item #2'); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_accordion_collapse() { $this->setFrameworkBootstrap5(); @@ -57,7 +58,7 @@ public function it_can_generate_bootstrap_5_accordion_collapse() } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_accordion_collapse() { $this->setFrameworkMaterialAdmin26(); @@ -75,7 +76,7 @@ public function it_can_generate_material_admin_26_accordion_collapse() } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_accordion_item() { $this->setFrameworkBootstrap5(); @@ -108,7 +109,7 @@ public function it_can_generate_bootstrap_5_accordion_item() } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_accordion_item() { $this->setFrameworkMaterialAdmin26(); @@ -133,7 +134,7 @@ public function it_can_generate_material_admin_26_accordion_item() } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_accordion_using_named_items() { $this->setFrameworkBootstrap5(); @@ -169,7 +170,7 @@ public function it_can_generate_bootstrap_5_accordion_using_named_items() } - /** @test */ + #[Test] public function it_can_generate_material_admin_accordion_using_named_items() { $this->setFrameworkMaterialAdmin26(); @@ -197,7 +198,7 @@ public function it_can_generate_material_admin_accordion_using_named_items() } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_accordion_using_unnamed_items() { $this->setFrameworkBootstrap5(); @@ -233,7 +234,7 @@ public function it_can_generate_bootstrap_5_accordion_using_unnamed_items() } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_accordion_using_slot() { $this->setFrameworkBootstrap5(); diff --git a/tests/Feature/BulkTest.php b/tests/Feature/BulkTest.php index 5129e5a..9a1fcaf 100644 --- a/tests/Feature/BulkTest.php +++ b/tests/Feature/BulkTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class BulkTest extends TestCase { - /** @test */ + #[Test] public function it_can_generated_bulk_actions_for_material_admin_26() { $this->setFrameworkMaterialAdmin26(); @@ -23,7 +24,7 @@ public function it_can_generated_bulk_actions_for_material_admin_26() }); } - /** @test */ + #[Test] public function it_can_generated_bulk_actions_for_bootstrap_5() { $this->setFrameworkBootstrap5(); diff --git a/tests/Feature/ButtonTest.php b/tests/Feature/ButtonTest.php index c372c30..3f5ffb9 100644 --- a/tests/Feature/ButtonTest.php +++ b/tests/Feature/ButtonTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class ButtonTest extends TestCase { - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_button_group() { $this->setFrameworkBootstrap5(); @@ -19,7 +20,7 @@ public function it_can_generate_bootstrap_5_button_group() }); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_group() { $this->setFrameworkMaterialAdmin26(); @@ -32,7 +33,7 @@ public function it_can_generate_material_admin_26_group() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_button() { $this->setFrameworkBootstrap5(); @@ -43,7 +44,7 @@ public function it_can_generate_bootstrap_5_button() ->seeInElement('button[type="button"].btn.btn-danger', 'Button'); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_button() { $this->setFrameworkMaterialAdmin26(); @@ -54,7 +55,7 @@ public function it_can_generate_material_admin_26_button() ->seeInElement('button[type="button"].btn.btn-danger', 'Button'); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_submit_button() { $this->setFrameworkBootstrap5(); @@ -65,7 +66,7 @@ public function it_can_generate_bootstrap_5_submit_button() ->seeInElement('button[type="submit"].btn.btn-danger', 'Button'); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_submit_button() { $this->setFrameworkMaterialAdmin26(); @@ -76,7 +77,7 @@ public function it_can_generate_material_admin_26_submit_button() ->seeInElement('button[type="submit"].btn.btn-danger', 'Button'); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_link_button() { $this->setFrameworkBootstrap5(); @@ -87,7 +88,7 @@ public function it_can_generate_bootstrap_5_link_button() ->seeInElement('a[href="/test"].btn.btn-danger', 'Button'); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_link_button() { $this->setFrameworkMaterialAdmin26(); diff --git a/tests/Feature/CardTest.php b/tests/Feature/CardTest.php index f3e2e12..2874196 100644 --- a/tests/Feature/CardTest.php +++ b/tests/Feature/CardTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class CardTest extends TestCase { - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_card_title() { $this->setFrameworkBootstrap5(); @@ -17,7 +18,7 @@ public function it_can_generate_bootstrap_5_card_title() ->seeInElement('h5.card-title', 'Card title'); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_card_title() { $this->setFrameworkMaterialAdmin26(); @@ -28,7 +29,7 @@ public function it_can_generate_material_admin_26_card_title() ->seeInElement('h4.card-title', 'Card title'); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_card_subtitle() { $this->setFrameworkBootstrap5(); @@ -39,7 +40,7 @@ public function it_can_generate_bootstrap_5_card_subtitle() ->seeInElement('h6.card-subtitle', 'Card subtitle'); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_card_subtitle() { $this->setFrameworkMaterialAdmin26(); @@ -50,7 +51,7 @@ public function it_can_generate_material_admin_26_card_subtitle() ->seeInElement('h6.card-subtitle', 'Card subtitle'); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_card_header() { $this->setFrameworkBootstrap5(); @@ -61,7 +62,7 @@ public function it_can_generate_bootstrap_5_card_header() ->seeInElement('div.card-header', 'Card header'); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_card_header() { $this->setFrameworkMaterialAdmin26(); @@ -72,7 +73,7 @@ public function it_can_generate_material_admin_26_card_header() ->seeInElement('div.card-header', 'Card header'); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_card_footer() { $this->setFrameworkBootstrap5(); @@ -83,7 +84,7 @@ public function it_can_generate_bootstrap_5_card_footer() ->seeInElement('div.card-footer', 'Card footer'); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_card_footer() { $this->setFrameworkMaterialAdmin26(); @@ -94,7 +95,7 @@ public function it_can_generate_material_admin_26_card_footer() ->seeInElement('div.card-footer', 'Card footer'); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_card() { $this->setFrameworkBootstrap5(); @@ -116,7 +117,7 @@ public function it_can_generate_bootstrap_5_card() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_card_with_header() { $this->setFrameworkBootstrap5(); @@ -134,7 +135,7 @@ public function it_can_generate_bootstrap_5_card_with_header() }); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_card_with_header() { $this->setFrameworkMaterialAdmin26(); @@ -152,7 +153,7 @@ public function it_can_generate_material_admin_26_card_with_header() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_card_with_subtitle() { $this->setFrameworkBootstrap5(); @@ -170,7 +171,7 @@ public function it_can_generate_bootstrap_5_card_with_subtitle() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_card_with_image_top() { $this->setFrameworkBootstrap5(); @@ -187,7 +188,7 @@ public function it_can_generate_bootstrap_5_card_with_image_top() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_card_with_footer() { $this->setFrameworkBootstrap5(); @@ -204,7 +205,7 @@ public function it_can_generate_bootstrap_5_card_with_footer() }); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_card_with_footer() { $this->setFrameworkMaterialAdmin26(); @@ -223,7 +224,7 @@ public function it_can_generate_material_admin_26_card_with_footer() // write test for material admin - /** @test */ + #[Test] public function it_can_generate_material_admin_26_card() { $this->setFrameworkMaterialAdmin26(); @@ -247,7 +248,7 @@ public function it_can_generate_material_admin_26_card() - /** @test */ + #[Test] public function it_can_generate_material_admin_26_card_with_subtitle() { $this->setFrameworkMaterialAdmin26(); @@ -265,7 +266,7 @@ public function it_can_generate_material_admin_26_card_with_subtitle() }); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_card_with_image_top() { $this->setFrameworkMaterialAdmin26(); diff --git a/tests/Feature/CheckboxTest.php b/tests/Feature/CheckboxTest.php index 85dec31..b81fb6a 100644 --- a/tests/Feature/CheckboxTest.php +++ b/tests/Feature/CheckboxTest.php @@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Route; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class CheckboxTest extends TestCase { @@ -16,7 +17,7 @@ public function setUp(): void Config::set('forms.inputs.inline', false); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_form_checkbox() { $this->setFrameworkBootstrap5(); @@ -32,7 +33,7 @@ public function it_can_generate_bootstrap_5_form_checkbox() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_form_checkbox_that_is_required() { $this->setFrameworkBootstrap5(); @@ -52,7 +53,7 @@ public function it_can_generate_bootstrap_5_form_checkbox_that_is_required() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_form_checkbox_that_is_selected() { $this->setFrameworkBootstrap5(); @@ -68,7 +69,7 @@ public function it_can_generate_bootstrap_5_form_checkbox_that_is_selected() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_form_checkbox_that_is_selected_from_model_binding() { $this->setFrameworkBootstrap5(); @@ -92,7 +93,7 @@ public function it_can_generate_bootstrap_5_form_checkbox_that_is_selected_from_ }); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_form_checkbox() { $this->setFrameworkMaterialAdmin26(); @@ -108,7 +109,7 @@ public function it_can_generate_material_admin_26_form_checkbox() }); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_form_checkbox_that_is_required() { $this->setFrameworkMaterialAdmin26(); @@ -129,7 +130,7 @@ public function it_can_generate_material_admin_26_form_checkbox_that_is_required } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_inline_form_checkbox_that_is_required() { $this->setFrameworkMaterialAdmin26(); @@ -150,7 +151,7 @@ public function it_can_generate_material_admin_26_inline_form_checkbox_that_is_r }); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_form_checkbox_with_helper_text() { $this->setFrameworkMaterialAdmin26(); diff --git a/tests/Feature/ConditionalLinkTest.php b/tests/Feature/ConditionalLinkTest.php index 9a07f97..9644b2f 100644 --- a/tests/Feature/ConditionalLinkTest.php +++ b/tests/Feature/ConditionalLinkTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class ConditionalLinkTest extends TestCase { - /** @test */ + #[Test] public function it_can_render_conditional_links_for_bootstrap_5() { $this->setFrameworkBootstrap5(); @@ -20,7 +21,7 @@ public function it_can_render_conditional_links_for_bootstrap_5() } - /** @test */ + #[Test] public function it_can_render_conditional_links_for_material_admin_26() { $this->setFrameworkMaterialAdmin26(); diff --git a/tests/Feature/ConditionalWrapperTest.php b/tests/Feature/ConditionalWrapperTest.php index 6d749f5..b6292bc 100644 --- a/tests/Feature/ConditionalWrapperTest.php +++ b/tests/Feature/ConditionalWrapperTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class ConditionalWrapperTest extends TestCase { - /** @test */ + #[Test] public function it_can_render_conditional_wrapper_bs5() { $this->setFrameworkBootstrap5(); @@ -16,7 +17,7 @@ public function it_can_render_conditional_wrapper_bs5() ->seeElement('div[data-enable-elem="#input"]'); } - /** @test */ + #[Test] public function it_can_render_conditional_wrapper_powered_by_checkbox_bs5() { $this->setFrameworkBootstrap5(); @@ -26,7 +27,7 @@ public function it_can_render_conditional_wrapper_powered_by_checkbox_bs5() ->seeElement('div[data-enable-section-checkbox="#input"]'); } - /** @test */ + #[Test] public function it_can_render_conditional_wrapper_material_26() { $this->setFrameworkMaterialAdmin26(); @@ -36,7 +37,7 @@ public function it_can_render_conditional_wrapper_material_26() ->seeElement('div[data-enable-elem="#input"]'); } - /** @test */ + #[Test] public function it_can_render_conditional_wrapper_powered_by_checkbox_material_26() { $this->setFrameworkMaterialAdmin26(); diff --git a/tests/Feature/DateTest.php b/tests/Feature/DateTest.php index 2d85050..a5c052c 100644 --- a/tests/Feature/DateTest.php +++ b/tests/Feature/DateTest.php @@ -4,6 +4,7 @@ use Illuminate\Support\Facades\Config; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class DateTest extends TestCase { @@ -15,7 +16,7 @@ public function setUp(): void Config::set('forms.inputs.inline', false); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_date_inputs() { $this->setFrameworkBootstrap5(); diff --git a/tests/Feature/FileTest.php b/tests/Feature/FileTest.php index 55afb57..661b5a3 100644 --- a/tests/Feature/FileTest.php +++ b/tests/Feature/FileTest.php @@ -6,6 +6,7 @@ use Illuminate\Http\UploadedFile; use Illuminate\Support\Facades\Route; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; use Javaabu\Forms\Tests\TestSupport\Models\Article; use Spatie\MediaLibrary\MediaCollections\Exceptions\FileDoesNotExist; use Spatie\MediaLibrary\MediaCollections\Exceptions\FileIsTooBig; @@ -38,7 +39,7 @@ protected function getArticleWithMedia(string $collection = 'featured_image'): A return $article; } - /** @test */ + #[Test] public function it_can_render_missing_file_inputs() { $article = $this->getArticleWithMedia(); @@ -68,7 +69,7 @@ public function it_can_render_missing_file_inputs() }); } - /** @test */ + #[Test] public function it_can_render_file_input_with_value() { $this->setFrameworkMaterialAdmin26(); @@ -96,7 +97,7 @@ public function it_can_render_file_input_with_value() }); } - /** @test */ + #[Test] public function it_can_render_unbound_file_inputs() { $this->setFrameworkMaterialAdmin26(); @@ -121,7 +122,7 @@ public function it_can_render_unbound_file_inputs() }); } - /** @test */ + #[Test] public function it_can_render_file_inputs_with_attribute_accessor() { $article = $this->getArticleWithMedia(); @@ -151,7 +152,7 @@ public function it_can_render_file_inputs_with_attribute_accessor() }); } - /** @test */ + #[Test] public function it_can_render_file_inputs_with_accessor() { $article = $this->getArticleWithMedia(); @@ -181,7 +182,7 @@ public function it_can_render_file_inputs_with_accessor() }); } - /** @test */ + #[Test] public function it_can_render_file_inputs_with_conversion_name() { $article = $this->getArticleWithMedia(); @@ -211,7 +212,7 @@ public function it_can_render_file_inputs_with_conversion_name() }); } - /** @test */ + #[Test] public function it_can_render_file_inputs_with_collection_name() { $article = $this->getArticleWithMedia(); @@ -241,7 +242,7 @@ public function it_can_render_file_inputs_with_collection_name() }); } - /** @test */ + #[Test] public function it_can_show_file_hint() { $article = $this->getArticleWithMedia(); @@ -274,7 +275,7 @@ public function it_can_show_file_hint() }); } - /** @test */ + #[Test] public function it_can_render_material_admin_26_file_inputs() { $article = $this->getArticleWithMedia(); @@ -305,7 +306,7 @@ public function it_can_render_material_admin_26_file_inputs() }); } - /** @test */ + #[Test] public function it_can_render_bootstrap_5_file_inputs() { $article = $this->getArticleWithMedia(); @@ -339,7 +340,7 @@ public function it_can_render_bootstrap_5_file_inputs() }); } - /** @test */ + #[Test] public function it_can_render_file_upload_inputs() { $article = $this->getArticleWithMedia(); diff --git a/tests/Feature/FormFilterTest.php b/tests/Feature/FormFilterTest.php index 3a4c494..45fc26b 100644 --- a/tests/Feature/FormFilterTest.php +++ b/tests/Feature/FormFilterTest.php @@ -4,6 +4,7 @@ use Illuminate\Support\Facades\Config; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class FormFilterTest extends TestCase { @@ -15,7 +16,7 @@ public function setUp(): void Config::set('forms.inputs.inline', false); } - // /** @test */ + // #[Test] // public function it_can_generate_bootstrap_5_form_filter() // { // $this->setFrameworkBootstrap5(); @@ -30,7 +31,7 @@ public function setUp(): void // ->seeElement('input[type="hidden"][name="order"]'); // } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_form_filter() { $this->setFrameworkMaterialAdmin26(); diff --git a/tests/Feature/FormTest.php b/tests/Feature/FormTest.php index ca286ec..5b81712 100644 --- a/tests/Feature/FormTest.php +++ b/tests/Feature/FormTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class FormTest extends TestCase { - /** @test */ + #[Test] public function it_can_render_a_form_with_an_action() { $this->registerTestRoute('form'); diff --git a/tests/Feature/ImageTest.php b/tests/Feature/ImageTest.php index 5b49e5b..d97c84e 100644 --- a/tests/Feature/ImageTest.php +++ b/tests/Feature/ImageTest.php @@ -6,6 +6,7 @@ use Illuminate\Http\UploadedFile; use Illuminate\Support\Facades\Route; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; use Javaabu\Forms\Tests\TestSupport\Models\Article; use Spatie\MediaLibrary\MediaCollections\Exceptions\FileDoesNotExist; use Spatie\MediaLibrary\MediaCollections\Exceptions\FileIsTooBig; @@ -40,7 +41,7 @@ protected function getArticleWithMedia(string $collection = 'featured_image'): A - /** @test */ + #[Test] public function it_can_render_bootstrap_5_image_inputs() { $article = $this->getArticleWithMedia(); @@ -80,7 +81,7 @@ public function it_can_render_bootstrap_5_image_inputs() }); } - /** @test */ + #[Test] public function it_can_render_material_admin_26_image_inputs() { $article = $this->getArticleWithMedia(); @@ -119,7 +120,7 @@ public function it_can_render_material_admin_26_image_inputs() }); } - /** @test */ + #[Test] public function it_can_render_image_upload_inputs() { $article = $this->getArticleWithMedia(); diff --git a/tests/Feature/InputTest.php b/tests/Feature/InputTest.php index b5579e0..8bf6087 100644 --- a/tests/Feature/InputTest.php +++ b/tests/Feature/InputTest.php @@ -4,6 +4,7 @@ use Illuminate\Support\Facades\Config; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class InputTest extends TestCase { @@ -15,7 +16,7 @@ public function setUp(): void Config::set('forms.inputs.inline', false); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_form_inputs_with_input_group() { $this->setFrameworkBootstrap5(); @@ -37,7 +38,7 @@ public function it_can_generate_bootstrap_5_form_inputs_with_input_group() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_form_inputs_without_form_group() { $this->setFrameworkBootstrap5(); @@ -49,7 +50,7 @@ public function it_can_generate_bootstrap_5_form_inputs_without_form_group() ->dontSeeElement('div.mb-4'); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_form_inputs_without_form_group() { $this->setFrameworkMaterialAdmin26(); @@ -61,7 +62,7 @@ public function it_can_generate_material_admin_26_form_inputs_without_form_group ->dontSeeElement('div.form-group'); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_form_inputs() { $this->setFrameworkBootstrap5(); @@ -76,7 +77,7 @@ public function it_can_generate_bootstrap_5_form_inputs() }); } - /** @test */ + #[Test] public function it_can_set_form_inputs_as_required() { $this->setFrameworkBootstrap5(); @@ -95,7 +96,7 @@ public function it_can_set_form_inputs_as_required() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_inline_form_inputs() { $this->setFrameworkBootstrap5(); @@ -113,7 +114,7 @@ public function it_can_generate_bootstrap_5_inline_form_inputs() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_floating_form_inputs() { $this->setFrameworkBootstrap5(); @@ -128,7 +129,7 @@ public function it_can_generate_bootstrap_5_floating_form_inputs() }); } - /** @test */ + #[Test] public function it_can_display_form_input_help_texts() { $this->setFrameworkBootstrap5(); @@ -145,7 +146,7 @@ public function it_can_display_form_input_help_texts() }); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_form_inputs() { $this->setFrameworkMaterialAdmin26(); @@ -161,7 +162,7 @@ public function it_can_generate_material_admin_26_form_inputs() }); } - /** @test */ + #[Test] public function it_can_generate_different_form_input_types() { $this->registerTestRoute('form-input-types'); @@ -176,7 +177,7 @@ public function it_can_generate_different_form_input_types() ->seeElement('input[name="tel"][type="tel"]'); } - /** @test */ + #[Test] public function it_can_generate_latitude_inputs() { $this->registerTestRoute('latitude'); @@ -185,7 +186,7 @@ public function it_can_generate_latitude_inputs() ->seeElement('input[name="latitude"][type="number"][step="0.000001"][min="-90"][max="90"]'); } - /** @test */ + #[Test] public function it_can_generate_longitude_inputs() { $this->registerTestRoute('longitude'); diff --git a/tests/Feature/JsErrorsTest.php b/tests/Feature/JsErrorsTest.php index f73a9f2..7a00c6d 100644 --- a/tests/Feature/JsErrorsTest.php +++ b/tests/Feature/JsErrorsTest.php @@ -5,10 +5,11 @@ use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Route; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class JsErrorsTest extends TestCase { - /** @test */ + #[Test] public function it_can_render_bootstrap_5_js_errors() { $this->setFrameworkBootstrap5(); @@ -18,7 +19,7 @@ public function it_can_render_bootstrap_5_js_errors() ->seeElement('ul.invalid-feedback.test-input-error'); } - /** @test */ + #[Test] public function it_can_render_material_admin_26_js_errors() { $this->setFrameworkMaterialAdmin26(); diff --git a/tests/Feature/LabelTest.php b/tests/Feature/LabelTest.php index f693bfb..d084373 100644 --- a/tests/Feature/LabelTest.php +++ b/tests/Feature/LabelTest.php @@ -4,6 +4,7 @@ use Illuminate\Support\Facades\Config; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class LabelTest extends TestCase { @@ -14,7 +15,7 @@ public function setUp(): void Config::set('forms.inputs.required_text', 'forms::strings.required_text'); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_blank_form_group() { $this->setFrameworkBootstrap5(); @@ -30,7 +31,7 @@ public function it_can_generate_bootstrap_5_blank_form_group() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_blank_label() { $this->setFrameworkBootstrap5(); @@ -41,7 +42,7 @@ public function it_can_generate_bootstrap_5_blank_label() ->seeInElement('label', ''); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_standard_form_labels() { $this->setFrameworkBootstrap5(); @@ -56,7 +57,7 @@ public function it_can_generate_bootstrap_5_standard_form_labels() $this->assertEquals('form-label', $class); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_required_string_for_form_labels() { $this->setFrameworkBootstrap5(); @@ -71,7 +72,7 @@ public function it_can_generate_bootstrap_5_required_string_for_form_labels() }); } - /** @test */ + #[Test] public function it_can_float_bootstrap_5_labels() { $this->setFrameworkBootstrap5(); @@ -86,7 +87,7 @@ public function it_can_float_bootstrap_5_labels() $this->assertNull($class); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_inline_form_labels() { $this->setFrameworkBootstrap5(); @@ -101,7 +102,7 @@ public function it_can_generate_bootstrap_5_inline_form_labels() $this->assertEquals('col-sm-3 col-lg-2 col-form-label', $class); } - /** @test */ + #[Test] public function it_can_display_bootstrap_5_form_help_text() { $this->setFrameworkBootstrap5(); @@ -112,7 +113,7 @@ public function it_can_display_bootstrap_5_form_help_text() ->seeInElement('div.form-text', 'This is a help text'); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_standard_form_labels() { $this->setFrameworkMaterialAdmin26(); @@ -127,7 +128,7 @@ public function it_can_generate_material_admin_26_standard_form_labels() $this->assertNull($class); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_required_string_for_form_labels() { $this->setFrameworkMaterialAdmin26(); @@ -142,7 +143,7 @@ public function it_can_generate_material_admin_26_required_string_for_form_label }); } - /** @test */ + #[Test] public function it_can_float_material_admin_26_labels() { $this->setFrameworkMaterialAdmin26(); @@ -157,7 +158,7 @@ public function it_can_float_material_admin_26_labels() $this->assertNull($class); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_inline_form_labels() { $this->setFrameworkMaterialAdmin26(); @@ -172,7 +173,7 @@ public function it_can_generate_material_admin_26_inline_form_labels() $this->assertEquals('col-sm-3 col-lg-2 col-form-label', $class); } - /** @test */ + #[Test] public function it_can_display_material_admin_26_form_help_text() { $this->setFrameworkMaterialAdmin26(); diff --git a/tests/Feature/MapInputTest.php b/tests/Feature/MapInputTest.php index 811baaa..fae43e6 100644 --- a/tests/Feature/MapInputTest.php +++ b/tests/Feature/MapInputTest.php @@ -7,6 +7,7 @@ use Javaabu\Forms\Tests\TestSupport\Models\City; use MatanYadaev\EloquentSpatial\Objects\Point; use MatanYadaev\EloquentSpatial\Objects\Polygon; +use PHPUnit\Framework\Attributes\Test; class MapInputTest extends TestCase { @@ -23,7 +24,7 @@ public function setUp(): void } } - /** @test */ + #[Test] public function it_adds_the_maps_script_to_the_scripts_stack() { $city = new City(); @@ -44,7 +45,7 @@ public function it_adds_the_maps_script_to_the_scripts_stack() ->seeInElement('script', 'The Google Maps JavaScript API'); } - /** @test */ + #[Test] public function it_can_bind_map_inputs_from_attributes() { $city = new City(); @@ -75,7 +76,7 @@ public function it_can_bind_map_inputs_from_attributes() }); } - /** @test */ + #[Test] public function it_can_bind_map_inputs_from_accessors() { $city = new City(); @@ -105,7 +106,7 @@ public function it_can_bind_map_inputs_from_accessors() }); } - /** @test */ +// #[Test] /*public function it_can_bind_map_inputs_from_direct_values() { $lat = 4.175804; diff --git a/tests/Feature/MultipleSelectTest.php b/tests/Feature/MultipleSelectTest.php index 8508631..018980d 100644 --- a/tests/Feature/MultipleSelectTest.php +++ b/tests/Feature/MultipleSelectTest.php @@ -4,10 +4,11 @@ use Illuminate\Http\Request; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class MultipleSelectTest extends TestCase { - /** @test */ + #[Test] public function it_posts_all_selected_options() { $this->registerTestRoute('multiple-select-keys', function (Request $request) { diff --git a/tests/Feature/NavTabsTest.php b/tests/Feature/NavTabsTest.php index e04ac6c..1cd89d3 100644 --- a/tests/Feature/NavTabsTest.php +++ b/tests/Feature/NavTabsTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class NavTabsTest extends TestCase { - /** @test */ + #[Test] public function it_can_generate_material_admin_26_nav_tabs() { $this->setFrameworkMaterialAdmin26(); @@ -41,7 +42,7 @@ public function it_can_generate_material_admin_26_nav_tabs() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_nav_tabs() { $this->setFrameworkBootstrap5(); diff --git a/tests/Feature/NoItemsTest.php b/tests/Feature/NoItemsTest.php index 17b4727..f3020b9 100644 --- a/tests/Feature/NoItemsTest.php +++ b/tests/Feature/NoItemsTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class NoItemsTest extends TestCase { - /** @test */ + #[Test] public function it_can_display_no_items_card_for_material_admin_26() { $this->withoutExceptionHandling(); @@ -21,7 +22,7 @@ public function it_can_display_no_items_card_for_material_admin_26() ->seeElement('.zmdi.zmdi-file'); } - /** @test */ + #[Test] public function it_can_display_no_items_card_for_bootstrap_5() { $this->withoutExceptionHandling(); diff --git a/tests/Feature/OverrideFormsDefaultsMiddlewareTest.php b/tests/Feature/OverrideFormsDefaultsMiddlewareTest.php index 51dd738..5e0d713 100644 --- a/tests/Feature/OverrideFormsDefaultsMiddlewareTest.php +++ b/tests/Feature/OverrideFormsDefaultsMiddlewareTest.php @@ -4,10 +4,11 @@ use Illuminate\Support\Facades\Config; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class OverrideFormsDefaultsMiddlewareTest extends TestCase { - /** @test */ + #[Test] public function it_can_use_the_middleware_to_switch_what_theme_to_use() { $this->withoutExceptionHandling(); diff --git a/tests/Feature/PerPageTest.php b/tests/Feature/PerPageTest.php index ec8b993..58c1387 100644 --- a/tests/Feature/PerPageTest.php +++ b/tests/Feature/PerPageTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class PerPageTest extends TestCase { - /** @test */ + #[Test] public function it_can_see_the_default_per_page_options_bs5() { $this->setFrameworkBootstrap5(); @@ -20,7 +21,7 @@ public function it_can_see_the_default_per_page_options_bs5() ->see('500'); } - /** @test */ + #[Test] public function it_can_see_the_custom_per_page_options_bs5() { $this->setFrameworkBootstrap5(); @@ -33,7 +34,7 @@ public function it_can_see_the_custom_per_page_options_bs5() ->see('55'); } - /** @test */ + #[Test] public function it_can_see_the_default_per_page_options_material_admin_26() { $this->setFrameworkMaterialAdmin26(); @@ -47,7 +48,7 @@ public function it_can_see_the_default_per_page_options_material_admin_26() ->see('500'); } - /** @test */ + #[Test] public function it_can_see_the_custom_per_page_options_material_admin_26() { $this->setFrameworkMaterialAdmin26(); diff --git a/tests/Feature/RadioTest.php b/tests/Feature/RadioTest.php index bc2c2eb..b5291ee 100644 --- a/tests/Feature/RadioTest.php +++ b/tests/Feature/RadioTest.php @@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Route; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class RadioTest extends TestCase { @@ -16,7 +17,7 @@ public function setUp(): void Config::set('forms.inputs.inline', false); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_form_checkbox() { $this->setFrameworkBootstrap5(); @@ -32,7 +33,7 @@ public function it_can_generate_bootstrap_5_form_checkbox() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_form_checkbox_that_is_required() { $this->setFrameworkBootstrap5(); @@ -53,7 +54,7 @@ public function it_can_generate_bootstrap_5_form_checkbox_that_is_required() } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_form_checkbox() { $this->setFrameworkMaterialAdmin26(); @@ -69,7 +70,7 @@ public function it_can_generate_material_admin_26_form_checkbox() }); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_form_checkbox_that_is_required() { $this->setFrameworkMaterialAdmin26(); diff --git a/tests/Feature/SearchFormTest.php b/tests/Feature/SearchFormTest.php index 863dc64..04d9ee9 100644 --- a/tests/Feature/SearchFormTest.php +++ b/tests/Feature/SearchFormTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class SearchFormTest extends TestCase { - /** @test */ + #[Test] public function it_can_render_a_material_admin_26_search_form() { $this->setFrameworkMaterialAdmin26(); @@ -19,7 +20,7 @@ public function it_can_render_a_material_admin_26_search_form() ->seeElement('input[name="search"][value="hello"]'); } - /** @test */ + #[Test] public function it_can_render_a_bootstrap_5_search_form() { $this->setFrameworkBootstrap5(); diff --git a/tests/Feature/Select2CascadeTest.php b/tests/Feature/Select2CascadeTest.php index 700ba2e..0ca4802 100644 --- a/tests/Feature/Select2CascadeTest.php +++ b/tests/Feature/Select2CascadeTest.php @@ -7,6 +7,7 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\Route; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class Country extends Model { @@ -71,7 +72,7 @@ class Select2CascadeTest extends TestCase { use RefreshDatabase; - /** @test */ + #[Test] public function it_can_create_select2_options_from_a_collection() { $countryA = Country::create(['name' => 'Maldives']); @@ -97,7 +98,7 @@ public function it_can_create_select2_options_from_a_collection() ->seeElement('option[value="' . $countryC->getKey() . '"]:not(:selected)'); } - /** @test */ + #[Test] public function it_can_create_select2_options_from_a_query_builder() { $countryA = Country::create(['name' => 'Maldives']); @@ -123,7 +124,7 @@ public function it_can_create_select2_options_from_a_query_builder() ->seeElement('option[value="' . $countryC->getKey() . '"]:not(:selected)'); } - /** @test */ + #[Test] public function it_can_extract_an_accessor_field_from_the_builder() { @@ -153,7 +154,7 @@ public function it_can_extract_an_accessor_field_from_the_builder() ->seeElement('option[value="' . $countryC->getKey() . '"]:not(:selected)'); } - /** @test */ + #[Test] public function it_can_extract_a_get_accessor_field_from_the_builder() { @@ -183,7 +184,7 @@ public function it_can_extract_a_get_accessor_field_from_the_builder() ->seeElement('option[value="' . $countryC->getKey() . '"]:not(:selected)'); } - /** @test */ + #[Test] public function it_can_render_a_select2_cascade() { diff --git a/tests/Feature/Select2Test.php b/tests/Feature/Select2Test.php index 72e88f8..8e0c5ca 100644 --- a/tests/Feature/Select2Test.php +++ b/tests/Feature/Select2Test.php @@ -4,12 +4,13 @@ use Illuminate\Support\Facades\Route; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; use Javaabu\Forms\Tests\TestSupport\Enums\ArticleStatuses; use Javaabu\Forms\Tests\TestSupport\Models\Article; class Select2Test extends TestCase { - /** @test */ + #[Test] public function it_can_render_a_select_2_basic_element_whose_value_comes_from_an_enum_cast() { // create an article @@ -37,7 +38,7 @@ public function it_can_render_a_select_2_basic_element_whose_value_comes_from_an } - /** @test */ + #[Test] public function it_can_render_a_select2_basic_element() { $post = [ @@ -64,7 +65,7 @@ public function it_can_render_a_select2_basic_element() ->seeElement('option[value="3"]'); } - /** @test */ + #[Test] public function it_can_render_a_select_2_basic_element_with_a_label() { $post = [ @@ -92,7 +93,7 @@ public function it_can_render_a_select_2_basic_element_with_a_label() ->seeElement('option[value="3"]'); } - /** @test */ + #[Test] public function it_can_render_a_select2_ajax_element() { $post = [ @@ -115,7 +116,7 @@ public function it_can_render_a_select2_ajax_element() ->seeElement('option[value="2"]:selected'); } - /** @test */ + #[Test] public function it_can_render_a_select2_element_with_custom_form_group_class_material_admin_26() { $this->setFrameworkMaterialAdmin26(); @@ -145,7 +146,7 @@ public function it_can_render_a_select2_element_with_custom_form_group_class_mat ->seeElement('option[value="3"]'); } - /** @test */ + #[Test] public function it_can_render_a_select2_element_with_custom_form_group_class_bootstrap_5() { $this->setFrameworkBootstrap5(); diff --git a/tests/Feature/SelectBooleanValueTest.php b/tests/Feature/SelectBooleanValueTest.php index 37d31d1..8391882 100644 --- a/tests/Feature/SelectBooleanValueTest.php +++ b/tests/Feature/SelectBooleanValueTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class SelectBooleanValueTest extends TestCase { - /** @test */ + #[Test] public function it_shows_the_select_field() { $this->registerTestRoute('select-boolean-value'); @@ -16,7 +17,7 @@ public function it_shows_the_select_field() ->seeElement('option[value="0"]'); } - /** @test */ + #[Test] public function it_shows_the_false_value_selected() { $this->registerTestRoute('select-boolean-value'); diff --git a/tests/Feature/SelectRelationTest.php b/tests/Feature/SelectRelationTest.php index 08355e8..eac5ae1 100644 --- a/tests/Feature/SelectRelationTest.php +++ b/tests/Feature/SelectRelationTest.php @@ -7,6 +7,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Route; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class PostBelongsToMany extends Model { @@ -46,7 +47,7 @@ class SelectRelationTest extends TestCase { use RefreshDatabase; - /** @test */ + #[Test] public function it_handles_belongs_to_many_relationships() { @@ -78,7 +79,7 @@ public function it_handles_belongs_to_many_relationships() $this->assertCount(1, DB::getQueryLog()); } - /** @test */ + #[Test] public function it_handles_morph_many_relationships() { @@ -108,7 +109,7 @@ public function it_handles_morph_many_relationships() $this->assertCount(1, DB::getQueryLog()); } - /** @test */ + #[Test] public function it_handles_morph_to_many_relationships() { diff --git a/tests/Feature/SelectTest.php b/tests/Feature/SelectTest.php index da642df..c6a24ab 100644 --- a/tests/Feature/SelectTest.php +++ b/tests/Feature/SelectTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class SelectTest extends TestCase { - /** @test */ + #[Test] public function it_shows_the_slot_if_the_options_are_empty() { $this->registerTestRoute('select-slot'); @@ -17,7 +18,7 @@ public function it_shows_the_slot_if_the_options_are_empty() ->seeElement('option[value="c"]'); } - /** @test */ + #[Test] public function it_can_render_a_placeholder() { $this->registerTestRoute('select-placeholder'); @@ -28,7 +29,7 @@ public function it_can_render_a_placeholder() ->seeElement('option[value="b"]'); } - /** @test */ + #[Test] public function it_adds_a_sync_field_for_multi_selects() { $this->registerTestRoute('select-multiple'); diff --git a/tests/Feature/SelectWithoutKeysTest.php b/tests/Feature/SelectWithoutKeysTest.php index 0c59ab0..55d4add 100644 --- a/tests/Feature/SelectWithoutKeysTest.php +++ b/tests/Feature/SelectWithoutKeysTest.php @@ -4,10 +4,11 @@ use Illuminate\Http\Request; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class SelectWithoutKeysTest extends TestCase { - /** @test */ + #[Test] public function it_makes_the_values_numeric() { $this->registerTestRoute('select-without-keys', function (Request $request) { @@ -22,7 +23,7 @@ public function it_makes_the_values_numeric() ->seeInElement('option[value="2"]', 'c'); } - /** @test */ + #[Test] public function it_shows_a_validation_error() { $this->registerTestRoute('select-without-keys', function (Request $request) { diff --git a/tests/Feature/SpoofMethodTest.php b/tests/Feature/SpoofMethodTest.php index cd5721d..ba19f0e 100644 --- a/tests/Feature/SpoofMethodTest.php +++ b/tests/Feature/SpoofMethodTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class SpoofMethodTest extends TestCase { - /** @test */ + #[Test] public function it_spoofs_the_methods_for_put_patch_and_delete_forms() { $this->registerTestRoute('spoof-method') diff --git a/tests/Feature/StatusTest.php b/tests/Feature/StatusTest.php index 205fafd..6338adb 100644 --- a/tests/Feature/StatusTest.php +++ b/tests/Feature/StatusTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class StatusTest extends TestCase { - /** @test */ + #[Test] public function it_can_generate_status_with_slot() { $this->registerTestRoute('status-slot'); @@ -19,7 +20,7 @@ public function it_can_generate_status_with_slot() }); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_status() { $this->setFrameworkMaterialAdmin26(); @@ -32,7 +33,7 @@ public function it_can_generate_material_admin_26_status() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_status() { $this->setFrameworkBootstrap5(); diff --git a/tests/Feature/TableCellTest.php b/tests/Feature/TableCellTest.php index b767639..447b9d9 100644 --- a/tests/Feature/TableCellTest.php +++ b/tests/Feature/TableCellTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class TableCellTest extends TestCase { - /** @test */ + #[Test] public function it_can_render_status_table_cell_entries_for_bootstrap_5() { $this->setFrameworkBootstrap5(); @@ -23,7 +24,7 @@ public function it_can_render_status_table_cell_entries_for_bootstrap_5() } - /** @test */ + #[Test] public function it_can_render_status_table_cell_entries_for_material_admin_26() { $this->setFrameworkMaterialAdmin26(); @@ -40,7 +41,7 @@ public function it_can_render_status_table_cell_entries_for_material_admin_26() } - /** @test */ + #[Test] public function it_can_render_boolean_table_cells() { $this->setFrameworkBootstrap5(); @@ -51,7 +52,7 @@ public function it_can_render_boolean_table_cells() ->seeInElement('td', 'Yes'); } - /** @test */ + #[Test] public function it_can_render_array_text_table_cells() { $this->setFrameworkBootstrap5(); @@ -62,7 +63,7 @@ public function it_can_render_array_text_table_cells() ->seeInElement('td', 'orange'); } - /** @test */ + #[Test] public function it_can_render_multiline_text_table_cells() { $this->setFrameworkBootstrap5(); @@ -73,7 +74,7 @@ public function it_can_render_multiline_text_table_cells() ->seeInElement('td', "Javaabu
\nCompany"); } - /** @test */ + #[Test] public function it_can_set_the_table_cell_from_model() { $this->setFrameworkBootstrap5(); @@ -87,7 +88,7 @@ public function it_can_set_the_table_cell_from_model() }); } - /** @test */ + #[Test] public function it_can_set_the_table_cell_from_value() { $this->setFrameworkBootstrap5(); @@ -98,7 +99,7 @@ public function it_can_set_the_table_cell_from_value() ->seeInElement('td', 'Javaabu'); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_table_cell() { $this->setFrameworkBootstrap5(); @@ -109,7 +110,7 @@ public function it_can_generate_bootstrap_5_table_cell() ->seeInElement('td', 'Javaabu'); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_table_cell() { $this->setFrameworkMaterialAdmin26(); diff --git a/tests/Feature/TableTest.php b/tests/Feature/TableTest.php index 59f126d..eb41cb6 100644 --- a/tests/Feature/TableTest.php +++ b/tests/Feature/TableTest.php @@ -4,13 +4,14 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; use Javaabu\Forms\Tests\TestSupport\Models\Activity; class TableTest extends TestCase { use RefreshDatabase; - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_table() { $this->setFrameworkBootstrap5(); @@ -48,7 +49,7 @@ public function it_can_generate_bootstrap_5_table() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_striped_table() { $this->setFrameworkBootstrap5(); @@ -61,7 +62,7 @@ public function it_can_generate_bootstrap_5_striped_table() }); } - /** @test */ + #[Test] public function it_can_generate_material_26_table() { $this->setFrameworkMaterialAdmin26(); @@ -114,7 +115,7 @@ public function it_can_generate_material_26_table() }); } - /** @test */ + #[Test] public function it_displays_empty_table_message_when_no_matching_rows() { $this->setFrameworkMaterialAdmin26(); diff --git a/tests/Feature/TabsTest.php b/tests/Feature/TabsTest.php index 2da89f8..8e3e9fc 100644 --- a/tests/Feature/TabsTest.php +++ b/tests/Feature/TabsTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class TabsTest extends TestCase { - /** @test */ + #[Test] public function it_can_generate_material_admin_26_tabs() { $this->setFrameworkMaterialAdmin26(); @@ -74,7 +75,7 @@ public function it_can_generate_material_admin_26_tabs() } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_tabs() { $this->setFrameworkBootstrap5(); diff --git a/tests/Feature/TextEntryTest.php b/tests/Feature/TextEntryTest.php index 1608f1a..c4214ce 100644 --- a/tests/Feature/TextEntryTest.php +++ b/tests/Feature/TextEntryTest.php @@ -3,10 +3,11 @@ namespace Javaabu\Forms\Tests\Feature; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class TextEntryTest extends TestCase { - /** @test */ + #[Test] public function it_can_render_status_entries_for_bootstrap_5() { $this->setFrameworkBootstrap5(); @@ -28,7 +29,7 @@ public function it_can_render_status_entries_for_bootstrap_5() } - /** @test */ + #[Test] public function it_can_render_status_entries_for_material_admin_26() { $this->setFrameworkMaterialAdmin26(); @@ -50,7 +51,7 @@ public function it_can_render_status_entries_for_material_admin_26() } - /** @test */ + #[Test] public function it_can_render_array_entries() { $this->setFrameworkBootstrap5(); @@ -66,7 +67,7 @@ public function it_can_render_array_entries() }); } - /** @test */ + #[Test] public function it_can_render_boolean_entries() { $this->setFrameworkBootstrap5(); @@ -82,7 +83,7 @@ public function it_can_render_boolean_entries() }); } - /** @test */ + #[Test] public function it_can_render_multiline_text_entries() { $this->setFrameworkBootstrap5(); @@ -98,7 +99,7 @@ public function it_can_render_multiline_text_entries() }); } - /** @test */ + #[Test] public function it_can_set_the_text_entry_from_model() { $this->setFrameworkBootstrap5(); @@ -117,7 +118,7 @@ public function it_can_set_the_text_entry_from_model() }); } - /** @test */ + #[Test] public function it_can_set_the_text_entry_from_value() { $this->setFrameworkBootstrap5(); @@ -133,7 +134,7 @@ public function it_can_set_the_text_entry_from_value() }); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_text_entry() { $this->setFrameworkBootstrap5(); @@ -149,7 +150,7 @@ public function it_can_generate_bootstrap_5_text_entry() }); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_text_entry() { $this->setFrameworkMaterialAdmin26(); diff --git a/tests/Feature/TextareaTest.php b/tests/Feature/TextareaTest.php index 97e3de3..fb5378a 100644 --- a/tests/Feature/TextareaTest.php +++ b/tests/Feature/TextareaTest.php @@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Route; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class TextareaTest extends TestCase { @@ -16,7 +17,7 @@ public function setUp(): void Config::set('forms.inputs.inline', false); } - /** @test */ + #[Test] public function it_can_generate_bootstrap_5_form_textarea() { $this->setFrameworkBootstrap5(); @@ -33,7 +34,7 @@ public function it_can_generate_bootstrap_5_form_textarea() }); } - /** @test */ + #[Test] public function it_can_generate_material_admin_26_form_textarea() { $this->setFrameworkMaterialAdmin26(); @@ -51,7 +52,7 @@ public function it_can_generate_material_admin_26_form_textarea() }); } - /** @test */ + #[Test] public function it_adds_the_tinymce_script_to_the_scripts_stack_for_wysiwyg_inputs() { $this->registerTestRoute('wysiwyg'); diff --git a/tests/Unit/FormsDataBinderTest.php b/tests/Unit/FormsDataBinderTest.php index 1a79845..0a6653d 100644 --- a/tests/Unit/FormsDataBinderTest.php +++ b/tests/Unit/FormsDataBinderTest.php @@ -4,10 +4,11 @@ use Javaabu\Forms\FormsDataBinder; use Javaabu\Forms\Tests\TestCase; +use PHPUnit\Framework\Attributes\Test; class FormsDataBinderTest extends TestCase { - /** @test */ + #[Test] public function it_can_bind_targets() { $binder = new FormsDataBinder(); @@ -17,7 +18,7 @@ public function it_can_bind_targets() $this->assertEquals($array, $binder->get()); } - /** @test */ + #[Test] public function it_can_bind_multiple_targets() { $binder = new FormsDataBinder();