testo/convention
Testo naming-convention plugin that discovers tests by file and class name patterns instead of explicit attributes. Ideal for adopting Testo in existing codebases with established conventions or integrating third-party suites without Testo attributes.
*Test.php in tests/) but operates at a lower abstraction level than Laravel’s TestCase. Requires a bridge layer to align with Laravel’s TestWorker and TestCase lifecycle.TestResolver to delegate discovery to Testo.TestCase bootstrapping (e.g., createApplication()).phpunit.xml or Pest’s pest.php if both define discovery rules. Needs explicit isolation (e.g., separate config files).TestCase assertions (e.g., assertDatabaseHas).php artisan test).App\Tests\* vs. Tests\*).tests/Feature/, tests/Unit/).vendor/).TestoServiceProvider).TestCase state vs. Testo’s context).Adoption Strategy:
Integration Depth:
TestCase, or act as a secondary runner?createApplication() and other Laravel test hooks interact with Testo?Convention Design:
FeatureTest, UnitTest) require runtime configuration?Tooling Support:
php artisan test?Performance:
vendor/, node_modules/)?Rollback Plan:
*Test.php) and needing Testo-specific features (e.g., assertSoft).TestCase assertions (e.g., assertDatabaseHas).Phase 1: Testo Core Integration
composer require --dev php-testo/testo
TestResolver to delegate discovery:
// app/Providers/TestoServiceProvider.php
public function boot()
{
TestCase::macro('runTestoTests', function () {
return Testo::run($this->getName());
});
}
composer.json to support parallel execution:
"scripts": {
"test": "php artisan test --runner=phpunit && testo run"
}
Phase 2: Convention Plugin Setup
composer require --dev testo/convention
testo.php:
return [
'conventions' => [
'files' => ['tests/Unit/*Test.php', 'tests/Feature/*Test.php'],
'classes' => ['*Test', 'TestCase'],
'methods' => ['test*'],
],
'excludes' => ['tests/Integration/*'], // Skip integration tests
];
Phase 3: Bridge Laravel Test Lifecycle
TestCase to support Testo:
// app/Tests/TestCase.php
public function runTestoSuite()
{
return Testo::discoverAndRun($this->getTestPath());
}
php artisan test to invoke Testo:
php artisan test --runner=testo
Phase 4: CI/CD Integration
# .github/workflows/test.yml
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: composer test
- run: testo run --coverage
Phase 5: Gradual Rollout
TestCase contract.assertDatabaseHas() may need a Testo-compatible alias.phpunit --testdox-html + Testo’s output)..idea/testRunConfigurations).| Phase | Task | Dependencies |
|---|---|---|
| 1. Evaluation | Benchmark Testo vs. PHPUnit/Pest for discovery speed and feature parity. | None |
| 2. Setup | Install Testo and configure testo.php. |
Testo core stability. |
| 3. Discovery | Define conventions and validate test coverage. | Testo’s discovery API. |
| 4. Bridge | Implement TestResolver and extend TestCase. |
Testo plugin API. |
| 5. CI/CD | Update pipelines to support Testo (e.g., testo run). |
Testo CLI stability. |
| 6. Rollout | Migrate test suites incrementally (e.g., unit → feature tests). | Phase 5 completion. |
| 7. Optimization | Tune conventions, performance, and IDE support. | Phase 6 feedback. |
Test → Spec).tests/Unit/*Test.php).How can I help you explore Laravel packages today?