Skip to content
Snippets Groups Projects
Commit df0d8ea5 authored by catch's avatar catch
Browse files

Issue #3405976 by alexpott, jrglasgow, fago, catch, mondrake, solideogloria,...

Issue #3405976 by alexpott, jrglasgow, fago, catch, mondrake, solideogloria, mglaman, Driskell, derickr, longwave, Mile23, YesCT, daffie: Transaction autocommit during shutdown relies on unreliable object destruction order (xdebug 3.3+ enabled)
parent 44c345dd
No related branches found
No related tags found
No related merge requests found
......@@ -818,15 +818,21 @@ public function testTransactionManagerFailureOnPendingStackItems(): void {
$reflectionProperty = new \ReflectionProperty(TransactionManagerBase::class, 'connectionTransactionState');
$reflectionProperty->setValue($manager, ClientConnectionTransactionState::Active);
$this->expectException(\AssertionError::class);
$this->expectExceptionMessageMatches("/^Transaction .stack was not empty\\. Active stack: bar\\\\qux/");
// Ensure that __destruct() results in an assertion error. Note that this
// will normally be called by PHP during the object's destruction but Drupal
// will commit all transactions when a database is closed thereby making
// this impossible to test unless it is called directly.
$manager->__destruct();
try {
$manager->__destruct();
$this->fail("Expected AssertionError error not thrown");
}
catch (\AssertionError $e) {
$this->assertStringStartsWith('Transaction $stack was not empty. Active stack: bar\\qux', $e->getMessage());
}
// Clean up.
$reflectionProperty = new \ReflectionProperty(TransactionManagerBase::class, 'stack');
$reflectionProperty->setValue($manager, []);
unset($testConnection);
Database::closeConnection('test_fail');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment