You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to ensure that all our tests use the DatabaseTransactions trait in Laravel and that we are not using RefreshDatabase.
Q
A
New Feature
yes
RFC
yes/no
BC Break
no
Summary
$rules[] = Rule::allClasses()
->that(newResideInOneOfTheseNamespaces('Tests\Feature'))
->should(newHaveTrait(DatabaseTransactions::class))
->because('We want all Feature tests to run transactions');
$rules[] = Rule::allClasses()
->that(newResideInOneOfTheseNamespaces('Tests\Feature'))
->should(newNotHaveTrait(RefreshDatabase::class))
->because('We want all Feature tests to never refresh the database for performance reasons');
This should all us to be strict about the type of traits that are implemented.
I think we could also use this to enforce uuids on class (by adding HaveTrait(HasUuid::class) as a rule.
The text was updated successfully, but these errors were encountered:
Feature Request
I would like to be able to ensure that all our tests use the DatabaseTransactions trait in Laravel and that we are not using RefreshDatabase.
Summary
This should all us to be strict about the type of traits that are implemented.
I think we could also use this to enforce uuids on class (by adding HaveTrait(HasUuid::class) as a rule.
The text was updated successfully, but these errors were encountered: