Why flush is necesary on methods like grabFromRepository?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- php, symfony
- Ambito
- backend, testing-qa
Direzione di ricerca
Inizia da src/Codeception/Module/Doctrine2.php intorno al flush referenziato in grabEntitiesFromRepository, quindi segui le chiamate da tests/_support/Base/BaseActor.php alle righe 193, 164 e 405–423. Riproduci la configurazione del test funzionale e verifica quando la transazione diventa rollback-only; il lavoro è completato quando viene identificato se il flush del modulo causa il commit failure e la causa confermata viene documentata o corretta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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?
- Lingua principale
- PHP
- Stelle
- 4
- Fork
- 2
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Codeception/module-doctrine
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Codeception/module-doctrine#2 · 1 commento · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
Codeception/module-doctrine#6 · 1 commento ·
Tutte le issue di Codeception/module-doctrine
Issue simili
-
tooling
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
UX
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
ProfessionalWiki/NeoWiki#1525 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
OpenConext/OpenConext-engineblock#2122 ·
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Automattic/safe-publish#594 ·