-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Using factories in a KernelTestCase
without Factories
trait should throw
#750
Comments
Hi! that's really surprising, I've just tested and Sorry, but unless you manage to reproduce it in the Foundry's test suite, or create a public reproducer, I cannot help 🤷 |
Hi @nikophil , Thanks for your reply. I have created a test repo. Please download and install dependencies and then run ConnectionRepositoryTest.php in the tests/Repository folder. I have added working and non working creation of connection test cases. ( pref environment is ubuntu and LAMP stack) Repo |
Hi @cooldude77 the problem comes from that you're not using the I was expecting Foundry to throw an exception @kbond would you see a solution to this? We need to boot automatically Foundry for users who use it outside from the tests (for instances along with data fixtures bundle), but we should force the trait to be used as soon as we're in a PHPUnit context + |
KernelTestCase
without Factories
trait should throw
Hey @nikophil Yeah , a small change got it working . Thanks for your time. :) |
Is there an elegant way to check if foundry is being used in a test without the trait? debug_backtrace is all I can think of... |
ok then, the only relevant method I found is actually to use |
Hi ,
I have created a test class . I use foundry methods to first create and then search for the created users and create connections between them. However I see that entities that are searched are not managed. I then need to "re-search" them in order for them to become managed.
The fixture class is simple
Here are the result of debugging while testing
If I pass _real() values to the repository like below
I get the error
`
`
If I pass entities passed after finding them thru entities , then the test passes
Is there a workaround to making entities managed upon searching using Foundry method ?
Thanks and regards
Ashvini
The text was updated successfully, but these errors were encountered: