Codeception / Codeception/module-db

Make optional the auto-erase of the records, added by `haveInDatabase()`

オープン
#68 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
PHP
スター
23
フォーク
31
PR マージ指標
30日以内にマージされた PR はありません

説明

#### Problem
Currently, all records, added by `haveInDatabase()` method during test, are automatically removed after the end of the test.
Although this is a documented behaviour, for me it adds more confusion than profit.

In case when I need all the changes, made during test, to disappear after the test, I can't rely solely on this behaviour, because changes may be done not only by `haveInDatabase()`. So I still need to use other things for keeping tests isolated (wrapping tests in transactions, or to re-populate database from dump before each test, etc).

And in other case, when I do not need tests isolation, I am ok with the fact that each test changes something in database, so auto-erasing some records only adds confusion for me.

So, I'd like to be able to turn this behaviour off in my tests.

Currently we have a `skip_cleanup_if_failed` configuration parameter, but it does not give full control over the auto-erase, because allows to omit it only when tests fail (which should be the default behaviour, IMHO). Also, its name is confusing (see [issue #67](https://github.com/Codeception/module-db/issues/67)).

#### Proposed solution
Let's add another boolean configuration parameter, responsible for this auto-erase. For example, `auto_erase`, or `cleanup` (could be used after renaming current `cleanup` to `repopulate` - see [issue #67](https://github.com/Codeception/module-db/issues/67))

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。