This directory contains comprehensive tests to verify that the egyjs/progressive-json-php package installs and works correctly across multiple Laravel versions (9.x through 12.x).
The installation tests verify:
- β Package Installation: Composer can successfully install the package
- β Autoloading: Classes are properly autoloaded in Laravel context
- β Basic Functionality: Core package features work as expected
- β Laravel Integration: Package integrates well with Laravel's ecosystem
| PHP Version | Laravel 9.x | Laravel 10.x | Laravel 11.x | Laravel 12.x |
|---|---|---|---|---|
| PHP 8.1 | β | β | β* | β* |
| PHP 8.2 | β | β | β | β* |
| PHP 8.3 | β | β | β | β |
| PHP 8.4 | β | β | β | β |
*Laravel version requirements exclude certain PHP versions
The GitHub Actions workflow (.github/workflows/laravel-installation-test.yml) automatically runs these tests:
- Triggers: Push to master, Pull requests, Weekly schedule
- Matrix Strategy: Tests all compatible PHP/Laravel version combinations
- Unified Testing: Uses the same
scripts/test-laravel-installation.shscript for consistency - Comprehensive Testing: Full integration testing in clean Laravel installations
- Performance Monitoring: Tracks performance across versions
- Summary Reporting: Provides detailed test results and summaries
The GitHub Actions workflow leverages the same local test script for consistency:
- Setup: Configures PHP environment with required extensions
- Script Execution: Runs
./scripts/test-laravel-installation.sh [VERSION] --keep-files - PHPUnit Integration: Executes package tests within the Laravel context
- Summary Generation: Provides comprehensive test results
This unified approach ensures that:
- Local and CI testing use identical logic
- Debugging is easier (run the same script locally)
- Maintenance is simplified (single source of truth)
- Go to the "Actions" tab in your GitHub repository
- Look for "Laravel Installation Tests" workflow runs
- Click on any run to see detailed results for each PHP/Laravel combination
- Check the summary for a quick overview of test results
- PHP 8.1+ with Composer installed
- Git (for cloning Laravel projects)
- Sufficient disk space (each Laravel installation ~100MB)
The test script accepts Laravel version parameters for flexible testing:
# Make the script executable
chmod +x scripts/test-laravel-installation.sh
# Run all tests (default: Laravel 9.*, 10.*, 11.*, 12.*)
./scripts/test-laravel-installation.sh
# Test specific Laravel version
./scripts/test-laravel-installation.sh 10.*
# Test multiple specific versions
./scripts/test-laravel-installation.sh 9.* 11.*
# Keep test files for inspection (don't auto-cleanup)
./scripts/test-laravel-installation.sh --keep-files
# Combine version selection with file preservation
./scripts/test-laravel-installation.sh 10.* 11.* --keep-files
# Show help information
./scripts/test-laravel-installation.sh --help- Laravel Versions: Specify one or more Laravel versions (e.g.,
9.*,10.*,11.*,12.*) --keep-files: Preserve test directories after completion for debugging--help: Display usage information and examples
If no Laravel versions are specified, the script tests all default versions (9.* through 12.*).
# Test only Laravel 10 and 11
./scripts/test-laravel-installation.sh 10.* 11.*
# Test Laravel 9 and keep files for inspection
./scripts/test-laravel-installation.sh 9.* --keep-files
# Quick test of latest Laravel version
./scripts/test-laravel-installation.sh 12.*The scripts provide colored output to help you understand the test progress:
- π΅ [INFO]: General information about test progress
- π’ [SUCCESS]: Test step completed successfully
- π‘ [WARNING]: Non-critical issues or warnings
- π΄ [ERROR]: Test failures that need attention
[INFO] Starting Laravel Installation Tests
[INFO] PHP Version: 8.3.0
[INFO] Package: egyjs/progressive-json-php
[INFO] Testing Laravel 10.*
[INFO] Creating Laravel 10.* application...
[INFO] Created: Laravel Framework 10.48.22
[INFO] Installing egyjs/progressive-json-php...
[SUCCESS] Autoloading: β
[SUCCESS] Basic functionality: β
[SUCCESS] Laravel 10.* tests completed successfully!
=== TEST SUMMARY ===
[SUCCESS] All Laravel installation tests passed! π
[INFO] Your package is compatible with Laravel versions: 9.* 10.* 11.* 12.*
- Creates fresh Laravel applications using
composer create-project - Configures local package repository to simulate Packagist installation
- Installs package via
composer require egyjs/progressive-json-php:@dev - Verifies package appears in
composer showoutput
- Requires vendor autoload file
- Attempts to instantiate
Egyjs\ProgressiveJson\ProgressiveJsonStreamer - Verifies class exists and can be loaded
- Creates ProgressiveJsonStreamer instance within Laravel application context
- Processes sample data including Laravel version and PHP version information
- Uses Laravel's
app()->version()helper to verify Laravel integration - Verifies output is generated correctly and not empty
- Tests that the package works seamlessly within Laravel's environment
The workflow is designed to:
- Run automatically on code changes
- Test against all supported Laravel/PHP combinations
- Provide detailed failure information
- Cache dependencies for faster execution
- Generate test summaries
The current implementation focuses on essential compatibility testing:
- Installation verification: Ensures the package can be installed via Composer
- Autoloading verification: Confirms classes load correctly in Laravel
- Basic functionality: Tests core features work within Laravel context
- Future enhancements: Additional tests (service providers, routes, performance) may be added
To test new Laravel versions:
- Update the matrix in
.github/workflows/laravel-installation-test.yml - Add version to
LARAVEL_VERSIONSarray in test scripts - Update compatibility matrix in this documentation
- Test locally before committing
You can extend the tests by:
- Adding service provider integration tests
- Testing route context functionality
- Adding performance benchmarks
- Testing HTTP response generation
- Adding package removal verification
- Testing with different PHP extensions
When contributing to the package:
- Run installation tests locally before submitting PRs
- Update tests if adding Laravel-specific features
- Ensure tests pass in CI before merging
- Update this documentation for any test changes
If you encounter issues with the installation tests:
- Check the troubleshooting section above
- Review GitHub Actions logs for detailed error information
- Run tests locally with
--keep-filesfor debugging - Open an issue with test output and environment details