Unit test problem in a ViewRecord resource
I'm trying to implement unit tests on a custom ViewRecord page that I created for my Order resource. I cannot understand why, but Filament is unable to retrieve the model I just created in my tests. It's not consistent, but my tests fail one time out of two...
Here an exemple of one test :
It fails if I run
vendor/bin/pest
from my terminal.
If I run the test directly from PHPStorm, it works... Do you know where this might be coming from?
Thank you for your help ๐

9 Replies
If I run the test directly from PHPStorm, it works... Do you know where this might be coming from?What's the exact command you run? Maybe it's the difference in the Test Runner config in PHPStorm
From my terminal I run
vendor\bin\pest
And from PHPStorm I can see this in the console when I click on the play button :
I use the Pest Plugin ๐
If I click on the button to run all the tests in the file, it fails, but if I run each function one after the other, it works.
Is it maybe a side effect from another test? If you add
->only()
to your test and run vendor/bin/pest
again?Hm... Interesting...
If I click to the PHPStorm play button on my test file : test fail (first screen).
From terminal : it passes.
I don't get it ๐คฃ


Can you use the exact same command? Is it the
--configuration
?Ok if I copy/past the command from PHPStorm to my terminal and I also have a passed test ๐
So... Maybe something with the PHPUnit ? I've the same problem on GitHub with my action.

Here my action on Github :
Ok if I copy/past the command from PHPStorm to my terminal and I also have a passed test ๐Hm, this is weird then.
Yeah... I don't understand why. All the other tests on my resources are working... The retrieval of orders is problematic, but I cannot quite grasp why... The error on GitHub is also the same.
Is there a specific configuration required for the database?
