-
Notifications
You must be signed in to change notification settings - Fork 20
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
test pass / fail based on other tests #153
Comments
Hm. It seems it happens because of the events tests. I have 2 event tests. If both are present the test above fails. If there is only any of them the test passes. |
I'll let you further investigate for the moment, alright? Let me know if you are blocked and if you see anything we can improve on the plugin side. |
I spent quite a time trying to figure out what happens here. The events are not related to the table tests, they are fired by a controller, not any models, so I do not know how they even connected. I used my debugger to stop at the very beginning of the failing test, and checked the database tables. It seems I have the same data there when I run only the affected test (what passes) and when I run all tests (when the affected one fails). So it seems it is not caused by some data "stucked" in the database tables. I added The affected test is the only one where I use dot notation in the InvoiceFactory::make(['partnerName' => 'Webmania'], 2)
->with('Companies', $this->company)
->with('Items.Departments.Corporates', $this->corporate)
->persist(); I guess the next step would be trying to create a failing test for you, with the plugin's test environment, right? The problem is that I did not find out how the event tests can have an effect on this one.. |
Thanks for digging! From here I cannot see where your issue could come from :-/ |
I was not able to find any connection between the factory setup and the failing test. BUT if I move the failing test method before the previous method, or after the next method all is fine... 😱 I have 15 methods in this file (+setUp and tearDown) and it only fails if it is the 6th. I can not see any logical explanation how does it happen. |
Any news here? Should I close the issue for now? |
As I can not find any other way to reproduce the issue except this clearly illogical one... If it pops up again, I will give it another try. |
I run into the same error with another small application. I tried to track down what causes the issue but I was not successful. My minimal replication app has 3 Can you take a look? I guess you will find out what I am doing wrong. I did not see any other issues from other users, so I think I miss something, but after several tries I was not able to find it. If you open to look at it I upload my code to github and write down the steps of reproduction. |
I @rrd108 , sure feel free to share your code! |
Ah great. I really appreciate. Here is the repo: https://github.com/rrd108/cakephp-fixture-factories-error
The last test fails for me with this error
What I expect to happen?
|
Did you manged to reproduce it? |
Is there anything I can help to find out what causes this? |
Runing
vendor/bin/phpunit tests/TestCase/Model
passes, but runningvendor/bin/phpunit tests/TestCase
fails.The error message is:
I have controller and event tests also. May any of them cause a table test fail? Like leaving some data in the database?
I use
TruncateDirtyTables
in the table tests, but not in the others. Should I use it? OR is not related?The text was updated successfully, but these errors were encountered: