From 863880515ae29b1e0d9ed279728df47a99d60e66 Mon Sep 17 00:00:00 2001 From: "Cyrill N. Kalita" Date: Fri, 20 Mar 2026 18:09:41 -0500 Subject: [PATCH 1/4] Update GitHub workflow for running tests --- .github/workflows/run-tests.yml | 66 ++++++++++++++++++++++++++------ tests/Filters/CastTest.php | 45 ++++++---------------- tests/Filters/DigitTest.php | 9 ++--- tests/Filters/EscapeHTMLTest.php | 5 +-- tests/Filters/FilterIfTest.php | 9 ++--- tests/Filters/FormatDateTest.php | 9 ++--- tests/Filters/LowercaseTest.php | 9 ++--- tests/Filters/StripTagsTest.php | 5 +-- tests/Filters/TrimTest.php | 5 +-- tests/Filters/UppercaseTest.php | 9 ++--- 10 files changed, 87 insertions(+), 84 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b05cf2a..1a13e92 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,19 +1,61 @@ -name: Laravel +name: run-tests on: - push: - branches: [ master ] pull_request: - branches: [ master ] - + types: [ready_for_review, synchronize] + paths: + - '**.php' + - '.github/workflows/run-tests.yml' + - 'phpunit.xml.dist' + - 'composer.json' + - 'composer.lock' jobs: - laravel-tests: + test: + runs-on: ${{ matrix.os }} + timeout-minutes: 5 + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest, windows-latest] + php: [8.5, 8.4, 8.3, 8.2] + laravel: [11.*, 12.*, 13.*] + stability: [prefer-stable] + exclude: + - laravel: 13.* + php: 8.2 + include: + - laravel: 11.* + testbench: 9.* + - laravel: 12.* + testbench: 10.* + - laravel: 13.* + testbench: 11.* - runs-on: ubuntu-latest + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist - - name: Execute tests (Unit and Feature tests) via PHPUnit - run: vendor/bin/phpunit + - name: Checkout code + uses: actions/checkout@v6 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo + coverage: none + + - name: Setup problem matchers + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Install dependencies + run: | + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.os == 'windows-latest' && '^^^' || '' }}${{ matrix.carbon }}" --no-interaction --no-update + composer update --${{ matrix.stability }} --prefer-dist --no-interaction + + - name: List Installed Dependencies + run: composer show -D + + - name: Execute tests + run: vendor/bin/pest --ci diff --git a/tests/Filters/CastTest.php b/tests/Filters/CastTest.php index 6530366..49243dc 100644 --- a/tests/Filters/CastTest.php +++ b/tests/Filters/CastTest.php @@ -1,6 +1,7 @@ sanitize(); } - /** - * @test - */ + #[Test] public function it_throws_exception_when_no_cast_type_is_set() { $this->expectException(\InvalidArgumentException::class); $this->sanitize(['name' => 'Name'], ['name' => 'cast']); } - /** - * @test - */ + #[Test] public function it_throws_exception_when_non_existing_cast_type_is_set() { $this->expectException(\InvalidArgumentException::class); $this->sanitize(['name' => 'Name'], ['name' => 'cast:bullshit']); } - /** - * @test - */ + #[Test] public function it_casts_to_integer() { $results = $this->sanitize(['var' => '15.6'], ['var' => 'cast:integer']); @@ -45,9 +40,7 @@ public function it_casts_to_integer() $this->assertEquals(15, $results['var']); } - /** - * @test - */ + #[Test] public function it_casts_to_float() { $results = $this->sanitize(['var' => '15.6'], ['var' => 'cast:double']); @@ -55,9 +48,7 @@ public function it_casts_to_float() $this->assertEquals(15.6, $results['var']); } - /** - * @test - */ + #[Test] public function it_casts_to_string() { $results = $this->sanitize(['var' => 15], ['var' => 'cast:string']); @@ -65,9 +56,7 @@ public function it_casts_to_string() $this->assertEquals('15', $results['var']); } - /** - * @test - */ + #[Test] public function it_casts_to_boolean() { $results = $this->sanitize(['var' => 15], ['var' => 'cast:boolean']); @@ -75,9 +64,7 @@ public function it_casts_to_boolean() $this->assertEquals(true, $results['var']); } - /** - * @test - */ + #[Test] public function it_casts_array_to_object() { $data = [ @@ -91,9 +78,7 @@ public function it_casts_array_to_object() $this->assertEquals(15.6, $results['var']->cost); } - /** - * @test - */ + #[Test] public function it_casts_json_to_object() { $data = [ @@ -107,9 +92,7 @@ public function it_casts_json_to_object() $this->assertEquals(15.6, $results['var']->cost); } - /** - * @test - */ + #[Test] public function it_casts_json_to_array() { $data = [ @@ -123,9 +106,7 @@ public function it_casts_json_to_array() $this->assertEquals(15.6, $results['var']['cost']); } - /** - * @test - */ + #[Test] public function it_casts_array_to_collection() { $data = [ @@ -138,9 +119,7 @@ public function it_casts_array_to_collection() $this->assertEquals('Name', $results['var']->first()); } - /** - * @test - */ + #[Test] public function it_casts_json_to_collection() { $data = [ diff --git a/tests/Filters/DigitTest.php b/tests/Filters/DigitTest.php index aac9643..2bee2ef 100644 --- a/tests/Filters/DigitTest.php +++ b/tests/Filters/DigitTest.php @@ -1,6 +1,7 @@ sanitize(); } - /** - * @test - */ + #[Test] public function it_string_to_digits() { $data = [ @@ -32,9 +31,7 @@ public function it_string_to_digits() $this->assertEquals('080969012345', $data['name']); } - /** - * @test - */ + #[Test] public function it_string_to_digits2() { $data = [ diff --git a/tests/Filters/EscapeHTMLTest.php b/tests/Filters/EscapeHTMLTest.php index c8b3d2f..d540642 100644 --- a/tests/Filters/EscapeHTMLTest.php +++ b/tests/Filters/EscapeHTMLTest.php @@ -1,6 +1,7 @@ sanitize(); } - /** - * @test - */ + #[Test] public function it_escapes_strings() { $data = [ diff --git a/tests/Filters/FilterIfTest.php b/tests/Filters/FilterIfTest.php index acbf4fc..7fbf715 100644 --- a/tests/Filters/FilterIfTest.php +++ b/tests/Filters/FilterIfTest.php @@ -1,6 +1,7 @@ sanitize(); } - /** - * @test - */ + #[Test] public function it_apply_filter_if_match() { $data = [ @@ -32,9 +31,7 @@ public function it_apply_filter_if_match() $this->assertEquals('HELLO EVERYBODY', $data['name']); } - /** - * @test - */ + #[Test] public function it_does_not_apply_filter_if_no_match() { $data = [ diff --git a/tests/Filters/FormatDateTest.php b/tests/Filters/FormatDateTest.php index f86d84a..43ff076 100644 --- a/tests/Filters/FormatDateTest.php +++ b/tests/Filters/FormatDateTest.php @@ -1,6 +1,7 @@ sanitize(); } - /** - * @test - */ + #[Test] public function it_formats_dates() { $data = [ @@ -32,9 +31,7 @@ public function it_formats_dates() $this->assertEquals('1983-03-21', $data['name']); } - /** - * @test - */ + #[Test] public function it_requires_two_arguments() { $this->expectException(\InvalidArgumentException::class); diff --git a/tests/Filters/LowercaseTest.php b/tests/Filters/LowercaseTest.php index de91636..3c018ca 100644 --- a/tests/Filters/LowercaseTest.php +++ b/tests/Filters/LowercaseTest.php @@ -1,6 +1,7 @@ sanitize(); } - /** - * @test - */ + #[Test] public function it_lowercases_strings() { $data = [ @@ -32,9 +31,7 @@ public function it_lowercases_strings() $this->assertEquals('hello everybody', $data['name']); } - /** - * @test - */ + #[Test] public function it_lowercases_special_characters_strings() { $data = [ diff --git a/tests/Filters/StripTagsTest.php b/tests/Filters/StripTagsTest.php index 82923b2..1282c40 100644 --- a/tests/Filters/StripTagsTest.php +++ b/tests/Filters/StripTagsTest.php @@ -1,6 +1,7 @@ sanitize(); } - /** - * @test - */ + #[Test] public function it_trims_strings() { $data = [ diff --git a/tests/Filters/TrimTest.php b/tests/Filters/TrimTest.php index 2fbb770..2776144 100644 --- a/tests/Filters/TrimTest.php +++ b/tests/Filters/TrimTest.php @@ -1,6 +1,7 @@ sanitize(); } - /** - * @test - */ + #[Test] public function it_trims_strings() { $data = [ diff --git a/tests/Filters/UppercaseTest.php b/tests/Filters/UppercaseTest.php index 3489859..fe1f3c3 100644 --- a/tests/Filters/UppercaseTest.php +++ b/tests/Filters/UppercaseTest.php @@ -1,6 +1,7 @@ sanitize(); } - /** - * @test - */ + #[Test] public function it_uppercases_strings() { $data = [ @@ -32,9 +31,7 @@ public function it_uppercases_strings() $this->assertEquals('HELLO EVERYBODY', $data['name']); } - /** - * @test - */ + #[Test] public function it_uppercases_special_characters_strings() { $data = [ From c1a580e8a2f4a8b7441ddfabbc56c2bf6693a84a Mon Sep 17 00:00:00 2001 From: "Cyrill N. Kalita" Date: Fri, 20 Mar 2026 18:11:10 -0500 Subject: [PATCH 2/4] Update Carbon version for Laravel 11, 12, and 13 --- .github/workflows/run-tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 1a13e92..ceaaa00 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -26,10 +26,13 @@ jobs: include: - laravel: 11.* testbench: 9.* + carbon: ^2.63 - laravel: 12.* testbench: 10.* + carbon: ^3.0 - laravel: 13.* testbench: 11.* + carbon: ^3.0 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} From 6a4b83a27974e407903b66deb0c6dd20ea6d4ff2 Mon Sep 17 00:00:00 2001 From: "Cyrill N. Kalita" Date: Fri, 20 Mar 2026 18:12:18 -0500 Subject: [PATCH 3/4] Update Laravel versions in run-tests.yml workflow --- .github/workflows/run-tests.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index ceaaa00..98f3599 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -18,15 +18,12 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] php: [8.5, 8.4, 8.3, 8.2] - laravel: [11.*, 12.*, 13.*] + laravel: [12.*, 13.*] stability: [prefer-stable] exclude: - laravel: 13.* php: 8.2 include: - - laravel: 11.* - testbench: 9.* - carbon: ^2.63 - laravel: 12.* testbench: 10.* carbon: ^3.0 From 01051f4b6ae7909b7d18b37798aa7a9563f74197 Mon Sep 17 00:00:00 2001 From: "Cyrill N. Kalita" Date: Fri, 20 Mar 2026 18:14:00 -0500 Subject: [PATCH 4/4] Update test execution command to use PHPUnit --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 98f3599..900f60b 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -58,4 +58,4 @@ jobs: run: composer show -D - name: Execute tests - run: vendor/bin/pest --ci + run: vendor/bin/phpunit