Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#562 Remove remaining free() instances from tests #14070

Merged
merged 1 commit into from
Apr 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Civi/Test/DbTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function assertDBState($daoName, $id, $match, $delete = FALSE) {
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");
Expand Down
1 change: 0 additions & 1 deletion tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ public function testEventGeneration() {
$daoRecurEvent->id = $generatedEntities['civicrm_event'][$key];
if ($daoRecurEvent->find(TRUE)) {
$daoRecurEvent->delete();
$daoRecurEvent->free();
}

//Check if this event_id was deleted
Expand Down
2 changes: 0 additions & 2 deletions tests/phpunit/CRM/Core/DAOTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,9 @@ public function _testMemoryUsageForUnbufferedQuery() {

$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);
}
Expand Down
2 changes: 0 additions & 2 deletions tests/phpunit/CRM/Core/FieldOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ public function testHookFieldOptionsWithCustomFields() {
$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();
}

/**
Expand Down
1 change: 0 additions & 1 deletion tests/phpunit/CRM/Logging/LoggingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public function testMultilingualAlterSchemaLogging() {
$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);
Expand Down
1 change: 0 additions & 1 deletion tests/phpunit/CiviTest/CiviDBAssert.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public function assertDBState(&$testCase, $daoName, $id, $match, $delete = FALSE
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");
Expand Down
2 changes: 0 additions & 2 deletions tests/phpunit/CiviTest/CiviMailUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ public function getMostRecentEmail($type = 'raw') {
if ($dao->fetch()) {
$msg = $dao->headers . "\n\n" . $dao->body;
}
$dao->free();
}

switch ($type) {
Expand Down Expand Up @@ -198,7 +197,6 @@ public function getAllMessages($type = 'raw') {
while ($dao->fetch()) {
$msgs[] = $dao->headers . "\n\n" . $dao->body;
}
$dao->free();
}

switch ($type) {
Expand Down
4 changes: 0 additions & 4 deletions tests/phpunit/api/v3/SyntaxConformanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,6 @@ public function testLimit($entityName) {
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)
Expand All @@ -1090,7 +1089,6 @@ public function testLimit($entityName) {
foreach ($ids as $id) {
CRM_Core_DAO::deleteTestObjects($baoString, array('id' => $id));
}
$baoObj->free();
}

/**
Expand Down Expand Up @@ -1120,7 +1118,6 @@ public function testSqlOperators($entityName) {
for ($i = 0; $i < 3 - $totalEntities; $i++) {
$baoObj = CRM_Core_DAO::createTestObject($baoString, array('currency' => 'USD'));
$ids[] = $baoObj->id;
$baoObj->free();
}
$totalEntities = 3;
}
Expand Down Expand Up @@ -1558,7 +1555,6 @@ public function testCreateSingleValueAlter($entityName) {
}
}
}
$baoObj->free();
}

/* ---- testing the _getFields ---- */
Expand Down