CRM-17860 - CiviUnitTestCase::_populateDB() - Guard against accidental destruction
authorTim Otten <totten@civicrm.org>
Fri, 22 Jan 2016 11:26:39 +0000 (03:26 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 2 Feb 2016 04:56:23 +0000 (21:56 -0700)
tests/phpunit/CiviTest/CiviUnitTestCase.php

index c952af0dfb4cbb4949a1a9d464170834720b3a2d..ee73850bb338c07b693be7eff2c919984e2cd150 100755 (executable)
@@ -249,6 +249,9 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
    *   TRUE if the populate logic runs; FALSE if it is skipped
    */
   protected static function _populateDB($perClass = FALSE, &$object = NULL) {
+    if (CIVICRM_UF !== 'UnitTests') {
+      throw new \RuntimeException("_populateDB requirs CIVICRM_UF=UnitTests");
+    }
 
     if ($perClass || $object == NULL) {
       $dbreset = TRUE;