From ce0e374d84665931aff2607714dc31bffa7b21f1 Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 17 Apr 2019 06:57:56 +1000 Subject: [PATCH] Remove remaining free() instances from tests --- Civi/Test/DbTestTrait.php | 2 +- tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php | 1 - tests/phpunit/CRM/Core/DAOTest.php | 2 -- tests/phpunit/CRM/Core/FieldOptionsTest.php | 2 -- tests/phpunit/CRM/Logging/LoggingTest.php | 1 - tests/phpunit/CiviTest/CiviDBAssert.php | 1 - tests/phpunit/CiviTest/CiviMailUtils.php | 2 -- tests/phpunit/api/v3/SyntaxConformanceTest.php | 4 ---- 8 files changed, 1 insertion(+), 14 deletions(-) diff --git a/Civi/Test/DbTestTrait.php b/Civi/Test/DbTestTrait.php index e8f7209e79..06b5e60b3c 100644 --- a/Civi/Test/DbTestTrait.php +++ b/Civi/Test/DbTestTrait.php @@ -64,7 +64,7 @@ trait DbTestTrait { else { $this->fail("Could not retrieve object: $daoName, $id"); } - $object->free(); + $matchSize = count($match); if ($verifiedCount != $matchSize) { $this->fail("Did not verify all fields in match array: $daoName, $id. Verified count = $verifiedCount. Match array size = $matchSize"); diff --git a/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php b/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php index 199d46873e..7452e2cab1 100644 --- a/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php +++ b/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php @@ -298,7 +298,6 @@ class CRM_Core_BAO_RecurringEntityTest extends CiviUnitTestCase { $daoRecurEvent->id = $generatedEntities['civicrm_event'][$key]; if ($daoRecurEvent->find(TRUE)) { $daoRecurEvent->delete(); - $daoRecurEvent->free(); } //Check if this event_id was deleted diff --git a/tests/phpunit/CRM/Core/DAOTest.php b/tests/phpunit/CRM/Core/DAOTest.php index 397e54ec12..e2bae8e16d 100644 --- a/tests/phpunit/CRM/Core/DAOTest.php +++ b/tests/phpunit/CRM/Core/DAOTest.php @@ -373,11 +373,9 @@ class CRM_Core_DAOTest extends CiviUnitTestCase { $dao = CRM_Core_DAO::executeQuery($sql); $contactsFetchedFromBufferedQuery = $dao->fetchAll(); - $dao->free(); $dao = CRM_Core_DAO::executeUnbufferedQuery($sql); $contactsFetchedFromUnbufferedQuery = $dao->fetchAll(); - $dao->free(); $this->checkArrayEquals($contactsFetchedFromBufferedQuery, $contactsFetchedFromUnbufferedQuery); } diff --git a/tests/phpunit/CRM/Core/FieldOptionsTest.php b/tests/phpunit/CRM/Core/FieldOptionsTest.php index b0e8370c98..8ac635e529 100644 --- a/tests/phpunit/CRM/Core/FieldOptionsTest.php +++ b/tests/phpunit/CRM/Core/FieldOptionsTest.php @@ -204,8 +204,6 @@ class CRM_Core_FieldOptionsTest extends CiviUnitTestCase { $this->appendOptions = array(2 => 'Maybe'); $options = CRM_Core_PseudoConstant::get('CRM_Core_BAO_CustomField', $this->targetField); $this->assertEquals(array(1 => 'Yes', 0 => 'No', 2 => 'Maybe'), $options); - - $field->free(); } /** diff --git a/tests/phpunit/CRM/Logging/LoggingTest.php b/tests/phpunit/CRM/Logging/LoggingTest.php index 880cddb22f..62d2423201 100644 --- a/tests/phpunit/CRM/Logging/LoggingTest.php +++ b/tests/phpunit/CRM/Logging/LoggingTest.php @@ -46,7 +46,6 @@ class CRM_Logging_LoggingTest extends CiviUnitTestCase { $logging->fixSchemaDifferencesFor('civicrm_option_value', array(), TRUE); $query = CRM_Core_DAO::executeQuery("SHOW CREATE TABLE `log_civicrm_option_value`", array(), TRUE, NULL, FALSE, FALSE); $query->fetch(); - $query->free(); $create = explode("\n", $query->Create_Table); $this->assertTrue(in_array(" `logging_test` int(11) DEFAULT '0'", $create)); $create = explode("\n", $query->Create_Table); diff --git a/tests/phpunit/CiviTest/CiviDBAssert.php b/tests/phpunit/CiviTest/CiviDBAssert.php index 3289859185..8496f9d3ad 100644 --- a/tests/phpunit/CiviTest/CiviDBAssert.php +++ b/tests/phpunit/CiviTest/CiviDBAssert.php @@ -86,7 +86,6 @@ class CiviDBAssert { else { $testCase->fail("Could not retrieve object: $daoName, $id"); } - $object->free(); $matchSize = count($match); if ($verifiedCount != $matchSize) { $testCase->fail("Did not verify all fields in match array: $daoName, $id. Verified count = $verifiedCount. Match array size = $matchSize"); diff --git a/tests/phpunit/CiviTest/CiviMailUtils.php b/tests/phpunit/CiviTest/CiviMailUtils.php index a9ee7da7a0..fd1f66599d 100644 --- a/tests/phpunit/CiviTest/CiviMailUtils.php +++ b/tests/phpunit/CiviTest/CiviMailUtils.php @@ -165,7 +165,6 @@ class CiviMailUtils extends PHPUnit_Framework_TestCase { if ($dao->fetch()) { $msg = $dao->headers . "\n\n" . $dao->body; } - $dao->free(); } switch ($type) { @@ -198,7 +197,6 @@ class CiviMailUtils extends PHPUnit_Framework_TestCase { while ($dao->fetch()) { $msgs[] = $dao->headers . "\n\n" . $dao->body; } - $dao->free(); } switch ($type) { diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 76d31f0015..8880c0c15d 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -1073,7 +1073,6 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { for ($i = 0; $i < 30; $i++) { $baoObj = CRM_Core_DAO::createTestObject($baoString, array('currency' => 'USD')); $ids[] = $baoObj->id; - $baoObj->free(); } // each case is array(0 => $inputtedApiOptions, 1 => $expectedResultCount) @@ -1090,7 +1089,6 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { foreach ($ids as $id) { CRM_Core_DAO::deleteTestObjects($baoString, array('id' => $id)); } - $baoObj->free(); } /** @@ -1120,7 +1118,6 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { for ($i = 0; $i < 3 - $totalEntities; $i++) { $baoObj = CRM_Core_DAO::createTestObject($baoString, array('currency' => 'USD')); $ids[] = $baoObj->id; - $baoObj->free(); } $totalEntities = 3; } @@ -1558,7 +1555,6 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { } } } - $baoObj->free(); } /* ---- testing the _getFields ---- */ -- 2.25.1