Why flush is necesary on methods like grabFromRepository?
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 领域
- backend, testing-qa
调研方向
从 src/Codeception/Module/Doctrine2.php 中 grabEntitiesFromRepository 所引用的 flush 附近开始,然后跟踪 tests/_support/Base/BaseActor.php 第 193、164 和 405–423 行的调用。复现功能测试设置,并检查事务何时变为 rollback-only;完成的标准是确定模块 flush 是否导致 commit failure,并记录或修复已确认的原因。
由索引模型根据 Issue 内容生成。
描述
I have configured Doctrine2 and Symfony modules as follow:
modules:
enabled:
- Symfony:
app_path: 'src'
environment: 'test'
- Doctrine2:
depends: Symfony
cleanup: true
and I have created a helper to be used as part of my Functional tests as follow (snippet with relevant parts only):
public function grabWorkableEntityForCase(int $schemeID = CcType::VISA, ?int $cId = null): Cases
{
/** @var Cases $caseEntity */
$caseEntity = $this->grabEntityFromRepository(Cases::class, [
'ccType' => $schemeID,
(new Criteria())->orderBy(['id' => Criteria::DESC])->setMaxResults(1)
]);
// If we need an specific Case just override the previous value
if (null !== $cId) {
$caseEntity = $this->grabEntityFromRepository(Cases::class, ['id' => $cId]);
}
// Unlock it
$caseEntity->removeLock();
//Grab dispute cycle RFI
$disputeCycle = $this->grabEntityFromRepository(DisputeCycle::class, ['id' => DisputeCycle::RETRIEVAL]);
$functionalCode = $this->grabEntityFromRepository(FunctionCode::class, [
'disputeCycle' => $disputeCycle,
(new Criteria())->orderBy(['id' => Criteria::DESC])->setMaxResults(1)
]);
// And assigned to a worker if need be otherwise use always a random user
if (null !== $userID) {
$user = $this->grabEntityFromRepository(User::class, ['id' => $userID]);
} else {
$user = $this->grabWorkableUserEntity();
}
$caseEntity->setUser($user);
$this->haveInRepository($caseEntity);
return $caseEntity;
}
from my test the code above is being called as:
public function _before(FunctionalTester $I)
{
$this->user = $I->grabWorkableUserEntity();
$this->case = $I->grabWorkableEntityForCase();
$I->flushAllTables(false, $this->case->getId());
}
But I end up with the following error:
1) WriteOffOutcomeFunctionalCest: Will record and send fee collection
Test tests/functional/FullWriteOffOutcomeFunctionalCest.php:willRecordAndSendFeeCollection
[Doctrine\DBAL\ConnectionException] Transaction commit failed because the transaction has been marked for rollback only.
Scenario Steps:
15. $I->grabEntityFromRepository("App\Entity\DisputeCycle",{"id":1}) at tests/_support/Base/BaseActor.php:193
14. $I->grabEntityFromRepository("App\Entity\Cases",{"ccType":1,"0":"Doctrine\\Common\\Collections\\Criteria"}) at tests/_support/Base/BaseActor.php:164
13. $I->emptyTable("App\Entity\StatusHist",38613) at tests/_support/Base/BaseActor.php:405
12. $I->emptyTable("App\Entity\ProcessingOutcome",38613) at tests/_support/Base/BaseActor.php:387
11. $I->emptyTable("App\Entity\DisputeResponse",38613) at tests/_support/Base/BaseActor.php:396
10. $I->emptyTable("App\Entity\EventsHistory",38613) at tests/_support/Base/BaseActor.php:423
from the error above lines 193 is:
$disputeCycle = $this->grabEntityFromRepository(DisputeCycle::class, ['id' => DisputeCycle::RETRIEVAL]);
I am not sure if the flush inside grabEntitiesFromRepository method is what is causing this or what could be the reason of it, true story is that I have been trying to debug this for hours without success so any help is more than welcome. What I am a missing here?
- 主要语言
- PHP
- 星标
- 4
- 派生
- 2
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Codeception/module-doctrine 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 38/100
-
难度 4/5 3-5 天 新手友好度 30/100
-
难度 4/5 3-5 天 新手友好度 35/100
Codeception/module-doctrine#2 · 1 条评论 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 42/100
-
难度 3/5 1-2 天 新手友好度 64/100
Codeception/module-doctrine#6 · 1 条评论 ·
查看 Codeception/module-doctrine 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
Do not throw `WordPress.Security.EscapeOutput.OutputNotEscaped` on `apply_shortcodes()`可能已有人在做 @tbradsha 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 62/100
landsman/adminer-desktop#120 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
components-web-app/docs#227 ·
-
难度 1/5 1 小时以内 新手友好度 85/100