Download the PHP package bberkaysari/laravel-test-generator without Composer
On this page you can find all versions of the php package bberkaysari/laravel-test-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bberkaysari/laravel-test-generator
More information about bberkaysari/laravel-test-generator
Files in bberkaysari/laravel-test-generator
Package laravel-test-generator
Short Description Universal Laravel test generator without AI - Generate comprehensive tests automatically
License MIT
Informations about the package laravel-test-generator
๐ Laravel Test Generator
Production-ready Laravel test generator with 85-90% automation without AI
Generate comprehensive PHPUnit tests for your Laravel application through static code analysis - no AI, no guessing, just reliable test generation from your actual code.
๐ What's New in Latest Version
๐ฏ Professional Test Quality (NEW!)
- ๐ 4-5 tests per method (previously 1) - Happy path, edge cases, error handling
- ๐ PHPUnit Annotations - @test, @group (service, repository, edge-case, error-handling)
- ๐ฒ Data Provider Support - Multiple scenario testing with @dataProvider
- ๐ก Smart Assertion Guides - Type-specific TODO comments with examples
- ๐ญ Mock Expectation Examples - Repository, Service, API patterns
๐ง Enhanced Scanner Capabilities (NEW!)
- ๐ Laravel Modules Support - Automatically scans /Modules directory
- ๐ฃ๏ธ Custom Route Files - Supports mock-api.php, admin-api.php, etc.
- ๐ฏ Smart Method Detection - Skips constructors and private methods
- ๐ Improved Import Management - No more duplicate namespaces
โจ Features
๐ฏ Core Capabilities
- โ Model Tests: Fillable validation, casts, relationships, scopes
- โ Controller Tests: HTTP methods, validation rules, route parameters
- โ Service/Repository Tests: Mock setup, edge cases, error handling (NEW!)
- โ Migration Tests: Schema validation, indexes, foreign keys
- โ 85-90% Automation: Comprehensive test coverage without manual work
๐ Enterprise-Scale Support
- โก Intelligent Caching: 10-50x speedup on subsequent runs (27ms โ 2ms)
- ๐ Performance Monitoring: Track analysis metrics for large projects
- ๐ Progress Tracking: Visual progress bars for bulk operations
- ๐ข 1000+ Models: Designed for enterprise-scale Laravel applications
- ๐ Laravel Modules: Full support for modular Laravel projects (NEW!)
๐ Advanced Analysis
- ๐ฌ Static Code Analysis: PHP-Parser based AST parsing
- ๐ฏ Resource Detection: Automatically identifies RESTful patterns
- โ๏ธ Validation Detection: Finds
$request->validate()calls - ๐ Relationship Mapping: Detects all Eloquent relationships
- ๐ Multi-Directory Scanning: app/, src/, Modules/ (NEW!)
๐ฆ Installation
๐ฎ Quick Start
Command Line Interface
Generate all tests:
Generate only model tests:
Generate only controller tests:
Generate service/repository tests:
Custom options:
Running Generated Tests with Groups (NEW!)
Run all tests:
Run only service tests:
Run only repository tests:
Run edge case tests:
Exclude incomplete tests:
Run parametrized tests:
Programmatic Usage
๐ What Gets Generated
Model Tests (8+ tests per model)
Controller Tests (3+ tests per method)
Example Generated Test
โก Performance Benchmarks
| Project Size | First Run | Cached Run | Speedup | Memory |
|---|---|---|---|---|
| Small (10 models, 5 controllers) | 100ms | 5ms | 20x | 12 MB |
| Medium (100 models, 50 controllers) | 1s | 50ms | 20x | 128 MB |
| Large (1000 models, 200 controllers) | 10s | 500ms | 20x | 512 MB |
Cache Performance (Demo Output):
๐ง CLI Options
| Option | Short | Description | Default |
|---|---|---|---|
--path=PATH |
-p |
Laravel project path | Current directory |
--type=TYPE |
-t |
Test type (model, controller, all) | all |
--output=DIR |
-o |
Output directory | tests |
--force |
-f |
Overwrite existing tests | false |
--no-cache |
Disable caching | false |
๐ Usage Examples
Generate Tests for Specific Project
Force Overwrite Existing Tests
Disable Cache for Fresh Analysis
Custom Output Directory
Generate Only Model Tests
๐ฏ Demo
Run the interactive demo to see all features:
Demo Output:
๐๏ธ Architecture
๐งช Testing
Current Status: โ 69 tests, 193 assertions, 100% passing
๐ ๏ธ Development
Running Tests
Code Quality Tools
Current Status: โ 145 tests, 394 assertions, 100% passing
Installing Code Coverage Tools
For Xdebug:
For PCOV (faster):
๐ CI/CD Pipeline
This project includes a complete GitHub Actions workflow:
- โ Multi-PHP Testing: Tests on PHP 8.2, 8.3, 8.4
- โ PHPStan Analysis: Level 5 static analysis
- โ Code Coverage: Codecov integration
- โ Mutation Testing: Infection for test quality
๐ค Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing) - Write tests for your changes
- Ensure all tests pass (
composer test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Credits
Created by Berkay Sari
Built with:
- nikic/php-parser - PHP AST parsing
- symfony/console - CLI interface
- symfony/finder - File searching
๐ Star History
If you find this project useful, please consider giving it a star! โญ
๐ Support
- ๐ง Email: [email protected]
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
Made with โค๏ธ for the Laravel community
All versions of laravel-test-generator with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
nesbot/carbon Version ^2.0|^3.0
nikic/php-parser Version ^4.17|^5.0
symfony/clock Version ^6.0|^7.0|^8.0
symfony/console Version ^6.0|^7.0|^8.0
symfony/finder Version ^6.0|^7.0|^8.0