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
Inconsistent Results between find
and grabFromDatabase
#6682
Comments
Clasyc
changed the title
Inconsistent Results between
Inconsistent Results between Aug 5, 2023
find
and grabFromDatabase
in Codeception 4 & 5find
and grabFromDatabase
For now I'm using a workaround to clear EntityManager after each test: public function clearEntityManager(): void
{
$this->getModule('Symfony')->kernel->getContainer()->get('doctrine')->getManager('db2')->clear();
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What are you trying to achieve?
I am attempting to receive an entity with the most recent data written on the API test, but I'm encountering incorrect or inconsistent results between
find
andgrabFromDatabase
.I expect to see the same
$path
property value on the File entity in my tests, whether I access it through the entity object or perform a direct check on the database. The strangest part is that this failure only happens when I run all 150 or so of my tests, which are not related in any way and has no parallel running tests. If I run only some similar tests from a single directory (around 30 test), they all pass as they should. It's worth noting that these tests have been working fine for a long time without any issues. However, after some recent minor updates in the composer, they began to fail.Originally, I was using Codeception 4 and thought this might be a bug, so I upgraded to Codeception 5 and all related modules. However, the problem persists.
I've checked the database after the failing test and data is correct, but Doctrine returns invalid data from previous tests.
This peculiar behavior has been observed throughout our project for some time, but in one way or another, we decided not to mix Doctrine and Codeception database methods. However, we are now in a situation where we need to use both. What are possible reasons for this?
What do you get instead?
In the example above, when I print out
$file->path
and$path
, I see different results.$file->path
contains incorrect data, which appears to be from earlier similar tests that ran before this one. I am perplexed as to how this could be possible. I have been debugging this for hours without any clear reason for this occurrence. Could it be that I am not supposed to usegrabFromDatabase
and Doctrine repository in a single test?Details
composer show
)The text was updated successfully, but these errors were encountered: