Pros:
belongsTo, hasMany) and scopes, reducing boilerplate in test suites.Cons:
array<mixed>, generics), which could complicate adoption in new codebases.mockery/mockery (v1.x). May conflict with Laravel’s built-in PHPUnit or pestphp/pest if not managed via replace in composer.json.where clauses, macros, or relationship methods). The package may need patches for Laravel 10+.assertSame behavior). Tests using this package may require updates.observers, model observers) or API resources.laravel/mockable for future-proofing?refreshDatabase) are prioritized over unit tests.User model with hasMany/belongsTo relationships).EloquentTestsuite utilities.mockery/mockery is pinned to a stable version).hasMany or belongsTo, the package’s mocking logic may need updates.spatie/laravel-activitylog, stanclabs/tenancy).assertSame vs. assertEquals).composer.json and configure PHPUnit to use Mockery.composer.json snippet:
"require-dev": {
"sofa/eloquent-testsuite": "^1.0",
"mockery/mockery": "^1.6"
},
"config": {
"preferred-install": "dist",
"allow-plugins": {
"phpunit/phpunit": true
}
}
phpunit.xml to enable Mockery:
<phpunit>
<extensions>
<extension class="Mockery\Adapter\Phpunit\MockeryTestCase"/>
</extensions>
</phpunit>
EloquentTestsuite traits (e.g., createRelationMock, assertRelation).// Before: Manual mocking
$user = Mockery::mock(User::class);
$user->shouldReceive('organization')->andReturn($orgMock);
// After: EloquentTestsuite
$user = $this->createRelationMock(User::class, 'belongsTo', Organization::class);
$this->assertRelation('belongsTo', $user->organization());
assertScopeFilters or similar utilities.mockery/mockery updates (though Mockery is stable).How can I help you explore Laravel packages today?