CiviUnitTestCase - During cleanup, ensure that we have a clean slate (wrt locking)
authorTim Otten <totten@civicrm.org>
Fri, 17 Mar 2023 07:22:03 +0000 (00:22 -0700)
committerTim Otten <totten@civicrm.org>
Fri, 17 Mar 2023 07:23:02 +0000 (00:23 -0700)
tests/phpunit/CiviTest/CiviUnitTestCase.php

index 993074791491948cc7e2f91b31ea47aea09072eb..0407a3725f5a1c6fa0c32b1cbc0d908d20bfed54 100644 (file)
@@ -453,6 +453,8 @@ class CiviUnitTestCase extends PHPUnit\Framework\TestCase {
       $this->quickCleanup($tablesToTruncate);
       $this->createDomainContacts();
     }
+    $releasedLocks = CRM_Core_DAO::singleValueQuery('SELECT RELEASE_ALL_LOCKS()');
+    $this->assertEquals(0, $releasedLocks, "The test should not leave any dangling locks. Found $releasedLocks");
 
     $this->cleanTempDirs();
     $this->unsetExtensionSystem();