From: Eileen McNaughton Date: Tue, 30 Jun 2015 21:51:14 +0000 (+1200) Subject: CRM-16473 test fixes to support addition of User api & uf_match entry to createLogged... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=225d474bd5067d041ea854d3fa4daaee783ad930;p=civicrm-core.git CRM-16473 test fixes to support addition of User api & uf_match entry to createLoggedInUser --- diff --git a/tests/phpunit/CiviTest/CiviCaseTestCase.php b/tests/phpunit/CiviTest/CiviCaseTestCase.php index 73fb4eef4b..af9a22624a 100644 --- a/tests/phpunit/CiviTest/CiviCaseTestCase.php +++ b/tests/phpunit/CiviTest/CiviCaseTestCase.php @@ -99,6 +99,7 @@ class CiviCaseTestCase extends CiviUnitTestCase { 'civicrm_managed', 'civicrm_relationship', 'civicrm_relationship_type', + 'civicrm_uf_match', ); $this->quickCleanup($this->tablesToTruncate); diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index eadb9f2436..646cd763ea 100755 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -534,7 +534,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { CRM_Core_Transaction::forceRollbackIfEnabled(); \Civi\Core\Transaction\Manager::singleton(TRUE); - $tablesToTruncate = array('civicrm_contact'); + $tablesToTruncate = array('civicrm_contact', 'civicrm_uf_match'); $this->quickCleanup($tablesToTruncate); $this->createDomainContacts(); } diff --git a/tests/phpunit/api/v3/ACLPermissionTest.php b/tests/phpunit/api/v3/ACLPermissionTest.php index 6d54ed3d43..0d81bbe6e6 100644 --- a/tests/phpunit/api/v3/ACLPermissionTest.php +++ b/tests/phpunit/api/v3/ACLPermissionTest.php @@ -63,6 +63,7 @@ class api_v3_ACLPermissionTest extends CiviUnitTestCase { 'civicrm_acl_contact_cache', 'civicrm_contribution', 'civicrm_participant', + 'civicrm_uf_match', ); $this->quickCleanup($tablesToTruncate); $config = CRM_Core_Config::singleton(); diff --git a/tests/phpunit/api/v3/ActivityTest.php b/tests/phpunit/api/v3/ActivityTest.php index 0236aed7c8..454ceafb85 100644 --- a/tests/phpunit/api/v3/ActivityTest.php +++ b/tests/phpunit/api/v3/ActivityTest.php @@ -104,6 +104,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'civicrm_contact', 'civicrm_activity', 'civicrm_activity_contact', + 'civicrm_uf_match', ); $this->quickCleanup($tablesToTruncate, TRUE); $this->callAPISuccess('option_value', 'delete', array('id' => $this->test_activity_type_id)); diff --git a/tests/phpunit/api/v3/CaseTest.php b/tests/phpunit/api/v3/CaseTest.php index 0d6d7ac0b1..14f8744c69 100644 --- a/tests/phpunit/api/v3/CaseTest.php +++ b/tests/phpunit/api/v3/CaseTest.php @@ -93,7 +93,7 @@ class api_v3_CaseTest extends CiviCaseTestCase { 'case_type_id' => 1, ); - $result = $this->callAPIFailure('case', 'create', $params); + $this->callAPIFailure('case', 'create', $params); } /** diff --git a/tests/phpunit/api/v3/CaseTypeTest.php b/tests/phpunit/api/v3/CaseTypeTest.php index 48a5af5ca6..ef9a5a5088 100644 --- a/tests/phpunit/api/v3/CaseTypeTest.php +++ b/tests/phpunit/api/v3/CaseTypeTest.php @@ -69,7 +69,7 @@ class api_v3_CaseTypeTest extends CiviCaseTestCase { */ public function tearDown() { parent::tearDown(); - $this->quickCleanup(array('civicrm_case_type')); + $this->quickCleanup(array('civicrm_case_type', 'civicrm_uf_match')); } /** diff --git a/tests/phpunit/api/v3/ContributionRecurTest.php b/tests/phpunit/api/v3/ContributionRecurTest.php index 07445a715c..d7f77b5aa1 100644 --- a/tests/phpunit/api/v3/ContributionRecurTest.php +++ b/tests/phpunit/api/v3/ContributionRecurTest.php @@ -66,7 +66,7 @@ class api_v3_ContributionRecurTest extends CiviUnitTestCase { } public function testGetContributionRecur() { - $result = $this->callAPISuccess($this->_entity, 'create', $this->params); + $this->callAPISuccess($this->_entity, 'create', $this->params); $getParams = array( 'amount' => '500', ); @@ -93,7 +93,7 @@ class api_v3_ContributionRecurTest extends CiviUnitTestCase { public function testDeleteContributionRecur() { $result = $this->callAPISuccess($this->_entity, 'create', $this->params); $deleteParams = array('id' => $result['id']); - $result = $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__); + $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__); $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array()); $this->assertEquals(0, $checkDeleted['count']); } diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index 5c5fc60f39..134d8128e8 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -113,6 +113,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { */ public function tearDown() { $this->quickCleanUpFinancialEntities(); + $this->quickCleanup(array('civicrm_uf_match')); } /** diff --git a/tests/phpunit/api/v3/ProfileTest.php b/tests/phpunit/api/v3/ProfileTest.php index 3815b22bcc..6b6dd6b189 100644 --- a/tests/phpunit/api/v3/ProfileTest.php +++ b/tests/phpunit/api/v3/ProfileTest.php @@ -59,6 +59,7 @@ class api_v3_ProfileTest extends CiviUnitTestCase { 'civicrm_address', 'civicrm_membership', 'civicrm_contribution', + 'civicrm_uf_match', ), TRUE); $this->callAPISuccess('membership_type', 'delete', array('id' => $this->_membershipTypeID)); // ok can't be bothered wring an api to do this & truncating is crazy diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 3dc5663db9..1c0a6e264c 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -102,6 +102,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { 'Extension', 'ReportTemplate', 'System', + 'User', ); $this->toBeImplemented['delete'] = array( 'MembershipPayment', @@ -118,6 +119,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { 'Entity', 'Domain', 'Setting', + 'User', ); $this->deprecatedAPI = array('Location', 'ActivityType', 'SurveyRespondant'); $this->deletableTestObjects = array(); @@ -278,8 +280,10 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { * * Mailing Contact Just doesn't support id. We have always insisted on finding a way to * support id in API but in this case the underlying tables are crying out for a restructure - * & it just doesn't make sense, on the otherhand Event need id to be existant as pseudo property - * is been associated with it, so we need to bypass for get api otherwise it will through pseudo_match validation + * & it just doesn't make sense. + * + * User doesn't support get By ID because the user id is actually the CMS user ID & is not part of + * CiviCRM - so can only be tested through UserTest - not SyntaxConformanceTest. * * @param bool $sequential * @@ -287,7 +291,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { * Entities that cannot be retrieved by ID */ public static function toBeSkipped_getByID($sequential = FALSE) { - return array('MailingContact', 'Event'); + return array('MailingContact', 'User'); } /** @@ -327,6 +331,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { 'Profile', 'CustomValue', 'Setting', + 'User', ); if ($sequential === TRUE) { return $entitiesWithout;