Codeception / Codeception/module-doctrine

Doctrine2 Module: Is `flush()` before checking the database so necessary?

Offen
#21 14 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
4
Forks
2
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Why do we flush managed Doctrine entities before checking the database in [`Doctrine2::proceedSeeInRepository()`](https://github.com/Codeception/Codeception/blob/bd6ad8af1fa7cd12684f0287374b9fe71a8c958a/src/Codeception/Module/Doctrine2.php#L378)?

In functional tests the Entity Manager of application is used in the Codeception Doctrine2 Module. If we do test a request with validation rejection, and we want to be sure the database was not changed, the test result will be false negative (the request fetches and populates some entity, but didn't save changes to the database, and then `dontSeeInRepository()` flushes the invalid entity to the database and does fail).

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.