-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: throw an error if Factories trait is not used in a KernelTestCase #766
base: 2.x
Are you sure you want to change the base?
feat: throw an error if Factories trait is not used in a KernelTestCase #766
Conversation
8fa82b8
to
b28e7cb
Compare
b28e7cb
to
05cef62
Compare
|
||
final class KernelTestCaseWithBothTraitsInWrongOrderTest extends KernelTestCase | ||
{ | ||
use ResetDatabase, Factories; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in my different tests, I noticed that sometimes, the order of these traits could have an impact, so I wanted to test with both cases
$_ENV['KERNEL_CLASS'] = 'Zenstruck\Foundry\Tests\Fixture\TestKernel'; | ||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = __DIR__ . '/../../Fixture/ForceFactoriesTraitUsage/KernelTestCaseWithOnlyResetDatabaseTraitTest.php'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for this specific case, where only the ResetDatabase
trait is used, the error occurs during the "before test class" hook, so the error cannot be caught in a regular test . Hence this low level ".phpt" test
@kbond I think I won't throw directly an error, but add a deprecation instead: Foundry kinda works without the trait in few situations... |
fixes #750