Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cd730e8
feat: upgrade to Pest v4 and implement testing improvements
KilianTrunk Oct 22, 2025
fa19c59
ci: upgrade php version
KilianTrunk Oct 22, 2025
79f3013
ci: fix test command
KilianTrunk Oct 22, 2025
3cedd8b
ci: add playwright
KilianTrunk Oct 22, 2025
6ca0fa8
ci: re-add parallel flag
KilianTrunk Oct 22, 2025
f647df5
ci: install dependencies fixes
KilianTrunk Oct 22, 2025
ea4d447
ci: fix attempt
KilianTrunk Oct 22, 2025
def4d2f
ci: fix attempt #2
KilianTrunk Oct 22, 2025
4cf1881
ci: remove custom virtual display
KilianTrunk Oct 22, 2025
63b2aeb
ci: cache playwright
KilianTrunk Oct 22, 2025
8e46a4b
ci: improve caching
KilianTrunk Oct 22, 2025
13bd61a
ci: fix playwright cache checking
KilianTrunk Oct 22, 2025
2ccc83f
Merge branch 'main' into feat/pest-v4-upgrade-and-testing-improvements
SlimDeluxe Apr 21, 2026
2f85d78
test: fix content-type header assertion in SmokeTest
SlimDeluxe Apr 22, 2026
29bdeb3
build(npm): update playwright version to 1.59.1
SlimDeluxe Apr 22, 2026
f8cabab
ci: separate code coverage report to a separate workflow
SlimDeluxe Apr 22, 2026
2872da6
build: remove shard scripts from composer.json
SlimDeluxe Apr 22, 2026
0b17009
ci(tests): add sockets extension and enable `--ci` flag for Pest runs
SlimDeluxe Apr 27, 2026
4809597
build: update slimdeluxe/php images to v1.5 and add Playwright depend…
SlimDeluxe Apr 27, 2026
6167fdb
test: add Pest shard timings file for improved test shard balancing
SlimDeluxe Apr 27, 2026
d3b5270
ci(tests): add Pest shard timings CI workflow
SlimDeluxe Apr 27, 2026
d824845
ci(tests): disable test shard splitting in CI workflow
SlimDeluxe Apr 27, 2026
4a1891c
build(npm): npm update
SlimDeluxe Apr 28, 2026
fcf5661
test: update workbench database SSL attribute for PHP 8.4+ compatibility
SlimDeluxe Apr 28, 2026
6d824c8
test: remove browser testing and playwright
SlimDeluxe Apr 28, 2026
1090621
style: fix code style
SlimDeluxe Apr 28, 2026
0c2dc95
ci(tests): disable fail-fast in test-runner workflow
SlimDeluxe Apr 28, 2026
208ce0e
ci(tests): remove test shard splitting
SlimDeluxe Apr 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Coverage

on:
# Run testing on all push and pull requests that have committed changes in PHP files
push:
paths:
- '**/*.php'
pull_request:
paths:
- '**/*.php'
# Make it possible to run the workflow manually
workflow_dispatch:

permissions:
contents: read

jobs:
coverage:

runs-on: ubuntu-latest

name: Code coverage report

steps:

#- name: Configure operating system
# run: sudo apt-get update && sudo apt-get install -y locales locales-all

- name: Checkout code
uses: actions/checkout@v6.0.2
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v5.0.5
with:
path: vendor
key: coverage-${{ hashFiles('**/composer.lock') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: xdebug
extensions: mbstring, gd, intl, pcntl

- name: Install dependencies
run: composer update --prefer-dist --no-progress --prefer-stable

- name: Setup testbench environment
run: |
cp workbench/.env.example workbench/.env
sed -i 's/APP_KEY=/APP_KEY=base64:ZQvPGC7uVADkjOgtGIIuCI8u3\/Pzu+VaRObIbHsgjCc=/' workbench/.env
sed -i 's/APP_ENV=local/APP_ENV=testing/' workbench/.env
grep "APP_KEY=base64:" workbench/.env
npm install
php vendor/bin/testbench vendor:publish --tag='filament-shield-config'
php vendor/bin/testbench filament:assets
php vendor/bin/testbench package:sync-skeleton

- name: Run test suite with coverage
run: vendor/bin/pest --coverage-clover ./coverage.xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v6.0.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage.xml
verbose: true
32 changes: 17 additions & 15 deletions .github/workflows/test-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,25 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
# extensions: mbstring, gd, intl
coverage: none
extensions: mbstring, gd, intl, pcntl

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress --no-interaction
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer require "orchestra/testbench:${{ matrix.testbench }}" --dev --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress --no-interaction --no-scripts

- name: Run test suite
run: composer test -- --coverage-clover ./coverage.xml
- name: Setup testbench environment
run: |
cp workbench/.env.example workbench/.env
sed -i 's/APP_KEY=/APP_KEY=base64:ZQvPGC7uVADkjOgtGIIuCI8u3\/Pzu+VaRObIbHsgjCc=/' workbench/.env
sed -i 's/APP_ENV=local/APP_ENV=testing/' workbench/.env
grep "APP_KEY=base64:" workbench/.env
npm install
php vendor/bin/testbench vendor:publish --tag='filament-shield-config'
php vendor/bin/testbench filament:assets
php vendor/bin/testbench package:sync-skeleton

- name: Upload coverage reports to Codecov
# Make sure the Codecov action is only executed once
if: matrix.php == '8.3' && matrix.laravel == '12.*' && matrix.dependency-version == 'prefer-stable'
uses: codecov/codecov-action@v6.0.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage.xml
verbose: true
- name: Run test suite
run: vendor/bin/pest --ci --parallel
2 changes: 1 addition & 1 deletion .lando.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
APP_BASE_PATH: "/app/workbench"
TESTBENCH_WORKING_PATH: "/app"
overrides:
image: slimdeluxe/php:8.3-v1.4
image: slimdeluxe/php:8.3-v1.5
platform: linux/amd64
run:
- composer install --no-interaction --prefer-dist
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@
"require-dev": {
"laravel/pint": "^1.21",
"orchestra/testbench": "^9.9|^10.0",
"pestphp/pest": "^3.7",
"pestphp/pest-plugin-livewire": "^3.0"
"pestphp/pest": "^4.0",
"pestphp/pest-plugin-laravel": "^4.0",
"pestphp/pest-plugin-livewire": "^4.0"
},
"scripts": {
"post-autoload-dump": [
Expand All @@ -64,7 +65,7 @@
"post-install-cmd": "@setup",
"post-update-cmd": "@setup",
"format": "vendor/bin/pint",
"test": "vendor/bin/testbench package:test",
"test": "vendor/bin/pest --parallel",
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
"prepare": "@php vendor/bin/testbench package:discover --ansi",
"build": "@php vendor/bin/testbench workbench:build --ansi",
Expand Down
2 changes: 1 addition & 1 deletion env/php-8.4/.lando.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
via: cli
app_mount: delegated
overrides:
image: slimdeluxe/php:8.4-v1.4
image: slimdeluxe/php:8.4-v1.5
volumes:
# Mount the project root directory to /app
- "../..:/app"
Expand Down
2 changes: 1 addition & 1 deletion env/php-8.5/.lando.dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
via: cli
app_mount: delegated
overrides:
image: slimdeluxe/php:8.5-v1.4
image: slimdeluxe/php:8.5-v1.5
volumes:
# Mount the project root directory to /app
- "../..:/app"
Expand Down
40 changes: 20 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 93 additions & 0 deletions tests/Feature/SmokeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php

use Eclipse\World\Filament\Clusters\World\Resources\CountryResource;
use Eclipse\World\Filament\Clusters\World\Resources\CurrencyResource;
use Eclipse\World\Filament\Clusters\World\Resources\PostResource;
use Eclipse\World\Filament\Clusters\World\Resources\RegionResource;

beforeEach(function () {
$this->setUpSuperAdmin();
});

describe('Smoke Tests', function () {
test('all resource URLs are accessible', function () {
$resources = [
CountryResource::class,
CurrencyResource::class,
PostResource::class,
RegionResource::class,
];

foreach ($resources as $resource) {
/** @noinspection PhpUndefinedMethodInspection */
$this->get($resource::getUrl())
->assertSuccessful()
->assertSee('Filament');
}
});

test('country resource URLs are accessible', function () {
$this->get(CountryResource::getUrl())
->assertSuccessful()
->assertSee('Countries')
->assertSee('Filament');
});

test('currency resource URLs are accessible', function () {
$this->get(CurrencyResource::getUrl())
->assertSuccessful()
->assertSee('Currencies')
->assertSee('Filament');
});

test('post resource URLs are accessible', function () {
$this->get(PostResource::getUrl())
->assertSuccessful()
->assertSee('Posts')
->assertSee('Filament');
});

test('region resource URLs are accessible', function () {
$this->get(RegionResource::getUrl())
->assertSuccessful()
->assertSee('Regions')
->assertSee('Filament');
});

test('all resource URLs return valid HTML', function () {
$resources = [
CountryResource::class,
CurrencyResource::class,
PostResource::class,
RegionResource::class,
];

foreach ($resources as $resource) {
/** @noinspection PhpUndefinedMethodInspection */
$response = $this->get($resource::getUrl());

$response->assertSuccessful();
$response->assertHeader('content-type', 'text/html; charset=utf-8');
$response->assertSee('<!DOCTYPE html>', false);
}
});

test('all resource URLs have no JavaScript errors', function () {
$resources = [
CountryResource::class,
CurrencyResource::class,
PostResource::class,
RegionResource::class,
];

foreach ($resources as $resource) {
/** @noinspection PhpUndefinedMethodInspection */
$response = $this->get($resource::getUrl());

$response->assertSuccessful();
$response->assertDontSee('Uncaught');
$response->assertDontSee('ReferenceError');
$response->assertDontSee('TypeError');
}
});
});
5 changes: 4 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ protected function migrate(): self
*/
protected function setUpSuperAdmin(): self
{
$this->superAdmin = User::factory()->create();
$this->superAdmin = User::factory()->create([
'name' => 'Test Super Admin',
'email' => 'test@example.com',
]);

// Assign super admin role and give all permissions
$superAdminRole = Role::where('name', 'super_admin')->first();
Expand Down
3 changes: 2 additions & 1 deletion workbench/config/database.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Illuminate\Support\Str;
use Pdo\Mysql;

return [

Expand Down Expand Up @@ -58,7 +59,7 @@
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
version_compare(PHP_VERSION, '8.4', '>=') ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],

Expand Down