Codeception / Codeception/module-doctrine

"The EntityManager is closed" with Symfony and Doctrine2 modules

Open
#19 11 comments 6 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
4
Forks
2
PR merge metrics
No merged PRs in 30d

Description

#### What are you trying to achieve?

Use the Symfony and Doctrine2 modules together, to allow "cleanup" by reversing transactions between tests, in functional tests against an SQLite database.

#### What do you get instead?

Many tests are simply failing with

```bash
[Doctrine\ORM\ORMException] The EntityManager is closed.
```
If I do not enable the Doctrine2 module, the tests all succeed. But without it enabled, the transactions are not implemented and reversed between tests.

functional.suite.yml is as follows

```yml
class_name: FunctionalTester
modules:
enabled:
- \Helper\Functional
- Asserts
- Cli
- Filesystem
- REST
- Symfony:
environment: test
var_path: 'var'
- Doctrine2:
depends: Symfony
cleanup: true
```
### Details

* Codeception version: 2.4.5
* PHP Version: 7.2
* Operating System: Linux Mint
* Installation type: Composer

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure with functional.suite.yml, Symfony in the test environment, and Doctrine2 with cleanup enabled against SQLite. Trace the interaction between transaction cleanup and the closed EntityManager; done means the functional tests pass with transactions reversed between tests and without the exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
database, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.