2045c856e9
- Add 10 core testing guides (setup, AAA principles, PHPUnit/Pest, mocking, anti-patterns, PHP 8.4+, debugging, data factories, advanced edge cases) - Add 13 component testing guides covering all Laravel layers - Add standard templates for PHPUnit 10/11 and Pest v2/v3 including ArchitectureTest - Add Docker smart test runner, dependency installer, and CI/CD templates (GitHub Actions, GitLab CI) - Add 4 Claude Code skills (laravel-test-setup, laravel-unit-test with --all mode, laravel-test-review, laravel-mock-helper) - Add single unified installer script (sg-install-unit-testing.sh) with global support, CLI runners, and 1-click updater (sg-test-update) - Add comprehensive documentation (README.md, USAGE-GUIDE.md) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
57 lines
1.6 KiB
Plaintext
57 lines
1.6 KiB
Plaintext
name: Laravel Unit Tests & Quality Gate
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, develop ]
|
|
pull_request:
|
|
branches: [ main, develop ]
|
|
|
|
jobs:
|
|
unit-tests:
|
|
name: Unit Tests (PHP ${{ matrix.php }} - ${{ matrix.dependency-version }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
php: ['8.2', '8.3', '8.4']
|
|
dependency-version: [prefer-stable]
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup PHP & Extensions
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php }}
|
|
extensions: mbstring, dom, fileinfo, sqlite3, pdo_sqlite, pcov
|
|
coverage: pcov
|
|
tools: composer:v2
|
|
|
|
- name: Cache Composer Dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: vendor
|
|
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-php-${{ matrix.php }}-
|
|
|
|
- name: Install Dependencies
|
|
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress
|
|
|
|
- name: Setup Environment Variables
|
|
run: |
|
|
cp .env.example .env.testing 2>/dev/null || true
|
|
php artisan key:generate --env=testing
|
|
|
|
- name: Run Unit Tests (Parallel Execution with Coverage Check)
|
|
run: |
|
|
php artisan test --testsuite=Unit --parallel --coverage --min=80
|
|
env:
|
|
APP_ENV: testing
|
|
DB_CONNECTION: sqlite
|
|
DB_DATABASE: ":memory:"
|
|
CACHE_STORE: array
|
|
QUEUE_CONNECTION: sync
|
|
MAIL_MAILER: array
|