testo/data
Testo Data provider plugin: parameterize one test into many dataset-driven runs. Supports inline tuples, named datasets, cartesian product (cross), zipped iteration, and unions across multiple sources. Install via composer require --dev testo/data.
DatabaseTransactions, HttpTestCase) may not translate seamlessly.@with or PHPUnit’s DataProvider).Data::fromEloquent()).create(), assertDatabaseHas(), or RefreshDatabase. Would need custom extensions or duplicated logic.phpunit.xml). Requires configuration updates.testo/data package is a mirror repo, meaning all issues/PRs must go to the monorepo, which could introduce friction.DataProvider or Pest’s @with.phpunit.xml, GitHub Actions)?@dataProvider is cumbersome (e.g., testing edge cases with multiple input combinations).HttpTestCase, RefreshDatabase) are heavily relied upon.Phase 1: Evaluation (Low Risk)
testo/data in a dev dependency:
composer require --dev php-testo/testo testo/data
testo --help to explore CLI options.Phase 2: Hybrid Integration (Medium Risk)
# tests/Testo/
# tests/PHPUnit/
// src/Testo/Data/LaravelDataProvider.php
namespace App\Testo\Data;
use Testo\Data\Data;
use Illuminate\Database\Eloquent\Model;
class LaravelDataProvider {
public static function fromEloquent(string $modelClass, array $attributes): Data {
return Data::fromArray(array_map(
fn($attrs) => [$modelClass::newModelInstance()->fill($attrs)],
$attributes
));
}
}
use App\Testo\Data\LaravelDataProvider;
use Testo\Testo;
Testo::describe('User model', function () {
LaravelDataProvider::fromEloquent(User::class, [
['name' => 'John', 'email' => 'john@example.com'],
['name' => 'Jane', 'email' => 'jane@example.com'],
])->it('should validate email', function (User $user) {
$user->validate();
});
});
Phase 3: Full Adoption (High Risk, Optional)
composer.json to remove PHPUnit/Pest and configure Testo as the default runner.# .github/workflows/tests.yml
- name: Run Testo tests
run: vendor/bin/testo --config=testo.php --filter="not @skip"
Tests/Unit/Testo/ vs. Tests/Unit/PHPUnit/).RefreshDatabase. Workaround:
// Custom Testo extension
Testo::beforeEach(function () {
\Illuminate\Support\Facades\DB::transaction(...);
});
Testo\Http, ensure it supports Laravel’s HttpTestCase features (e.g., route aliases, middleware).testo.php config:
return [
'filter' => env('TEST_FILTER', 'not @skip'),
'reporter' => 'junit', // For GitHub Actions
];
| Step | Task | Dependencies | Risk | Owner |
|---|---|---|---|---|
| 1 | Install Testo + testo/data |
Composer access | Low | DevOps |
| 2 | Rewrite 1-2 test suites |
How can I help you explore Laravel packages today?