You need to sign in or sign up before continuing.
Minimal approach with shutdown function
2 unresolved threads
Closed
requested to merge issue/drupal-3405976:3405976-minimal-approach-shutdown-functions into 11.x
2 unresolved threads
Closes #3405976
Merge request reports
Activity
added 1 commit
- e817373b - Make testTransactionManagerFailureOnPendingStackItems meaningful again
added 34 commits
-
e817373b...b5dab51f - 32 commits from branch
project:11.x
- 05c80a5f - Merge branch '11.x' into 3405976-minimal-approach-shutdown-functions
- 85ee74c5 - Use shutdown in the transaction object
-
e817373b...b5dab51f - 32 commits from branch
- Resolved by Alex Pott
753 * 754 * If drupal_register_shutdown_function() exists the commit will occur during 755 * shutdown so that it occurs at the latest possible moment. 756 * 757 * @param bool $shutdown 758 * Internal param to denote that the method is being called by 759 * _drupal_shutdown_function(). 760 * 761 * @return void 762 * 763 * @internal 764 * This method exists only to work around a bug caused by Drupal incorrectly 765 * relying on object destruction order to commit transactions. Xdebug 3.3.0 766 * changes the order of object destruction when the develop mode is enabled. 767 */ 768 public static function commitAllOnShutdown(bool $shutdown = FALSE): void { 812 $manager = $testConnection->transactionManager(); 813 $reflectionMethod = new \ReflectionMethod($manager, 'addStackItem'); 814 $reflectionMethod->invoke($manager, 'bar', new StackItem('qux', StackItemType::Root)); 815 // Ensure transaction state can be determined during object destruction. 816 // This is necessary for the test to pass when xdebug.mode has the 'develop' 817 // option enabled. 818 $reflectionProperty = new \ReflectionProperty(TransactionManagerBase::class, 'connectionTransactionState'); 819 $reflectionProperty->setValue($manager, ClientConnectionTransactionState::Active); 812 820 813 821 $this->expectException(\AssertionError::class); 814 822 $this->expectExceptionMessageMatches("/^Transaction .stack was not empty\\. Active stack: bar\\\\qux/"); 823 // Ensure that __destruct() results in an assertion error. Note that this 824 // will normally be called by PHP during the object's destruction but Drupal 825 // will commit all transactions when a database is closed thereby making 826 // this impossible to test unless it is called directly. 827 $manager->__destruct();
Please register or sign in to reply