Skip to content
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

Doctrine2 module and option cleanup does not work #25

Open
ihorsamusenko opened this issue Jun 17, 2016 · 3 comments
Open

Doctrine2 module and option cleanup does not work #25

ihorsamusenko opened this issue Jun 17, 2016 · 3 comments

Comments

@ihorsamusenko
Copy link
Contributor

I have a functional cest test.
In __before() I create some entities and I assume they will be deleted during __after(), but it does not happen.
I dig a little and found that in Codeception\Module\Doctrine2 line 174 there is a PDO exception says "There is no active transaction". And when my second test is ran I entities from first test are still exist

@vyarmolenko
Copy link

You experience this issue because the Doctrine service is persisted between tests in a cest. It is the default behaviour. You need to make helper method for cleaning the db between tests and call it in _after(). Please see example solution in Codeception/Codeception#2042 (comment).

I'll prepare an update for Doctrine2 module to include that functionality as it may be widely used in tests.

@DavertMik
Copy link
Member

Thanks @vyarmolenko will be waiting for your PR!

@DavertMik DavertMik reopened this Jun 27, 2016
@szymach
Copy link

szymach commented Jun 14, 2017

Hey, I have recently ran into this issue, but differently. The thing is, the problem only occurred for me with this config:

actor: FunctionalTester
modules:
    enabled:
        - Symfony:
            app_path: 'app'
            var_path: 'var'
            environment: 'test'
        - Doctrine2:
            depends: Symfony2 
        - \Helper\Functional

Switching the dependent module for Doctrine2 to Symfony makes it work all OK. I know this is due to me using the wrong module, but it does not break for Symfony2 and the documentation does not make it clear on which one to use.

@Naktibalda Naktibalda transferred this issue from Codeception/Codeception Jan 17, 2021
@TavoNiievez TavoNiievez transferred this issue from Codeception/module-doctrine2 Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants