Skip to content

Commit

Permalink
[PHPunit8] cleanup on tearDown functions
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Mar 26, 2021
1 parent 1f4a00a commit 5d34586
Show file tree
Hide file tree
Showing 103 changed files with 91 additions and 252 deletions.
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/ACL/ListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CRM_ACL_ListTest extends CiviUnitTestCase {
/**
* Set up function.
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
// $this->quickCleanup(array('civicrm_acl_contact_cache'), TRUE);
$this->useTransaction(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Activity/BAO/ActivityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CRM_Activity_BAO_ActivityTest extends CiviUnitTestCase {
*
* @throws \CiviCRM_API3_Exception
*/
public function setUp() {
public function setUp():void {
parent::setUp();
$this->prepareForACLs();
CRM_Core_Config::singleton()->userPermissionClass->permissions = ['view all contacts', 'access CiviCRM'];
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Activity/Form/ActivityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
class CRM_Activity_Form_ActivityTest extends CiviUnitTestCase {

public function setUp() {
public function setUp():void {
parent::setUp();
$this->assignee1 = $this->individualCreate([
'first_name' => 'testassignee1',
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Activity/Form/SearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
class CRM_Activity_Form_SearchTest extends CiviUnitTestCase {

public function setUp() {
public function setUp(): void {
parent::setUp();
$this->individualID = $this->individualCreate();
$this->contributionCreate([
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Activity/Page/AJAXTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
class CRM_Activity_Page_AJAXTest extends CiviUnitTestCase {

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

$this->loadAllFixtures();
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Batch/Form/EntryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase {
*/
protected $_contactID4 = NULL;

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

$params = [
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Case/BAO/CaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
class CRM_Case_BAO_CaseTest extends CiviUnitTestCase {

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

$this->tablesToTruncate = [
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Case/BAO/CaseTypeForkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
class CRM_Case_BAO_CaseTypeForkTest extends CiviCaseTestCase {

public function setUp() {
public function setUp(): void {
parent::setUp();
CRM_Core_ManagedEntities::singleton(TRUE)->reconcile();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Case/Form/CustomDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CRM_Case_Form_CustomDataTest extends CiviCaseTestCase {

protected $custom_group;

public function setUp() {
public function setUp(): void {
parent::setUp();
$this->custom_group = $this->customGroupCreate(['extends' => 'Case']);
$this->custom_group = $this->custom_group['values'][$this->custom_group['id']];
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Case/Form/SearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
class CRM_Case_Form_SearchTest extends CiviCaseTestCase {

public function setUp() {
public function setUp():void {
parent::setUp();
$this->quickCleanup(['civicrm_case_contact', 'civicrm_case', 'civicrm_contact']);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Case/XMLProcessor/ProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
class CRM_Case_XMLProcessor_ProcessTest extends CiviCaseTestCase {

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

$this->defaultAssigneeOptionsValues = [];
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Case/XMLProcessor/ReportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
class CRM_Case_XMLProcessor_ReportTest extends CiviCaseTestCase {

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

$this->simplifyCaseTypeDefinition();
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Case/XMLProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
class CRM_Case_XMLProcessorTest extends CiviCaseTestCase {

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

$this->processor = new CRM_Case_XMLProcessor();
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Case/XMLRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class CRM_Case_XMLRepositoryTest extends CiviUnitTestCase {
protected $fixtures = [];

protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->fixtures['CaseTypeWithSingleActivityType'] = '
<CaseType>
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Contact/BAO/ActivitySearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class CRM_Contact_BAO_ActivitySearchTest extends CiviUnitTestCase {
* Connect to the database, truncate the tables that will be used
* and redirect stdin to a temporary file
*/
public function setUp() {
public function setUp(): void {
// Connect to the database
parent::setUp();

Expand Down
7 changes: 0 additions & 7 deletions tests/phpunit/CRM/Contact/BAO/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@
*/
class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase {

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

/**
* Test case for add( ).
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase {

public function setUp() {
public function setUp(): void {
parent::setUp();
$students = 'indivi_student' . substr(sha1(rand()), 0, 7);
$params = [
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Contact/BAO/ContactType/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
class CRM_Contact_BAO_ContactType_ContactTest extends CiviUnitTestCase {

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

$params = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
class CRM_Contact_BAO_ContactType_ContactTypeTest extends CiviUnitTestCase {

public function setUp() {
public function setUp(): void {
parent::setUp();
$params = [
'label' => 'sub1_individual',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
class CRM_Contact_BAO_ContactType_RelationshipTest extends CiviUnitTestCase {

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

//create contact subtypes
Expand Down
10 changes: 0 additions & 10 deletions tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,6 @@ public function testJobWrapper() {
*/
private $_testObjects;

/**
* Sets up the fixture, for example, opens a network connection.
*
* This method is called before a test is executed.
*/
protected function setUp() {
$this->_testObjects = [];
parent::setUp();
}

/**
* Tears down the fixture, for example, closes a network connection.
*
Expand Down
9 changes: 0 additions & 9 deletions tests/phpunit/CRM/Contact/BAO/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@
*/
class CRM_Contact_BAO_GroupTest 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.
*
Expand Down
4 changes: 0 additions & 4 deletions tests/phpunit/CRM/Contact/BAO/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ public function dataProvider() {
return new CRM_Contact_BAO_QueryTestDataProvider();
}

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

/**
* Clean up after test.
*
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Contact/BAO/RelationshipCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
class CRM_Contact_BAO_RelationshipCacheTest extends CiviUnitTestCase {

protected function setUp() {
protected function setUp(): void {
$this->useTransaction(TRUE);
parent::setUp();
}
Expand Down
9 changes: 0 additions & 9 deletions tests/phpunit/CRM/Contact/BAO/RelationshipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@
*/
class CRM_Contact_BAO_RelationshipTest 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.
*
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Contribute/BAO/ContributionTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
class CRM_Contribute_BAO_ContributionTypeTest extends CiviUnitTestCase {

public function setUp() {
public function setUp(): void {
parent::setUp();
$this->organizationCreate();
}
Expand Down
4 changes: 0 additions & 4 deletions tests/phpunit/CRM/Contribute/BAO/ProductTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
*/
class CRM_Contribute_BAO_ProductTest extends CiviUnitTestCase {

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

/**
* Check method add()
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Extension/Manager/ModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
class CRM_Extension_Manager_ModuleTest extends CiviUnitTestCase {

public function setUp() {
public function setUp():void {
parent::setUp();
// $query = "INSERT INTO civicrm_domain ( name, version ) VALUES ( 'domain', 3 )";
// $result = CRM_Core_DAO::executeQuery($query);
Expand Down
6 changes: 1 addition & 5 deletions tests/phpunit/CRM/Extension/Manager/ReportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
class CRM_Extension_Manager_ReportTest extends CiviUnitTestCase {

public function setUp() {
public function setUp(): void {
parent::setUp();
//if (class_exists('test_extension_manager_reporttest')) {
// test_extension_manager_reporttest::$counts = array();
Expand All @@ -17,10 +17,6 @@ public function setUp() {
]);
}

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

/**
* Install an extension with a valid type name.
*/
Expand Down
6 changes: 1 addition & 5 deletions tests/phpunit/CRM/Extension/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ class CRM_Extension_ManagerTest extends CiviUnitTestCase {
const TESTING_TYPE = 'report';
const OTHER_TESTING_TYPE = 'module';

public function setUp() {
public function setUp(): void {
parent::setUp();
list ($this->basedir, $this->container) = $this->_createContainer();
$this->mapper = new CRM_Extension_Mapper($this->container);
}

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

/**
* Install an extension with an invalid type name.
*
Expand Down
6 changes: 1 addition & 5 deletions tests/phpunit/CRM/Extension/MapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CRM_Extension_MapperTest extends CiviUnitTestCase {
*/
protected $mapperWithSlash;

public function setUp() {
public function setUp(): void {
parent::setUp();
list ($this->basedir, $this->container) = $this->_createContainer();
$this->mapper = new CRM_Extension_Mapper($this->container);
Expand All @@ -45,10 +45,6 @@ public function setUp() {
$this->mapperWithSlash = new CRM_Extension_Mapper($this->containerWithSlash);
}

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

public function testClassToKey() {
$this->assertEquals("test.foo.bar", $this->mapper->classToKey('test_foo_bar'));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Financial/Form/PaymentEditTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CRM_Financial_Form_PaymentEditTest extends CiviUnitTestCase {
/**
* Setup function.
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$this->createLoggedInUser();

Expand Down
9 changes: 1 addition & 8 deletions tests/phpunit/CRM/Pledge/BAO/PledgeBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,12 @@ class CRM_Pledge_BAO_PledgeBlockTest extends CiviUnitTestCase {
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$contributionPage = $this->contributionPageCreate();
$this->_contributionPageId = $contributionPage['id'];
}

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

/**
* create() and deletepledgeblock() method
*/
Expand Down
15 changes: 0 additions & 15 deletions tests/phpunit/CRM/Pledge/BAO/PledgePaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@
*/
class CRM_Pledge_BAO_PledgePaymentTest 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() {
}

/**
* Test for Add/Update Pledge Payment.
*/
Expand Down
Loading

0 comments on commit 5d34586

Please sign in to comment.