Codeception / Codeception/module-doctrine

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

未关闭
#21 14 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
PHP
星标
4
派生
2
PR 合并指标
30 天内没有已合并 PR

描述

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).

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 src/Codeception/Module/Doctrine2.php 中的 Doctrine2::proceedSeeInRepository() 开始,尤其检查数据库检查之前的 flush。查看 issue 的验证拒绝场景和现有模块测试,然后验证检查 repository 内容不会持久化已获取的或无效的受管理实体更改;相关测试应在没有假阴性的情况下通过。

由索引模型根据 Issue 内容生成。

评估

技术栈
php
领域
databases, testing
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。