Skip to content

Commit

Permalink
Merge pull request #19921 from eileenmcnaughton/tear
Browse files Browse the repository at this point in the history
[PHPunit8] cleanup on setUp functions
  • Loading branch information
seamuslee001 authored Mar 27, 2021
2 parents 4a2fa5a + faba145 commit 2cd1677
Show file tree
Hide file tree
Showing 68 changed files with 54 additions and 161 deletions.
9 changes: 0 additions & 9 deletions tests/phpunit/CRM/Contact/BAO/SavedSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ class CRM_Contact_BAO_SavedSearchTest extends CiviUnitTestCase {

use CRMTraits_Custom_CustomDataTrait;

/**
* Sets up the fixture, for example, opens a network connection.
*
* This method is called before a test is executed.
*/
protected function setUp() {
parent::setUp();
}

/**
* Tears down the fixture, for example, closes a network connection.
*
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Contact/Form/Task/DeleteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CRM_Contact_Form_Task_DeleteTest extends CiviUnitTestCase {
*/
protected $deleted_contact_id;

protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->deleted_contact_id = $this->individualCreate([
'first_name' => 'Delete',
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Contact/Form/Task/EmailCommonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CRM_Contact_Form_Task_EmailCommonTest extends CiviUnitTestCase {
*
* @throws \CRM_Core_Exception
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->_contactIds = [
$this->individualCreate(['first_name' => 'Antonia', 'last_name' => 'D`souza']),
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Contact/Form/Task/PrintDocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CRM_Contact_Form_Task_PrintDocumentTest extends CiviUnitTestCase {

protected $_contactIds = NULL;

protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->_contactIds = [
$this->individualCreate(['first_name' => 'Antonia', 'last_name' => 'D`souza']),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CRM_Contact_Form_Task_PrintMailingLabelTest extends CiviUnitTestCase {

protected $_contactIds;

protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->_contactIds = [
$this->individualCreate(['first_name' => 'Antonia', 'last_name' => 'D`souza']),
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Contact/Form/Task/SMSCommonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CRM_Contact_Form_Task_SMSCommonTest extends CiviUnitTestCase {
*
* @throws \CRM_Core_Exception
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$mobile_type_id = CRM_Core_PseudoConstant::getKey('CRM_Core_DAO_Phone', 'phone_type_id', 'Mobile');
$phone_type_id = CRM_Core_PseudoConstant::getKey('CRM_Core_DAO_Phone', 'phone_type_id', 'Phone');
Expand Down
7 changes: 0 additions & 7 deletions tests/phpunit/CRM/Contact/Import/Parser/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ class CRM_Contact_Import_Parser_ContactTest extends CiviUnitTestCase {
*/
protected $entity = 'Contact';

/**
* Setup function.
*/
public function setUp() {
parent::setUp();
}

/**
* Tear down after test.
*
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Contact/Page/AjaxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CRM_Contact_Page_AjaxTest extends CiviUnitTestCase {
*/
protected $originalRequest = [];

public function setUp() {
public function setUp(): void {
$this->useTransaction(TRUE);
parent::setUp();
$this->originalRequest = $_REQUEST;
Expand Down
17 changes: 0 additions & 17 deletions tests/phpunit/CRM/Contact/Page/DedupeExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,6 @@
*/
class CRM_Contact_Page_DedupeExceptionTest extends CiviUnitTestCase {

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
parent::setUp();
}

/**
* Tears down the fixture, for example, closes a network connection.
*
* This method is called after a test is executed.
*/
protected function tearDown(): void {
parent::tearDown();
}

public function testGetDedupeExceptions() {
$contact1 = $this->individualCreate();
$contact2 = $this->individualCreate();
Expand Down
17 changes: 0 additions & 17 deletions tests/phpunit/CRM/Contact/Page/View/NoteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,6 @@
*/
class CRM_Contact_Page_View_NoteTest extends CiviUnitTestCase {

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
parent::setUp();
}

/**
* Tears down the fixture, for example, closes a network connection.
*
* This method is called after a test is executed.
*/
protected function tearDown(): void {
parent::tearDown();
}

public function testNoContactIdNote() {
$contactId = $this->individualCreate();
foreach ([1, 2, 3, 4, 5] as $noteID) {
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Contact/Page/View/UserDashBoardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CRM_Contact_Page_View_UserDashBoardTest extends CiviUnitTestCase {
/**
* Prepare for test
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->contactID = $this->createLoggedInUser();
$this->listenForPageContent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,6 @@
*/
class CRM_Contact_Page_View_UserDashboard_GroupContactTest extends CiviUnitTestCase {

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
parent::setUp();
}

/**
* Tears down the fixture, for example, closes a network connection.
*
* This method is called after a test is executed.
*/
protected function tearDown(): void {
parent::tearDown();
}

/**
* Test that the list of the contact's joined groups, on the Contact Dashboard,
* contains the correct groups.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class CRM_Contribute_Form_AdditionalPaymentTest extends CiviUnitTestCase {
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->createLoggedInUser();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
class CRM_Contribute_Form_ContributionPageTranslationTest extends CiviUnitTestCase {

public function setUp() {
public function setUp(): void {
parent::setUp();
$this->_financialTypeID = 1;
$this->enableMultilingual();
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Contribute/Form/ContributionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase {
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public function setUp() {
public function setUp(): void {
$this->_apiversion = 3;
parent::setUp();
$this->_userId = $this->createLoggedInUser();
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Contribute/Form/SearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CRM_Contribute_Form_SearchTest extends CiviUnitTestCase {
protected $_individual;
protected $_tablesToTruncate = ['civicrm_contribution', 'civicrm_line_item'];

public function setUp() {
public function setUp(): void {
parent::setUp();
$this->_individual = $this->individualCreate();
$this->ids['Contact']['contactID1'] = $this->individualCreate([], 1);
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Contribute/Page/AjaxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CRM_Contribute_Page_AjaxTest extends CiviUnitTestCase {

protected $_params = [];

public function setUp() {
public function setUp(): void {
parent::setUp();

$this->_fields = ['amount', 'sct_label'];
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/BAO/AddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CRM_Core_BAO_AddressTest extends CiviUnitTestCase {

use CRMTraits_Custom_CustomDataTrait;

public function setUp() {
public function setUp(): void {
parent::setUp();

$this->quickCleanup(['civicrm_contact', 'civicrm_address']);
Expand Down
4 changes: 0 additions & 4 deletions tests/phpunit/CRM/Core/BAO/CustomGroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
*/
class CRM_Core_BAO_CustomGroupTest extends CiviUnitTestCase {

public function setUp() {
parent::setUp();
}

/**
* Test getTree().
*/
Expand Down
6 changes: 1 addition & 5 deletions tests/phpunit/CRM/Core/BAO/CustomValueTableMultipleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
*/
class CRM_Core_BAO_CustomValueTableMultipleTest extends CiviUnitTestCase {

public function setUp() {
parent::setUp();
}

public function testCustomGroupMultipleSingle() {
public function testCustomGroupMultipleSingle(): void {
$contactID = $this->individualCreate();
$customGroup = $this->customGroupCreate(['is_multiple' => 1]);
$fields = [
Expand Down
4 changes: 0 additions & 4 deletions tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
*/
class CRM_Core_BAO_CustomValueTableSetGetTest extends CiviUnitTestCase {

public function setUp() {
parent::setUp();
}

/**
* Test setValues() and GetValues() methods with custom Date field
*
Expand Down
4 changes: 0 additions & 4 deletions tests/phpunit/CRM/Core/BAO/CustomValueTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
*/
class CRM_Core_BAO_CustomValueTableTest extends CiviUnitTestCase {

public function setUp() {
parent::setUp();
}

/**
* Test store function for country.
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/BAO/EmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class CRM_Core_BAO_EmailTest extends CiviUnitTestCase {
*
* @throws \CRM_Core_Exception
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->quickCleanup(['civicrm_contact', 'civicrm_email']);
}
Expand Down
4 changes: 0 additions & 4 deletions tests/phpunit/CRM/Core/BAO/FinancialTrxnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
*/
class CRM_Core_BAO_FinancialTrxnTest extends CiviUnitTestCase {

public function setUp() {
parent::setUp();
}

/**
* Check method create().
*
Expand Down
4 changes: 0 additions & 4 deletions tests/phpunit/CRM/Core/BAO/IMTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
*/
class CRM_Core_BAO_IMTest extends CiviUnitTestCase {

public function setUp() {
parent::setUp();
}

/**
* Create() method (create and update modes)
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/BAO/LocationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
class CRM_Core_BAO_LocationTest extends CiviUnitTestCase {

public function setUp() {
public function setUp(): void {
parent::setUp();

$this->quickCleanup([
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/BAO/NavigationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class CRM_Core_BAO_NavigationTest extends CiviUnitTestCase {
*
* Here we ensure we are starting from a default report navigation.
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
CRM_Core_BAO_Navigation::rebuildReportsNavigation(CRM_Core_Config::domainID());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/BAO/OptionGroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CRM_Core_BAO_OptionGroupTest extends CiviUnitTestCase {
/**
* Test setup for every test.
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->useTransaction(TRUE);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/BAO/OptionValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CRM_Core_BAO_OptionValueTest extends CiviUnitTestCase {
/**
* Test setup for every test.
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->useTransaction(TRUE);
}
Expand Down
4 changes: 0 additions & 4 deletions tests/phpunit/CRM/Core/BAO/PhoneTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
*/
class CRM_Core_BAO_PhoneTest extends CiviUnitTestCase {

public function setUp() {
parent::setUp();
}

/**
* Add() method (create and update modes)
*/
Expand Down
4 changes: 0 additions & 4 deletions tests/phpunit/CRM/Core/BAO/PreferencesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
*/
class CRM_Core_BAO_PreferencesTest extends CiviUnitTestCase {

public function setUp() {
parent::setUp();
}

public function testValueOptions() {

$addressOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/BAO/SettingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CRM_Core_BAO_SettingTest extends CiviUnitTestCase {
*/
private $origSetting;

public function setUp() {
public function setUp(): void {
parent::setUp();
global $civicrm_setting;
$this->origSetting = $civicrm_setting;
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/BAO/UFFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
class CRM_Core_BAO_UFFieldTest extends CiviUnitTestCase {

public function setUp() {
public function setUp(): void {
parent::setUp();

$this->quickCleanup(['civicrm_uf_group', 'civicrm_uf_field']);
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/CommunityMessagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static function initWebResponses() {
return self::$webResponses;
}

public function setUp() {
public function setUp(): void {
parent::setUp();
$this->cache = new CRM_Utils_Cache_Arraycache([]);
self::initWebResponses();
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/Config/MailerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CRM_Core_Config_MailerTest extends CiviUnitTestCase {
*/
public $calls;

public function setUp() {
public function setUp(): void {
$this->calls = [
'civicrm_alterMailer' => 0,
'send' => 0,
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/ErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
class CRM_Core_ErrorTest extends CiviUnitTestCase {

public function setUp() {
public function setUp(): void {
parent::setUp();
$config = CRM_Core_Config::singleton();
$this->oldConfigAndLogDir = $config->configAndLogDir;
Expand Down
Loading

0 comments on commit 2cd1677

Please sign in to comment.