From 6c6e618724401e4472f7763cce97375dd47a7fdc Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 6 Jan 2015 13:42:38 -0800 Subject: [PATCH] INFRA-132 - tests/ - phpcbf --- tests/phpunit/AllTests.php | 12 +- tests/phpunit/CRM/Activity/AllTests.php | 12 +- .../Activity/BAO/ActivityAssignmentTest.php | 9 +- .../CRM/Activity/BAO/ActivityTargetTest.php | 5 +- tests/phpunit/CRM/AllTests.php | 12 +- tests/phpunit/CRM/Batch/Form/EntryTest.php | 18 +- tests/phpunit/CRM/Bridge/OG/DrupalTest.php | 8 +- tests/phpunit/CRM/Case/AllTests.php | 2 +- tests/phpunit/CRM/Contact/AllTests.php | 12 +- tests/phpunit/CRM/Contact/BAO/ContactTest.php | 100 +-- .../BAO/ContactType/ContactSearchTest.php | 7 - .../Contact/BAO/ContactType/ContactTest.php | 3 - .../CRM/Contact/BAO/GroupContactCacheTest.php | 5 +- .../CRM/Contact/BAO/GroupContactTest.php | 12 +- tests/phpunit/CRM/Contact/BAO/GroupTest.php | 2 +- tests/phpunit/CRM/Contact/BAO/QueryTest.php | 46 +- .../CRM/Contact/BAO/QueryTestDataProvider.php | 16 +- .../Contact/Form/Search/Custom/GroupTest.php | 32 +- .../Search/Custom/GroupTestDataProvider.php | 71 +- tests/phpunit/CRM/Contribute/AllTests.php | 12 +- .../Contribute/BAO/ContributionPageTest.php | 4 +- .../CRM/Contribute/BAO/ContributionTest.php | 5 +- tests/phpunit/CRM/Core/AllTests.php | 12 +- .../CRM/Core/BAO/ActionScheduleTest.php | 29 +- tests/phpunit/CRM/Core/BAO/AddressTest.php | 2 - .../phpunit/CRM/Core/BAO/CustomFieldTest.php | 10 +- .../phpunit/CRM/Core/BAO/CustomGroupTest.php | 1 - .../Core/BAO/CustomValueTableSetGetTest.php | 5 +- .../phpunit/CRM/Core/BAO/CustomValueTest.php | 4 +- tests/phpunit/CRM/Core/BAO/LocationTest.php | 16 +- tests/phpunit/CRM/Core/BAO/PhoneTest.php | 3 +- .../CRM/Core/BAO/RecurringEntityTest.php | 7 +- tests/phpunit/CRM/Core/BAO/SettingTest.php | 2 +- tests/phpunit/CRM/Core/BAO/UFFieldTest.php | 10 +- tests/phpunit/CRM/Core/Config/MailerTest.php | 20 +- tests/phpunit/CRM/Core/ErrorTest.php | 4 +- .../phpunit/CRM/Core/ManagedEntitiesTest.php | 7 +- tests/phpunit/CRM/Core/Page/AJAXTest.php | 5 +- .../CRM/Core/Payment/AuthorizeNetIPNTest.php | 2 +- .../CRM/Core/Payment/AuthorizeNetTest.php | 2 +- .../CRM/Core/Payment/PayPalProIPNTest.php | 2 +- tests/phpunit/CRM/Core/RegionTest.php | 5 +- tests/phpunit/CRM/Core/ResourcesTest.php | 60 +- tests/phpunit/CRM/Core/TransactionTest.php | 16 +- tests/phpunit/CRM/Dedupe/DedupeFinderTest.php | 2 +- tests/phpunit/CRM/Event/AllTests.php | 12 +- .../CRM/Event/BAO/ParticipantStatusTest.php | 5 +- tests/phpunit/CRM/Extension/AllTests.php | 12 +- .../CRM/Extension/Container/AllTests.php | 12 +- .../CRM/Extension/Manager/AllTests.php | 12 +- .../CRM/Extension/Manager/ModuleTest.php | 2 +- .../CRM/Financial/BAO/FinancialItemTest.php | 8 +- .../BAO/FinancialTypeAccountTest.php | 2 +- .../CRM/Financial/BAO/FinancialTypeTest.php | 8 +- tests/phpunit/CRM/Group/Page/AjaxTest.php | 16 +- tests/phpunit/CRM/Mailing/BAO/QueryTest.php | 2 +- .../CRM/Mailing/BAO/QueryTestDataProvider.php | 61 +- tests/phpunit/CRM/Mailing/BAO/SpoolTest.php | 19 +- tests/phpunit/CRM/Member/AllTests.php | 12 +- .../CRM/Member/BAO/MembershipLogTest.php | 22 +- .../phpunit/CRM/Member/BAO/MembershipTest.php | 75 +- tests/phpunit/CRM/Member/Form/AllTests.php | 12 +- .../CRM/Member/Form/MembershipTest.php | 34 +- .../Member/Import/Parser/MembershipTest.php | 6 +- tests/phpunit/CRM/PCP/BAO/PCPTest.php | 5 +- tests/phpunit/CRM/Pledge/AllTests.php | 12 +- .../CRM/Pledge/BAO/PledgeBlockTest.php | 5 +- .../CRM/Pledge/BAO/PledgePaymentTest.php | 7 +- tests/phpunit/CRM/Pledge/BAO/PledgeTest.php | 5 +- tests/phpunit/CRM/Queue/AllTests.php | 12 +- tests/phpunit/CRM/Queue/Queue/AllTests.php | 12 +- tests/phpunit/CRM/Utils/ArrayTest.php | 12 +- tests/phpunit/CRM/Utils/Cache/AllTests.php | 12 +- tests/phpunit/CRM/Utils/MailTest.php | 3 +- tests/phpunit/CRM/Utils/NumberTest.php | 12 +- .../phpunit/CRM/Utils/QueryFormatterTest.php | 48 +- tests/phpunit/CRM/Utils/SQL/InsertTest.php | 6 +- tests/phpunit/CRM/Utils/SQL/SelectTest.php | 4 +- tests/phpunit/CRM/Utils/StringTest.php | 1 - tests/phpunit/CRM/Utils/SystemTest.php | 4 +- tests/phpunit/CRM/Utils/versionCheckTest.php | 38 +- tests/phpunit/Civi/AllTests.php | 12 +- tests/phpunit/CiviTest/CiviDBAssert.php | 1 - tests/phpunit/CiviTest/CiviMailUtils.php | 2 + .../phpunit/CiviTest/CiviSeleniumTestCase.php | 44 +- tests/phpunit/CiviTest/CiviUnitTestCase.php | 93 +-- tests/phpunit/CiviTest/Custom.php | 2 +- tests/phpunit/CiviTest/Event.php | 1 - tests/phpunit/CiviTest/PCP.php | 1 - tests/phpunit/CiviTest/bootstrap.php | 8 +- .../CiviTest/civicrm.settings.dist.php | 26 +- tests/phpunit/Utils.php | 18 +- .../Activity/AddRecurringActivityTest.php | 5 +- .../Activity/ContactContextAddTest.php | 4 +- tests/phpunit/WebTest/Activity/IcalTest.php | 2 +- .../WebTest/Activity/StandaloneAddTest.php | 8 +- .../WebTest/Admin/MoveCustomDataTest.php | 6 +- tests/phpunit/WebTest/AllTests.php | 2 +- .../phpunit/WebTest/Campaign/ActivityTest.php | 2 +- .../phpunit/WebTest/Campaign/MailingTest.php | 2 +- .../Campaign/OfflineContributionTest.php | 1 - .../Campaign/OnlineEventRegistrationTest.php | 2 +- .../Campaign/SurveyUsageScenarioTest.php | 6 +- .../WebTest/Case/ActivityToCaseTest.php | 2 +- tests/phpunit/WebTest/Case/AddCaseTest.php | 4 +- .../phpunit/WebTest/Case/AddCaseTypeTest.php | 4 +- .../WebTest/Case/CaseCustomFieldsTest.php | 2 +- .../AddContactsToEventAdvancedSearchTest.php | 1 - tests/phpunit/WebTest/Contact/AddTest.php | 1 - .../WebTest/Contact/AdvanceSearchPaneTest.php | 6 +- .../WebTest/Contact/AdvancedSearchTest.php | 24 +- .../AdvancedSearchedRelatedContactTest.php | 15 +- .../WebTest/Contact/ContactTagTest.php | 1 - .../WebTest/Contact/CustomDataAddTest.php | 6 +- .../WebTest/Contact/DupeContactTest.php | 2 +- .../WebTest/Contact/EditContactTest.php | 6 +- .../phpunit/WebTest/Contact/GroupAddTest.php | 8 +- .../WebTest/Contact/InlineFieldsEditTest.php | 8 +- .../WebTest/Contact/MergeContactsTest.php | 12 +- .../Contact/MultipleContactSubTypes.php | 2 +- .../WebTest/Contact/RelationshipAddTest.php | 10 +- tests/phpunit/WebTest/Contact/SearchTest.php | 6 +- .../Contact/SearchbyDateFilterTest.php | 54 +- .../Contact/TaskActionAddToGroupTest.php | 2 +- .../WebTest/Contact/UpdateProfileTest.php | 2 +- .../WebTest/Contribute/AddBatchesTest.php | 2 +- .../Contribute/ContactContextAddTest.php | 3 +- .../Contribute/ContributionPageAddTest.php | 6 +- .../Contribute/OfflineContributionTest.php | 2 - .../Contribute/OnBehalfOfOrganization.php | 14 +- .../Contribute/OnlineContributionTest.php | 7 +- .../WebTest/Contribute/StandaloneAddTest.php | 3 +- .../Contribute/UpdateContributionTest.php | 758 +++++++++--------- .../UpdatePendingContributionTest.php | 1 - .../Contribute/VerifySSLContributionTest.php | 2 +- tests/phpunit/WebTest/Event/AddEventTest.php | 90 +-- .../WebTest/Event/AddParticipationTest.php | 24 +- .../phpunit/WebTest/Event/AddPricesetTest.php | 22 +- .../WebTest/Event/AdditionalPaymentTest.php | 4 +- tests/phpunit/WebTest/Event/PCPAddTest.php | 2 +- .../WebTest/Event/ParticipantSearchTest.php | 1 - tests/phpunit/WebTest/Export/ContactTest.php | 18 +- .../Export/ExportCiviSeleniumTestCase.php | 8 +- .../Financial/FinancialAccountTest.php | 12 +- .../Financial/FinancialAccountTypeTest.php | 14 +- .../WebTest/Generic/CheckActivityTest.php | 4 +- .../Generic/GeneralClickAroundTest.php | 2 - .../WebTest/Import/AddressImportTest.php | 43 +- .../WebTest/Import/AddressParsingTest.php | 6 +- .../WebTest/Import/ContactCustomDataTest.php | 3 +- .../WebTest/Import/ContactSubtypeTest.php | 18 +- tests/phpunit/WebTest/Import/ContactTest.php | 18 +- .../phpunit/WebTest/Import/DateFormatTest.php | 36 +- .../WebTest/Import/DuplicateMatchingTest.php | 18 +- tests/phpunit/WebTest/Import/GroupTest.php | 6 +- .../Import/ImportCiviSeleniumTestCase.php | 8 +- .../WebTest/Import/MatchExternalIdTest.php | 4 +- .../Import/MultipleRelationshipTest.php | 31 +- .../Mailing/AddNewMailingComponentTest.php | 4 +- tests/phpunit/WebTest/Mailing/MailingTest.php | 28 +- tests/phpunit/WebTest/Mailing/SpoolTest.php | 2 +- .../Member/DefaultMembershipPricesetTest.php | 6 +- .../Member/FixedMembershipTypeTest.php | 16 +- .../Member/InheritedMembershipTest.php | 1 - .../OfflineMembershipAddPricesetTest.php | 17 +- .../Member/OfflineMembershipRenewTest.php | 7 +- .../OnlineAutoRenewMembershipGCTest.php | 2 - .../Member/OnlineAutoRenewMembershipTest.php | 6 +- .../OnlineMembershipAddPricesetTest.php | 17 +- .../Member/OnlineMembershipCreateTest.php | 4 +- .../Member/OnlineMembershipRenewTest.php | 8 +- .../WebTest/Member/StandaloneAddTest.php | 8 +- .../WebTest/Pledge/AddCancelPaymentTest.php | 14 +- .../WebTest/Pledge/ContactContextAddTest.php | 1 - .../ContactContextPledgePaymentAddTest.php | 12 +- .../Pledge/StandaloneAddDeleteTest.php | 8 +- .../WebTest/Pledge/StandaloneAddTest.php | 1 - .../Profile/MultiRecordProfileAddTest.php | 6 +- .../WebTest/Profile/ProfileAddTest.php | 3 +- .../WebTest/Profile/ProfileCountryState.php | 21 +- .../Profile/ProfileGroupSubscriptionTest.php | 1 - .../WebTest/Release/ReleaseTestCase.php | 3 +- tests/phpunit/WebTest/Report/AddTest.php | 2 +- .../WebTest/Report/LoggingReportTest.php | 26 +- tests/phpunit/api/v3/ACLCachingTest.php | 14 +- tests/phpunit/api/v3/ACLPermissionTest.php | 2 +- tests/phpunit/api/v3/APIStandardsTest.php | 12 +- tests/phpunit/api/v3/APITest.php | 11 +- tests/phpunit/api/v3/ActionScheduleTest.php | 10 +- tests/phpunit/api/v3/ActivityContactTest.php | 6 +- tests/phpunit/api/v3/ActivityTest.php | 27 +- tests/phpunit/api/v3/ActivityTypeTest.php | 6 +- tests/phpunit/api/v3/AddressTest.php | 17 +- tests/phpunit/api/v3/AllTests.php | 12 +- tests/phpunit/api/v3/BatchTest.php | 2 +- tests/phpunit/api/v3/CRM11793Test.php | 2 +- tests/phpunit/api/v3/CaseTest.php | 14 +- tests/phpunit/api/v3/CaseTypeTest.php | 4 +- tests/phpunit/api/v3/ConstantTest.php | 16 +- tests/phpunit/api/v3/ContactTest.php | 76 +- tests/phpunit/api/v3/ContactTypeTest.php | 1 - tests/phpunit/api/v3/ContributionPageTest.php | 24 +- .../phpunit/api/v3/ContributionRecurTest.php | 7 +- tests/phpunit/api/v3/ContributionSoftTest.php | 18 +- tests/phpunit/api/v3/ContributionTest.php | 486 ++++++----- tests/phpunit/api/v3/CountryTest.php | 8 +- tests/phpunit/api/v3/CustomFieldTest.php | 21 +- tests/phpunit/api/v3/CustomGroupTest.php | 7 +- .../api/v3/CustomValueContactTypeTest.php | 30 +- tests/phpunit/api/v3/CustomValueTest.php | 13 +- tests/phpunit/api/v3/DomainTest.php | 14 +- tests/phpunit/api/v3/EmailTest.php | 2 +- tests/phpunit/api/v3/EventTest.php | 48 +- tests/phpunit/api/v3/GrantTest.php | 19 +- tests/phpunit/api/v3/GroupContactTest.php | 9 +- tests/phpunit/api/v3/GroupNestingTest.php | 17 +- .../phpunit/api/v3/GroupOrganizationTest.php | 22 +- tests/phpunit/api/v3/GroupTest.php | 2 +- tests/phpunit/api/v3/ImTest.php | 4 +- .../phpunit/api/v3/JobProcessMailingTest.php | 4 +- tests/phpunit/api/v3/JobTest.php | 24 +- tests/phpunit/api/v3/LineItemTest.php | 6 +- tests/phpunit/api/v3/LocBlockTest.php | 6 +- tests/phpunit/api/v3/MailingContactTest.php | 6 +- tests/phpunit/api/v3/MailingGroupTest.php | 2 +- tests/phpunit/api/v3/MailingTest.php | 14 +- .../phpunit/api/v3/MembershipPaymentTest.php | 6 +- tests/phpunit/api/v3/MembershipStatusTest.php | 6 +- tests/phpunit/api/v3/MembershipTest.php | 24 +- tests/phpunit/api/v3/MembershipTypeTest.php | 16 +- tests/phpunit/api/v3/MessageTemplateTest.php | 10 +- tests/phpunit/api/v3/NoteTest.php | 17 +- tests/phpunit/api/v3/OptionGroupTest.php | 6 +- tests/phpunit/api/v3/OptionValueTest.php | 59 +- .../phpunit/api/v3/ParticipantPaymentTest.php | 19 +- .../api/v3/ParticipantStatusTypeTest.php | 3 +- tests/phpunit/api/v3/ParticipantTest.php | 22 +- .../api/v3/PaymentProcessorTypeTest.php | 35 +- tests/phpunit/api/v3/PhoneTest.php | 8 +- tests/phpunit/api/v3/PledgePaymentTest.php | 5 +- tests/phpunit/api/v3/PledgeTest.php | 41 +- tests/phpunit/api/v3/PriceFieldTest.php | 13 +- tests/phpunit/api/v3/PriceFieldValueTest.php | 30 +- tests/phpunit/api/v3/PriceSetTest.php | 6 +- tests/phpunit/api/v3/ProductTest.php | 6 +- tests/phpunit/api/v3/ProfileTest.php | 12 +- tests/phpunit/api/v3/RelationshipTest.php | 30 +- tests/phpunit/api/v3/RelationshipTypeTest.php | 2 +- tests/phpunit/api/v3/ReportTemplateTest.php | 21 +- tests/phpunit/api/v3/SettingTest.php | 107 +-- tests/phpunit/api/v3/SurveyRespondantTest.php | 8 +- tests/phpunit/api/v3/SurveyTest.php | 9 +- .../phpunit/api/v3/SyntaxConformanceTest.php | 74 +- tests/phpunit/api/v3/TagTest.php | 8 +- .../api/v3/TaxContributionPageTest.php | 24 +- tests/phpunit/api/v3/UFGroupTest.php | 8 +- tests/phpunit/api/v3/UFJoinTest.php | 19 +- tests/phpunit/api/v3/UFMatchTest.php | 11 +- tests/phpunit/api/v3/UtilsTest.php | 4 +- tests/phpunit/api/v3/WebsiteTest.php | 7 +- .../phpunit/api/v3/settings/test.setting.php | 2 +- 261 files changed, 2417 insertions(+), 2307 deletions(-) diff --git a/tests/phpunit/AllTests.php b/tests/phpunit/AllTests.php index 2aeb46dd40..7d73bf1915 100644 --- a/tests/phpunit/AllTests.php +++ b/tests/phpunit/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Activity/AllTests.php b/tests/phpunit/CRM/Activity/AllTests.php index 3d80d7a126..68509919b6 100644 --- a/tests/phpunit/CRM/Activity/AllTests.php +++ b/tests/phpunit/CRM/Activity/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Activity_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Activity/BAO/ActivityAssignmentTest.php b/tests/phpunit/CRM/Activity/BAO/ActivityAssignmentTest.php index a70305e02c..3ce03b0314 100644 --- a/tests/phpunit/CRM/Activity/BAO/ActivityAssignmentTest.php +++ b/tests/phpunit/CRM/Activity/BAO/ActivityAssignmentTest.php @@ -31,7 +31,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for CRM_Activity_BAO_ActivityAssignment BAO * - * @package CiviCRM + * @package CiviCRM */ class CRM_Activity_BAO_ActivityAssignmentTest extends CiviUnitTestCase { @@ -49,7 +49,8 @@ class CRM_Activity_BAO_ActivityAssignmentTest extends CiviUnitTestCase { * This method is called after a test is executed. * */ - protected function tearDown() {} + protected function tearDown() { + } /** * Pass zero as an id and make sure no Assignees are retrieved @@ -66,7 +67,7 @@ class CRM_Activity_BAO_ActivityAssignmentTest extends CiviUnitTestCase { */ public function testRetrieveAssigneeIdsByActivityIdNullId() { $activity = $this->activityCreate(); - $activityId = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId(Null); + $activityId = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId(NULL); $this->assertEquals(count($activityId), 0, '0 assignees retrieved using null'); } @@ -106,7 +107,7 @@ class CRM_Activity_BAO_ActivityAssignmentTest extends CiviUnitTestCase { */ public function testGetAssigneeNamesNullId() { $activity = $this->activityCreate(); - $assignees = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames(Null); + $assignees = CRM_Activity_BAO_ActivityAssignment::getAssigneeNames(NULL); $this->assertEquals(count($assignees), 0, '0 assignee names retrieved'); } diff --git a/tests/phpunit/CRM/Activity/BAO/ActivityTargetTest.php b/tests/phpunit/CRM/Activity/BAO/ActivityTargetTest.php index bc13f61c72..5f43b66c27 100644 --- a/tests/phpunit/CRM/Activity/BAO/ActivityTargetTest.php +++ b/tests/phpunit/CRM/Activity/BAO/ActivityTargetTest.php @@ -31,7 +31,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for CRM_Activity_BAO_ActivityTarget BAO * - * @package CiviCRM + * @package CiviCRM */ class CRM_Activity_BAO_ActivityTargetTest extends CiviUnitTestCase { @@ -49,7 +49,8 @@ class CRM_Activity_BAO_ActivityTargetTest extends CiviUnitTestCase { * This method is called after a test is executed. * */ - protected function tearDown() {} + protected function tearDown() { + } public function testRetrieveTargetIdsByActivityIdZeroID() { $activity = $this->activityCreate(); diff --git a/tests/phpunit/CRM/AllTests.php b/tests/phpunit/CRM/AllTests.php index b177161be1..f42d8f1a1c 100644 --- a/tests/phpunit/CRM/AllTests.php +++ b/tests/phpunit/CRM/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all CRM test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Batch/Form/EntryTest.php b/tests/phpunit/CRM/Batch/Form/EntryTest.php index a9d1076829..d7b6f47232 100644 --- a/tests/phpunit/CRM/Batch/Form/EntryTest.php +++ b/tests/phpunit/CRM/Batch/Form/EntryTest.php @@ -5,7 +5,7 @@ * * (PHP 5) * - * @package CiviCRM + * @package CiviCRM * * This file is part of CiviCRM * @@ -30,7 +30,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test CRM/Member/BAO Membership Log add , delete functions * - * @package CiviCRM + * @package CiviCRM */ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase { @@ -184,11 +184,11 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase { $result = $this->callAPISuccess('contribution', 'get', array('return' => 'total_amount')); $this->assertEquals(2, $result['count']); foreach($result['values'] as $contribution) { - $this-> assertEquals($this->callAPISuccess('line_item', 'getvalue', array( + $this-> assertEquals($this->callAPISuccess('line_item', 'getvalue', array( 'contribution_id' => $contribution['id'], 'return' => 'line_total', - )), $contribution['total_amount']); + )), $contribution['total_amount']); } } /** @@ -200,14 +200,14 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase { return array( 'batch_id' => 4, 'primary_profiles' => array(1 => NULL, 2 => NULL, 3 => NULL), - 'primary_contact_id' => Array ( + 'primary_contact_id' => array( 1 => $this->_contactID, 2 => $this->_contactID2, 3 => $this->_contactID3, ), 'field' => array( 1 => array( - 'membership_type' => Array (0 => $this->_orgContactID, 1 => $this->_membershipTypeID), + 'membership_type' => array(0 => $this->_orgContactID, 1 => $this->_membershipTypeID), 'join_date' => '07/22/2013', 'membership_start_date' => NULL, 'membership_end_date' => NULL, @@ -221,7 +221,7 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase { 'contribution_status_id' => 1, ), 2 => array( - 'membership_type' => Array (0 => $this->_orgContactID, 1 => $this->_membershipTypeID), + 'membership_type' => array(0 => $this->_orgContactID, 1 => $this->_membershipTypeID), 'join_date' => '07/03/2013', 'membership_start_date' => '02/03/2013', 'membership_end_date' => NULL, @@ -236,7 +236,7 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase { ), // no join date, coded end date 3 => array( - 'membership_type' => Array (0 => $this->_orgContactID, 1 => $this->_membershipTypeID), + 'membership_type' => array(0 => $this->_orgContactID, 1 => $this->_membershipTypeID), 'join_date' => NULL, 'membership_start_date' => NULL, 'membership_end_date' => '2013-12-01', @@ -263,7 +263,7 @@ class CRM_Batch_Form_EntryTest extends CiviUnitTestCase { return array( //'batch_id' => 4, 'primary_profiles' => array(1 => NULL, 2 => NULL, 3 => NULL), - 'primary_contact_id' => Array ( + 'primary_contact_id' => array( 1 => $this->_contactID, 2 => $this->_contactID2, 3 => $this->_contactID3, diff --git a/tests/phpunit/CRM/Bridge/OG/DrupalTest.php b/tests/phpunit/CRM/Bridge/OG/DrupalTest.php index aac0f28e7c..e2125f7263 100644 --- a/tests/phpunit/CRM/Bridge/OG/DrupalTest.php +++ b/tests/phpunit/CRM/Bridge/OG/DrupalTest.php @@ -6,10 +6,10 @@ * * (PHP 5) * - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @package CiviCRM + * @package CiviCRM * * This file is part of CiviCRM * @@ -37,7 +37,7 @@ require_once 'api/api.php'; /** * Test contact custom search functions * - * @package CiviCRM + * @package CiviCRM */ class CRM_Bridge_OG_DrupalTest extends CiviUnitTestCase { /* diff --git a/tests/phpunit/CRM/Case/AllTests.php b/tests/phpunit/CRM/Case/AllTests.php index d0f255d3d2..e04d6ed59f 100644 --- a/tests/phpunit/CRM/Case/AllTests.php +++ b/tests/phpunit/CRM/Case/AllTests.php @@ -8,7 +8,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Case_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Contact/AllTests.php b/tests/phpunit/CRM/Contact/AllTests.php index 8ae18fe57e..22e4ee421a 100644 --- a/tests/phpunit/CRM/Contact/AllTests.php +++ b/tests/phpunit/CRM/Contact/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Contacts_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Contact/BAO/ContactTest.php b/tests/phpunit/CRM/Contact/BAO/ContactTest.php index af8525b718..39de0fa11d 100644 --- a/tests/phpunit/CRM/Contact/BAO/ContactTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ContactTest.php @@ -16,7 +16,7 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { * test with empty params. */ public function testAddWithEmptyParams() { - $params = array( ); + $params = array(); $contact = CRM_Contact_BAO_Contact::add($params); //Now check Contact object @@ -331,7 +331,8 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { 'location_type_id' => 1, 'is_primary' => 1, ); - $compareParams = array('street_address' => CRM_Utils_Array::value('street_address', $params['address'][1]), + $compareParams = array( + 'street_address' => CRM_Utils_Array::value('street_address', $params['address'][1]), 'supplemental_address_1' => CRM_Utils_Array::value('supplemental_address_1', $params['address'][1] ), @@ -358,7 +359,8 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { $this->assertDBCompareValues('CRM_Core_DAO_OpenID', $searchParams, $compareParams); //Now check DB for IM - $compareParams = array('name' => CRM_Utils_Array::value('name', $params['im'][1]), + $compareParams = array( + 'name' => CRM_Utils_Array::value('name', $params['im'][1]), 'provider_id' => CRM_Utils_Array::value('provider_id', $params['im'][1]), ); $this->assertDBCompareValues('CRM_Core_DAO_IM', $searchParams, $compareParams); @@ -491,7 +493,6 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { //delete all notes related to contact CRM_Core_BAO_Note::cleanContactNotes($contactId); - //cleanup DB by deleting the contact Contact::delete($contactId); $this->quickCleanup(array('civicrm_contact', 'civicrm_note')); @@ -628,7 +629,6 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { //delete all notes related to contact CRM_Core_BAO_Note::cleanContactNotes($contactId); - //cleanup DB by deleting the contact Contact::delete($contactId); $this->quickCleanup(array('civicrm_contact')); @@ -699,7 +699,6 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { 'id', 'openid', 'Database check, openId deleted successfully.' ); - // Check that the custom field value is no longer present $params = array( 'entityID' => $contactId, @@ -824,7 +823,7 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { ); $dbPrefComm = explode(CRM_Core_DAO::VALUE_SEPARATOR, - CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactId, 'preferred_communication_method', 'id', true) + CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactId, 'preferred_communication_method', 'id', TRUE) ); $checkPrefComm = array(); foreach ($dbPrefComm as $key => $value) { @@ -840,7 +839,8 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { 'location_type_id' => 1, 'is_primary' => 1, ); - $compareParams = array('street_address' => CRM_Utils_Array::value('street_address-Primary', $profileParams), + $compareParams = array( + 'street_address' => CRM_Utils_Array::value('street_address-Primary', $profileParams), 'supplemental_address_1' => CRM_Utils_Array::value('supplemental_address_1-Primary', $profileParams), 'supplemental_address_2' => CRM_Utils_Array::value('supplemental_address_2-Primary', $profileParams), 'city' => CRM_Utils_Array::value('city-Primary', $profileParams), @@ -857,7 +857,8 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { $this->assertDBCompareValues('CRM_Core_DAO_Email', $searchParams, $compareParams); //Now check DB for IM - $compareParams = array('name' => CRM_Utils_Array::value('im-Primary', $profileParams), + $compareParams = array( + 'name' => CRM_Utils_Array::value('im-Primary', $profileParams), 'provider_id' => CRM_Utils_Array::value('im-Primary-provider_id', $profileParams), ); $this->assertDBCompareValues('CRM_Core_DAO_IM', $searchParams, $compareParams); @@ -1026,7 +1027,7 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { ); $dbPrefComm = explode(CRM_Core_DAO::VALUE_SEPARATOR, - CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactId, 'preferred_communication_method', 'id', true) + CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $contactId, 'preferred_communication_method', 'id', TRUE) ); $checkPrefComm = array(); foreach ($dbPrefComm as $key => $value) { @@ -1042,7 +1043,8 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { 'location_type_id' => 1, 'is_primary' => 1, ); - $compareParams = array('street_address' => CRM_Utils_Array::value('street_address-Primary', $updatePfParams), + $compareParams = array( + 'street_address' => CRM_Utils_Array::value('street_address-Primary', $updatePfParams), 'supplemental_address_1' => CRM_Utils_Array::value('supplemental_address_1-Primary', $updatePfParams), 'supplemental_address_2' => CRM_Utils_Array::value('supplemental_address_2-Primary', $updatePfParams), 'city' => CRM_Utils_Array::value('city-Primary', $updatePfParams), @@ -1059,7 +1061,8 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { $this->assertDBCompareValues('CRM_Core_DAO_Email', $searchParams, $compareParams); //Now check DB for IM - $compareParams = array('name' => CRM_Utils_Array::value('im-Primary', $updatePfParams), + $compareParams = array( + 'name' => CRM_Utils_Array::value('im-Primary', $updatePfParams), 'provider_id' => CRM_Utils_Array::value('im-Primary-provider_id', $updatePfParams), ); $this->assertDBCompareValues('CRM_Core_DAO_IM', $searchParams, $compareParams); @@ -1394,7 +1397,6 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { 'email' => 'john.smith@example.org', ); - $params['phone'] = array(); $params['phone'][1] = array( 'location_type_id' => 1, @@ -1432,15 +1434,15 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { public function testTimestamps_contact() { $test = $this; $this->_testTimestamps(array( - 'UPDATE' => function ($contactId) use ($test) { - $params = array( + 'UPDATE' => function ($contactId) use ($test) { + $params = array( 'first_name' => 'Testing', 'contact_type' => 'Individual', 'contact_id' => $contactId, ); - $contact = CRM_Contact_BAO_Contact::add($params); - $test->assertInstanceOf('CRM_Contact_DAO_Contact', $contact, 'Check for created object'); - }, + $contact = CRM_Contact_BAO_Contact::add($params); + $test->assertInstanceOf('CRM_Contact_DAO_Contact', $contact, 'Check for created object'); + }, )); } @@ -1450,33 +1452,33 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { public function testTimestamps_email() { $test = $this; $this->_testTimestamps(array( - 'INSERT' => function ($contactId) use ($test) { - $params = array( + 'INSERT' => function ($contactId) use ($test) { + $params = array( 'email' => 'ex-1@example.com', 'is_primary' => 1, 'location_type_id' => 1, 'contact_id' => $contactId, ); - CRM_Core_BAO_Email::add($params); - $test->assertDBQuery('ex-1@example.com', + CRM_Core_BAO_Email::add($params); + $test->assertDBQuery('ex-1@example.com', 'SELECT email FROM civicrm_email WHERE contact_id = %1 ORDER BY id DESC LIMIT 1', array(1 => array($contactId, 'Integer')) ); - }, + }, - 'UPDATE' => function ($contactId) use ($test) { - CRM_Core_DAO::executeQuery( + 'UPDATE' => function ($contactId) use ($test) { + CRM_Core_DAO::executeQuery( 'UPDATE civicrm_email SET email = "ex-2@example.com" WHERE contact_id = %1', array(1 => array($contactId, 'Integer')) ); - }, + }, - 'DELETE' => function ($contactId) use ($test) { - CRM_Core_DAO::executeQuery( + 'DELETE' => function ($contactId) use ($test) { + CRM_Core_DAO::executeQuery( 'DELETE FROM civicrm_email WHERE contact_id = %1', array(1 => array($contactId, 'Integer')) ); - }, + }, )); } @@ -1486,33 +1488,33 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { public function testTimestamps_phone() { $test = $this; $this->_testTimestamps(array( - 'INSERT' => function ($contactId) use ($test) { - $params = array( + 'INSERT' => function ($contactId) use ($test) { + $params = array( 'phone' => '202-555-1000', 'is_primary' => 1, 'location_type_id' => 1, 'contact_id' => $contactId, ); - CRM_Core_BAO_Phone::add($params); - $test->assertDBQuery('202-555-1000', + CRM_Core_BAO_Phone::add($params); + $test->assertDBQuery('202-555-1000', 'SELECT phone FROM civicrm_phone WHERE contact_id = %1 ORDER BY id DESC LIMIT 1', array(1 => array($contactId, 'Integer')) ); - }, + }, - 'UPDATE' => function ($contactId) use ($test) { - CRM_Core_DAO::executeQuery( + 'UPDATE' => function ($contactId) use ($test) { + CRM_Core_DAO::executeQuery( 'UPDATE civicrm_phone SET phone = "202-555-2000" WHERE contact_id = %1', array(1 => array($contactId, 'Integer')) ); - }, + }, - 'DELETE' => function ($contactId) use ($test) { - CRM_Core_DAO::executeQuery( + 'DELETE' => function ($contactId) use ($test) { + CRM_Core_DAO::executeQuery( 'DELETE FROM civicrm_phone WHERE contact_id = %1', array(1 => array($contactId, 'Integer')) ); - }, + }, )); } @@ -1532,24 +1534,24 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { $customField = $customField['values'][$customField['id']]; $test = $this; $this->_testTimestamps(array( - 'INSERT' => function ($contactId) use ($test, $customGroup, $customField) { - $result = civicrm_api3('contact', 'create', array( + 'INSERT' => function ($contactId) use ($test, $customGroup, $customField) { + $result = civicrm_api3('contact', 'create', array( 'contact_id' => $contactId, 'custom_' . $customField['id'] => 'test-1', )); - }, - 'UPDATE' => function ($contactId) use ($test, $customGroup, $customField) { - CRM_Core_DAO::executeQuery( + }, + 'UPDATE' => function ($contactId) use ($test, $customGroup, $customField) { + CRM_Core_DAO::executeQuery( "UPDATE {$customGroup->table_name} SET {$customField['column_name']} = 'test-2' WHERE entity_id = %1", array(1 => array($contactId, 'Integer')) ); - }, - 'DELETE' => function ($contactId) use ($test, $customGroup, $customField) { - CRM_Core_DAO::executeQuery( + }, + 'DELETE' => function ($contactId) use ($test, $customGroup, $customField) { + CRM_Core_DAO::executeQuery( "DELETE FROM {$customGroup->table_name} WHERE entity_id = %1", array(1 => array($contactId, 'Integer')) ); - }, + }, )); Custom::deleteGroup($customGroup); diff --git a/tests/phpunit/CRM/Contact/BAO/ContactType/ContactSearchTest.php b/tests/phpunit/CRM/Contact/BAO/ContactType/ContactSearchTest.php index 0408c5d6e1..c232424923 100644 --- a/tests/phpunit/CRM/Contact/BAO/ContactType/ContactSearchTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ContactType/ContactSearchTest.php @@ -42,7 +42,6 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { $result = CRM_Contact_BAO_ContactType::add($params); $this->sponsor = $params['name']; - $this->indiviParams = array( 'first_name' => 'Anne', 'last_name' => 'Grant', @@ -253,25 +252,21 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { $result = civicrm_api('contact', 'get', $params); $this->assertEquals(empty($result['values']), TRUE, 'In line ' . __LINE__); - // for invalid subtype $params = array('contact_sub_type' => 'Invalid', 'version' => 3); $result = civicrm_api('contact', 'get', $params); $this->assertEquals(empty($result['values']), TRUE, 'In line ' . __LINE__); - // for invalid contact type as well as subtype $params = array('contact_type' => 'Invalid' . CRM_Core_DAO::VALUE_SEPARATOR . 'Invalid', 'version' => 3); $result = civicrm_api('contact', 'get', $params); $this->assertEquals(empty($result['values']), TRUE, 'In line ' . __LINE__); - // for valid type and invalid subtype $params = array('contact_type' => 'Individual' . CRM_Core_DAO::VALUE_SEPARATOR . 'Invalid', 'version' => 3); $result = civicrm_api('contact', 'get', $params); $this->assertEquals(empty($result['values']), TRUE, 'In line ' . __LINE__); - // for invalid type and valid subtype $params = array('contact_type' => 'Invalid' . CRM_Core_DAO::VALUE_SEPARATOR . 'indivi_student', 'version' => 3); $result = civicrm_api('contact', 'get', $params); @@ -294,13 +289,11 @@ class CRM_Contact_BAO_ContactType_ContactSearchTest extends CiviUnitTestCase { $result = civicrm_api('contact', 'get', $params, $defaults); $this->assertEquals(empty($result['values']), TRUE, 'In line ' . __LINE__); - // for type:Household subtype:Sponsor $params = array('contact_type' => 'Household' . CRM_Core_DAO::VALUE_SEPARATOR . $this->sponsor, 'version' => 3); $result = civicrm_api('contact', 'get', $params, $defaults); $this->assertEquals(empty($result['values']), TRUE, 'In line ' . __LINE__); - // for type:Household subtype:Student $params = array('contact_type' => 'Household' . CRM_Core_DAO::VALUE_SEPARATOR . $this->student, 'version' => 3); $result = civicrm_api('contact', 'get', $params, $defaults); diff --git a/tests/phpunit/CRM/Contact/BAO/ContactType/ContactTest.php b/tests/phpunit/CRM/Contact/BAO/ContactType/ContactTest.php index fc37f2bf7f..c9130eca1f 100644 --- a/tests/phpunit/CRM/Contact/BAO/ContactType/ContactTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ContactType/ContactTest.php @@ -29,7 +29,6 @@ class CRM_Contact_BAO_ContactType_ContactTest extends CiviUnitTestCase { $result = CRM_Contact_BAO_ContactType::add($params); $this->parent = $params['name']; - $params = array( 'label' => 'org_sponsor', 'name' => 'org_sponsor', @@ -219,7 +218,6 @@ DELETE FROM civicrm_contact_type $this->assertEquals(str_replace(CRM_Core_DAO::VALUE_SEPARATOR, '', $updatedContact->contact_sub_type), $this->parent, 'In line ' . __LINE__); CRM_Contact_BAO_Contact::deleteContact($contact->id); - $params = array( 'organization_name' => 'Compumentor', 'contact_type' => 'Organization', @@ -245,7 +243,6 @@ DELETE FROM civicrm_contact_type $this->assertEquals(str_replace(CRM_Core_DAO::VALUE_SEPARATOR, '', $updatedContact->contact_sub_type), $this->team, 'In line ' . __LINE__); CRM_Contact_BAO_Contact::deleteContact($contact->id); - $params = array( 'first_name' => 'Anne', 'last_name' => 'Grant', diff --git a/tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php b/tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php index 0fda158d4c..ee546ab689 100644 --- a/tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php +++ b/tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php @@ -32,7 +32,7 @@ require_once 'CiviTest/Contact.php'; /** * Test class for CRM_Contact_BAO_GroupContact BAO * - * @package CiviCRM + * @package CiviCRM */ class CRM_Contact_BAO_GroupContactCacheTest extends CiviUnitTestCase { @@ -216,8 +216,7 @@ class CRM_Contact_BAO_GroupContactCacheTest extends CiviUnitTestCase { * * @see CRM_Core_DAO::createTestObject */ - function createTestObject($daoName, $params = array( - ), $numObjects = 1, $createOnly = FALSE) { + function createTestObject($daoName, $params = array(), $numObjects = 1, $createOnly = FALSE) { $objects = CRM_Core_DAO::createTestObject($daoName, $params, $numObjects, $createOnly); if (is_array($objects)) { $this->registerTestObjects($objects); diff --git a/tests/phpunit/CRM/Contact/BAO/GroupContactTest.php b/tests/phpunit/CRM/Contact/BAO/GroupContactTest.php index 6296fc2323..35a966b168 100644 --- a/tests/phpunit/CRM/Contact/BAO/GroupContactTest.php +++ b/tests/phpunit/CRM/Contact/BAO/GroupContactTest.php @@ -32,7 +32,7 @@ require_once 'CiviTest/Contact.php'; /** * Test class for CRM_Contact_BAO_GroupContact BAO * - * @package CiviCRM + * @package CiviCRM */ class CRM_Contact_BAO_GroupContactTest extends CiviUnitTestCase { @@ -50,7 +50,8 @@ class CRM_Contact_BAO_GroupContactTest extends CiviUnitTestCase { * This method is called after a test is executed. * */ - protected function tearDown() {} + protected function tearDown() { + } /** * Test case for add( ) @@ -62,10 +63,12 @@ class CRM_Contact_BAO_GroupContactTest extends CiviUnitTestCase { $groupContacts = CRM_Core_DAO::createTestObject('CRM_Contact_DAO_GroupContact', NULL, 10); //check the group contact id is not null for each of them - foreach ($groupContacts as $gc) $this->assertNotNull($gc->id); + foreach ($groupContacts as $gc) { $this->assertNotNull($gc->id); + } //cleanup - foreach ($groupContacts as $gc) $gc->deleteTestObjects('CRM_Contact_DAO_GroupContact'); + foreach ($groupContacts as $gc) { $gc->deleteTestObjects('CRM_Contact_DAO_GroupContact'); + } } /** @@ -73,7 +76,6 @@ class CRM_Contact_BAO_GroupContactTest extends CiviUnitTestCase { */ public function testGetGroupId() { - //creates a test groupContact object //force group_id to 1 so we can compare $groupContact = CRM_Core_DAO::createTestObject('CRM_Contact_DAO_GroupContact'); diff --git a/tests/phpunit/CRM/Contact/BAO/GroupTest.php b/tests/phpunit/CRM/Contact/BAO/GroupTest.php index f0b746ae58..c6aaf8a8e5 100644 --- a/tests/phpunit/CRM/Contact/BAO/GroupTest.php +++ b/tests/phpunit/CRM/Contact/BAO/GroupTest.php @@ -31,7 +31,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for CRM_Contact_BAO_Group BAO * - * @package CiviCRM + * @package CiviCRM */ class CRM_Contact_BAO_GroupTest extends CiviUnitTestCase { diff --git a/tests/phpunit/CRM/Contact/BAO/QueryTest.php b/tests/phpunit/CRM/Contact/BAO/QueryTest.php index 4d45fef852..8dd9886069 100644 --- a/tests/phpunit/CRM/Contact/BAO/QueryTest.php +++ b/tests/phpunit/CRM/Contact/BAO/QueryTest.php @@ -32,7 +32,7 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase { /** * Test CRM_Contact_BAO_Query::searchQuery() - * @dataProvider dataProvider + * @dataProvider dataProvider */ public function testSearch($fv, $count, $ids, $full) { $op = new PHPUnit_Extensions_Database_Operation_Insert(); @@ -68,7 +68,7 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase { public function testSearchProfileHomeCityCRM14263() { $contactID = $this->individualCreate(); CRM_Core_Config::singleton()->defaultSearchProfileID = 1; - $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,)); + $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1)); $params = array( 0 => array( 0 => 'city-1', @@ -106,7 +106,7 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase { public function testSearchProfileHomeCityNoResultsCRM14263() { $contactID = $this->individualCreate(); CRM_Core_Config::singleton()->defaultSearchProfileID = 1; - $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,)); + $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1)); $params = array( 0 => array( 0 => 'city-1', @@ -136,17 +136,17 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase { } } - /** - * CRM-14263 search builder failure with search profile & address in criteria - * We are retrieving primary here - checking the actual sql seems super prescriptive - but since the massive query object has - * so few tests detecting any change seems good here :-) - */ - public function testSearchProfilePrimaryCityCRM14263() + /** + * CRM-14263 search builder failure with search profile & address in criteria + * We are retrieving primary here - checking the actual sql seems super prescriptive - but since the massive query object has + * so few tests detecting any change seems good here :-) + */ + public function testSearchProfilePrimaryCityCRM14263() { - $contactID = $this->individualCreate(); - CRM_Core_Config::singleton()->defaultSearchProfileID = 1; - $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,)); - $params = array( + $contactID = $this->individualCreate(); + CRM_Core_Config::singleton()->defaultSearchProfileID = 1; + $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1)); + $params = array( 0 => array( 0 => 'city', 1 => '=', @@ -155,23 +155,23 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase { 4 => 0, ) ); - $returnProperties = array( + $returnProperties = array( 'contact_type' => 1, 'contact_sub_type' => 1, 'sort_name' => 1, ); - $expectedSQL = "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, civicrm_address.id as address_id, civicrm_address.city as `city` FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id AND civicrm_address.is_primary = 1 ) WHERE ( ( LOWER(civicrm_address.city) = 'cool city' ) ) AND (contact_a.is_deleted = 0) ORDER BY contact_a.sort_name asc, contact_a.id "; - $queryObj = new CRM_Contact_BAO_Query($params, $returnProperties); - try { - $this->assertEquals($expectedSQL ,$queryObj->searchQuery(0, 0, NULL, + $expectedSQL = "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, civicrm_address.id as address_id, civicrm_address.city as `city` FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id AND civicrm_address.is_primary = 1 ) WHERE ( ( LOWER(civicrm_address.city) = 'cool city' ) ) AND (contact_a.is_deleted = 0) ORDER BY contact_a.sort_name asc, contact_a.id "; + $queryObj = new CRM_Contact_BAO_Query($params, $returnProperties); + try { + $this->assertEquals($expectedSQL, $queryObj->searchQuery(0, 0, NULL, FALSE, FALSE, FALSE, FALSE, TRUE)); - } - catch (PEAR_Exception $e) { - $err = $e->getCause(); - $this->fail('invalid SQL created' . $e->getMessage() . " " . $err->userinfo); + } + catch (PEAR_Exception $e) { + $err = $e->getCause(); + $this->fail('invalid SQL created' . $e->getMessage() . " " . $err->userinfo); - } } + } } diff --git a/tests/phpunit/CRM/Contact/BAO/QueryTestDataProvider.php b/tests/phpunit/CRM/Contact/BAO/QueryTestDataProvider.php index ef9ecbca1c..35062efcd9 100644 --- a/tests/phpunit/CRM/Contact/BAO/QueryTestDataProvider.php +++ b/tests/phpunit/CRM/Contact/BAO/QueryTestDataProvider.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: GroupTestDataProvider.php 23715 2009-09-21 06:35:47Z shot $ - * @package CiviCRM + * @version $Id: GroupTestDataProvider.php 23715 2009-09-21 06:35:47Z shot $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -33,17 +33,17 @@ /** * Provide data to the CRM_Contact_BAO_QueryTest class * - * @package CiviCRM + * @package CiviCRM */ class CRM_Contact_BAO_QueryTestDataProvider implements Iterator { /** - * @var integer + * @var integer */ private $i = 0; /** - * @var mixed[] + * @var mixed[] * This dataset describes various form values and what contact * IDs should be selected when the form values are applied to the * database in dataset.xml diff --git a/tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTest.php b/tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTest.php index 3699a844ad..8736550248 100644 --- a/tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTest.php +++ b/tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTest.php @@ -4,11 +4,11 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @package CiviCRM + * @package CiviCRM * * This file is part of CiviCRM * @@ -51,7 +51,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test contact custom search functions * - * @package CiviCRM + * @package CiviCRM */ class CRM_Contact_Form_Search_Custom_GroupTest extends CiviUnitTestCase { protected $_tablesToTruncate = array( @@ -76,11 +76,12 @@ class CRM_Contact_Form_Search_Custom_GroupTest extends CiviUnitTestCase { parent::setUp(); } - public function tearDown() {} + public function tearDown() { + } /** * Test CRM_Contact_Form_Search_Custom_Group::count() - * @dataProvider dataProvider + * @dataProvider dataProvider */ public function testCount($fv, $count, $ids, $full) { $this->foreignKeyChecksOff(); @@ -100,10 +101,10 @@ class CRM_Contact_Form_Search_Custom_GroupTest extends CiviUnitTestCase { $dao = CRM_Core_DAO::executeQuery($sql); /** - echo "Count: $count, OBJ: ", $obj->count( ) . "\n"; - while ( $dao->fetch( ) ) { - echo "{$dao->contact_id}, {$dao->contact_type}, {$dao->sort_name}, {$dao->group_names}\n"; - } + echo "Count: $count, OBJ: ", $obj->count( ) . "\n"; + while ( $dao->fetch( ) ) { + echo "{$dao->contact_id}, {$dao->contact_type}, {$dao->sort_name}, {$dao->group_names}\n"; + } **/ $this->assertEquals($count, $obj->count(), 'In line ' . __LINE__ @@ -112,7 +113,7 @@ class CRM_Contact_Form_Search_Custom_GroupTest extends CiviUnitTestCase { /** * Test CRM_Contact_Form_Search_Custom_Group::all() - * @dataProvider dataProvider + * @dataProvider dataProvider */ public function testAll($fv, $count, $ids, $full) { // Truncate affected tables @@ -143,7 +144,7 @@ class CRM_Contact_Form_Search_Custom_GroupTest extends CiviUnitTestCase { /** * Test CRM_Contact_Form_Search_Custom_Group::contactIDs() - * @dataProvider dataProvider + * @dataProvider dataProvider */ public function testContactIDs($fv, $count, $ids, $full) { // Truncate affected tables @@ -186,9 +187,10 @@ class CRM_Contact_Form_Search_Custom_GroupTest extends CiviUnitTestCase { /** * Test CRM_Contact_Form_Search_Custom_Group::from() - * @todo write this test + * @todo write this test */ - public function SKIPPED_testFrom() {} + public function SKIPPED_testFrom() { + } /** * Test CRM_Contact_Form_Search_Custom_Group::summary() diff --git a/tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTestDataProvider.php b/tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTestDataProvider.php index 9f5e3cf922..714202a947 100644 --- a/tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTestDataProvider.php +++ b/tests/phpunit/CRM/Contact/Form/Search/Custom/GroupTestDataProvider.php @@ -5,12 +5,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: GroupTestDataProvider.php 44314 2012-12-19 11:12:49Z kurund $ - * @package CiviCRM + * @version $Id: GroupTestDataProvider.php 44314 2012-12-19 11:12:49Z kurund $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -32,45 +32,49 @@ /** * Provide data to the CRM_Contact_Form_Search_Custom_GroupTest class * - * @package CiviCRM + * @package CiviCRM */ class CRM_Contact_Form_Search_Custom_GroupTestDataProvider implements Iterator { /** - * @var integer + * @var integer */ private $i = 0; /** - * @var mixed[] + * @var mixed[] * This dataset describes various form values and what contact * IDs should be selected when the form values are applied to the * database in dataset.xml */ private $dataset = array( // Exclude static group 3 - array('fv' => array('excludeGroups' => array('3')), + array( + 'fv' => array('excludeGroups' => array('3')), 'id' => array( '9', '10', '11', '12', '13', '14', '15', '16', '26', ), ), // Include static group 3 - array('fv' => array('includeGroups' => array('3')), + array( + 'fv' => array('includeGroups' => array('3')), 'id' => array( '17', '18', '19', '20', '21', '22', '23', '24', '27', '28', ), ), // Include static group 5 - array('fv' => array('includeGroups' => array('5')), + array( + 'fv' => array('includeGroups' => array('5')), 'id' => array( '13', '14', '15', '16', '21', '22', '23', '24', ), ), // Include static groups 3 and 5 - array('fv' => array('includeGroups' => array('3', '5')), + array( + 'fv' => array('includeGroups' => array('3', '5')), 'id' => array( '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', @@ -78,34 +82,40 @@ class CRM_Contact_Form_Search_Custom_GroupTestDataProvider implements Iterator { ), ), // Include static group 3, exclude static group 5 - array('fv' => array('includeGroups' => array('3'), + array( + 'fv' => array( + 'includeGroups' => array('3'), 'excludeGroups' => array('5'), ), 'id' => array('17', '18', '19', '20', '27', '28'), ), // Exclude tag 7 - array('fv' => array('excludeTags' => array('7')), + array( + 'fv' => array('excludeTags' => array('7')), 'id' => array( '9', '10', '13', '14', '17', '18', '21', '22', '27', ), ), // Include tag 7 - array('fv' => array('includeTags' => array('7')), + array( + 'fv' => array('includeTags' => array('7')), 'id' => array( '11', '12', '15', '16', '19', '20', '23', '24', '26', '28', ), ), // Include tag 9 - array('fv' => array('includeTags' => array('9')), + array( + 'fv' => array('includeTags' => array('9')), 'id' => array( '10', '12', '14', '16', '18', '20', '22', '24', ), ), // Include tags 7 and 9 - array('fv' => array('includeTags' => array('7', '9')), + array( + 'fv' => array('includeTags' => array('7', '9')), 'id' => array( '10', '11', '12', '14', '15', '16', '18', '19', '20', '22', '23', '24', @@ -113,7 +123,9 @@ class CRM_Contact_Form_Search_Custom_GroupTestDataProvider implements Iterator { ), ), // Include tag 7, exclude tag 9 - array('fv' => array('includeTags' => array('7'), + array( + 'fv' => array( + 'includeTags' => array('7'), 'excludeTags' => array('9'), ), 'id' => array('11', '15', '19', '23', '26', '28'), @@ -141,19 +153,25 @@ class CRM_Contact_Form_Search_Custom_GroupTestDataProvider implements Iterator { 'id' => array('19', '20', '23', '24', '28'), ), // Include static group 3, exclude tag 7 - array('fv' => array('includeGroups' => array('3'), + array( + 'fv' => array( + 'includeGroups' => array('3'), 'excludeTags' => array('7'), ), 'id' => array('17', '18', '21', '22', '27'), ), // Include tag 9, exclude static group 5 - array('fv' => array('includeTags' => array('9'), + array( + 'fv' => array( + 'includeTags' => array('9'), 'excludeGroups' => array('5'), ), - 'id' => array('10','12','18','20'), + 'id' => array('10', '12', '18', '20'), ), // Exclude tag 9, exclude static group 5 - array('fv' => array('excludeTags' => array('9'), + array( + 'fv' => array( + 'excludeTags' => array('9'), 'excludeGroups' => array('5'), ), 'id' => array( @@ -162,21 +180,24 @@ class CRM_Contact_Form_Search_Custom_GroupTestDataProvider implements Iterator { ), ), // Include smart group 6 - array('fv' => array('includeGroups' => array('6')), + array( + 'fv' => array('includeGroups' => array('6')), 'id' => array( '9', '10', '11', '12', '13', '14', '15', '16', '26', ), ), // Include smart group 4 - array('fv' => array('includeGroups' => array('4')), + array( + 'fv' => array('includeGroups' => array('4')), 'id' => array( '17', '18', '19', '20', '21', '22', '23', '24', '27', '28', ), ), // Include smart group 4 and static group 5 - array('fv' => array('includeGroups' => array('4', '5')), + array( + 'fv' => array('includeGroups' => array('4', '5')), 'id' => array( '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', diff --git a/tests/phpunit/CRM/Contribute/AllTests.php b/tests/phpunit/CRM/Contribute/AllTests.php index fe38d0590e..984796b319 100644 --- a/tests/phpunit/CRM/Contribute/AllTests.php +++ b/tests/phpunit/CRM/Contribute/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Contribute_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionPageTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionPageTest.php index 24d44749f2..f95bdc7385 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionPageTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionPageTest.php @@ -69,7 +69,6 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase { 'is_credit_card_only' => '', ); - $contributionpage = CRM_Contribute_BAO_ContributionPage::create($params); $this->assertNotNull($contributionpage->id); @@ -92,7 +91,7 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase { $id = $contributionpage->id; $is_active = 1; $pageActive = CRM_Contribute_BAO_ContributionPage::setIsActive($id, $is_active); - $this->assertEquals($pageActive, true, 'Verify financial types record deletion.'); + $this->assertEquals($pageActive, TRUE, 'Verify financial types record deletion.'); ContributionPage::delete($contributionpage->id); } @@ -142,7 +141,6 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase { 'is_credit_card_only' => '', ); - $contributionpage = CRM_Contribute_BAO_ContributionPage::create($params); $copycontributionpage = CRM_Contribute_BAO_ContributionPage::copy($contributionpage->id); $this->assertEquals($copycontributionpage->financial_type_id, $this->_financialTypeID, 'Check for Financial type id.'); diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php index 5ef6804f8c..fdd1cd2feb 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php @@ -126,7 +126,6 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase { 'thankyou_date' => '20080522', ); - $params['custom'] = array( $customField->id => array( -1 => array( @@ -141,7 +140,6 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase { ), ); - $contribution = CRM_Contribute_BAO_Contribution::create($params, $ids); // Check that the custom field value is saved @@ -269,7 +267,7 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase { $annual = CRM_Contribute_BAO_Contribution::annual($contactId); $config = CRM_Core_Config::singleton(); - $currencySymbol = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_Currency',$config->defaultCurrency,'symbol','name') ; + $currencySymbol = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_Currency', $config->defaultCurrency, 'symbol', 'name'); $this->assertDBCompareValue('CRM_Contribute_DAO_Contribution', $id, 'total_amount', 'id', ltrim($annual[2], $currencySymbol), 'Check DB for total amount of the contribution' ); @@ -352,7 +350,6 @@ class CRM_Contribute_BAO_ContributionTest extends CiviUnitTestCase { 'premium' => NULL, ); - $params = array( 'name' => 'TEST Premium', 'sku' => 111, diff --git a/tests/phpunit/CRM/Core/AllTests.php b/tests/phpunit/CRM/Core/AllTests.php index 1ba9fbac45..7f3a088f46 100644 --- a/tests/phpunit/CRM/Core/AllTests.php +++ b/tests/phpunit/CRM/Core/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Core_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php index a1467ea9c8..97649c8019 100644 --- a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php +++ b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php @@ -41,7 +41,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { parent::setUp(); require_once 'CiviTest/CiviMailUtils.php'; - $this->mut = new CiviMailUtils($this, true); + $this->mut = new CiviMailUtils($this, TRUE); $this->fixtures['rolling_membership'] = array( // createTestObject 'membership_type_id' => array( @@ -436,7 +436,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { $activity = $this->createTestObject('CRM_Activity_DAO_Activity', $this->fixtures['phonecall']); $this->assertTrue(is_numeric($activity->id)); - $contact = $this->callAPISuccess('contact', 'create', $this->fixtures['contact']); + $contact = $this->callAPISuccess('contact', 'create', $this->fixtures['contact']); $activity->save(); $source['contact_id'] = $contact['id']; @@ -467,12 +467,12 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { $activity = $this->createTestObject('CRM_Activity_DAO_Activity', $this->fixtures['phonecall']); $this->assertTrue(is_numeric($activity->id)); - $contact = $this->callAPISuccess('contact', 'create', $this->fixtures['contact']); + $contact = $this->callAPISuccess('contact', 'create', $this->fixtures['contact']); $activity->save(); $source['contact_id'] = $contact['id']; $source['activity_id'] = $activity->id; - $source['record_type_id'] =2; + $source['record_type_id'] = 2; $activityContact = $this->createTestObject('CRM_Activity_DAO_ActivityContact', $source); $activityContact->save(); @@ -665,14 +665,14 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { /** - * For contacts/members which match schedule based on end date, - * an email should be sent. - */ + * For contacts/members which match schedule based on end date, + * an email should be sent. + */ public function testMembershipEndDate_NoMatch() { // creates membership with end_date = 20120615 $membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership_past'], array('status_id' => 3))); $this->assertTrue(is_numeric($membership->id)); - $result = $this->callAPISuccess('Email', 'create', array( + $result = $this->callAPISuccess('Email', 'create', array( 'contact_id' => $membership->contact_id, 'email' => 'test-member@example.com', )); @@ -716,7 +716,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { } public function testContactBirthDate_Anniv() { - $contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']); + $contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']); $this->_testObjects['CRM_Contact_DAO_Contact'][] = $contact['id']; $actionSchedule = $this->fixtures['sched_contact_bday_anniv']; $actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule); @@ -739,7 +739,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'name' => 'test_group', 'extends' => array('Individual'), 'style' => 'Inline', - 'is_multiple' => false, + 'is_multiple' => FALSE, 'is_active' => 1, ); $createGroup = $this->callAPISuccess('custom_group', 'create', $group); @@ -768,7 +768,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'recipients' => array(array('test-member@example.com')), ), )); - $this->callAPISuccess('custom_group', 'delete', array('id' => $createGroup['id'],)); + $this->callAPISuccess('custom_group', 'delete', array('id' => $createGroup['id'])); } /** * Check that limit_to + an empty recipients doesn't sent to multiple contacts @@ -810,7 +810,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'name' => 'test_group_now', 'extends' => array('Individual'), 'style' => 'Inline', - 'is_multiple' => false, + 'is_multiple' => FALSE, 'is_active' => 1, ); $createGroup = $this->callAPISuccess('custom_group', 'create', $group); @@ -840,7 +840,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'recipients' => array(array('test-member@example.com')), ), )); - $this->callAPISuccess('custom_group', 'delete', array('id' => $createGroup['id'],)); + $this->callAPISuccess('custom_group', 'delete', array('id' => $createGroup['id'])); } // TODO // function testMembershipEndDate_NonMatch() { } @@ -902,8 +902,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { * * @see CRM_Core_DAO::createTestObject */ - function createTestObject($daoName, $params = array( - ), $numObjects = 1, $createOnly = FALSE) { + function createTestObject($daoName, $params = array(), $numObjects = 1, $createOnly = FALSE) { $objects = CRM_Core_DAO::createTestObject($daoName, $params, $numObjects, $createOnly); if (is_array($objects)) { $this->registerTestObjects($objects); diff --git a/tests/phpunit/CRM/Core/BAO/AddressTest.php b/tests/phpunit/CRM/Core/BAO/AddressTest.php index e12c776a4d..1884f7ea12 100644 --- a/tests/phpunit/CRM/Core/BAO/AddressTest.php +++ b/tests/phpunit/CRM/Core/BAO/AddressTest.php @@ -63,7 +63,6 @@ class CRM_Core_BAO_AddressTest extends CiviUnitTestCase { $params['contact_id'] = $contactId; - $fixAddress = TRUE; CRM_Core_BAO_Address::create($params, $fixAddress, $entity = NULL); @@ -91,7 +90,6 @@ class CRM_Core_BAO_AddressTest extends CiviUnitTestCase { ); $params['contact_id'] = $contactId; - $block = CRM_Core_BAO_Address::create($params, $fixAddress, $entity = NULL); $cid = $this->assertDBNotNull('CRM_Core_DAO_Address', $contactId, 'id', 'contact_id', diff --git a/tests/phpunit/CRM/Core/BAO/CustomFieldTest.php b/tests/phpunit/CRM/Core/BAO/CustomFieldTest.php index 5110912e7e..055401a2e5 100644 --- a/tests/phpunit/CRM/Core/BAO/CustomFieldTest.php +++ b/tests/phpunit/CRM/Core/BAO/CustomFieldTest.php @@ -115,7 +115,6 @@ class CRM_Core_BAO_CustomFieldTest extends CiviUnitTestCase { //$this->assertEquals( 'testFld1', $getCustomFields[$customFieldID1][0], 'Confirm First Custom field label' ); //$this->assertEquals( 'testFld2', $getCustomFields[$customFieldID2][0], 'Confirm Second Custom field label' ); - Custom::deleteGroup($customGroup); } @@ -192,22 +191,19 @@ class CRM_Core_BAO_CustomFieldTest extends CiviUnitTestCase { )), ); $fields = array( - 'countryA' => Custom::createField(array( - ), array( + 'countryA' => Custom::createField(array(), array( 'groupId' => $groups['A']->id, 'label' => 'Country A', 'dataType' => 'Country', 'htmlType' => 'Select Country', )), - 'countryB' => Custom::createField(array( - ), array( + 'countryB' => Custom::createField(array(), array( 'groupId' => $groups['A']->id, 'label' => 'Country B', 'dataType' => 'Country', 'htmlType' => 'Select Country', )), - 'countryC' => Custom::createField(array( - ), array( + 'countryC' => Custom::createField(array(), array( 'groupId' => $groups['B']->id, 'label' => 'Country C', 'dataType' => 'Country', diff --git a/tests/phpunit/CRM/Core/BAO/CustomGroupTest.php b/tests/phpunit/CRM/Core/BAO/CustomGroupTest.php index 6e0775e3dc..a7a8fa572d 100644 --- a/tests/phpunit/CRM/Core/BAO/CustomGroupTest.php +++ b/tests/phpunit/CRM/Core/BAO/CustomGroupTest.php @@ -434,7 +434,6 @@ class CRM_Core_BAO_CustomGroupTest extends CiviUnitTestCase { 'version' => 3, ); - $customGroup = Custom::createGroup($groupParams); $activeGroup = CRM_Core_BAO_CustomGroup::getActiveGroups('Individual', 'civicrm/contact/view/cd', $contactId); foreach ($activeGroup as $key => $value) { diff --git a/tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php b/tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php index 4e22f227fa..235351b6a6 100644 --- a/tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php +++ b/tests/phpunit/CRM/Core/BAO/CustomValueTableSetGetTest.php @@ -68,7 +68,7 @@ class CRM_Core_BAO_CustomValueTableSetGetTest extends CiviUnitTestCase { ); $errorScope = CRM_Core_TemporaryErrorScope::useException(); - $message = null; + $message = NULL; try { $result = CRM_Core_BAO_CustomValueTable::setValues($params); } catch ( Exception $e ) { @@ -161,7 +161,6 @@ class CRM_Core_BAO_CustomValueTableSetGetTest extends CiviUnitTestCase { 'Verify that the boolean value is stored for contact ' . $contactID ); - // Now set YesNo radio to an invalid boolean value and try to reset $badYesNo = '20'; $params = array( @@ -170,7 +169,7 @@ class CRM_Core_BAO_CustomValueTableSetGetTest extends CiviUnitTestCase { ); $errorScope = CRM_Core_TemporaryErrorScope::useException(); - $message = null; + $message = NULL; try { $result = CRM_Core_BAO_CustomValueTable::setValues($params); } catch (Exception $e) { diff --git a/tests/phpunit/CRM/Core/BAO/CustomValueTest.php b/tests/phpunit/CRM/Core/BAO/CustomValueTest.php index 2c551f4fe1..938d7e5461 100644 --- a/tests/phpunit/CRM/Core/BAO/CustomValueTest.php +++ b/tests/phpunit/CRM/Core/BAO/CustomValueTest.php @@ -49,7 +49,7 @@ class CRM_Core_BAO_CustomValueTest extends CiviUnitTestCase { 'Int' => 1, 'Float' => 10.00, 'Date' => '2008-06-24', - 'Boolean' => True, + 'Boolean' => TRUE, 'StateProvince' => 'California', 'Country' => 'US', 'Link' => 'http://civicrm.org', @@ -60,7 +60,7 @@ class CRM_Core_BAO_CustomValueTest extends CiviUnitTestCase { $this->assertEquals($valid, '2008-06-24', 'Checking type ' . $type . ' for returned CustomField Type.'); } else { - $this->assertEquals($valid, true, 'Checking type ' . $type . ' for returned CustomField Type.'); + $this->assertEquals($valid, TRUE, 'Checking type ' . $type . ' for returned CustomField Type.'); } } } diff --git a/tests/phpunit/CRM/Core/BAO/LocationTest.php b/tests/phpunit/CRM/Core/BAO/LocationTest.php index 5bc48c9edc..e545631432 100644 --- a/tests/phpunit/CRM/Core/BAO/LocationTest.php +++ b/tests/phpunit/CRM/Core/BAO/LocationTest.php @@ -292,7 +292,8 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase { ); //Now check DB for location elements. - $searchParams = array('id' => CRM_Utils_Array::value('address_id', $locElementIds), + $searchParams = array( + 'id' => CRM_Utils_Array::value('address_id', $locElementIds), 'location_type_id' => 1, 'is_primary' => 1, ); @@ -309,15 +310,16 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase { ); $this->assertDBCompareValues('CRM_Core_DAO_Address', $searchParams, $compareParams); - $searchParams = array('id' => CRM_Utils_Array::value('email_id', $locElementIds), + $searchParams = array( + 'id' => CRM_Utils_Array::value('email_id', $locElementIds), 'location_type_id' => 1, 'is_primary' => 1, ); $compareParams = array('email' => 'john.smith@example.org'); $this->assertDBCompareValues('CRM_Core_DAO_Email', $searchParams, $compareParams); - - $searchParams = array('id' => CRM_Utils_Array::value('phone_id', $locElementIds), + $searchParams = array( + 'id' => CRM_Utils_Array::value('phone_id', $locElementIds), 'location_type_id' => 1, 'is_primary' => 1, 'phone_type_id' => 1, @@ -325,14 +327,16 @@ class CRM_Core_BAO_LocationTest extends CiviUnitTestCase { $compareParams = array('phone' => '303443689'); $this->assertDBCompareValues('CRM_Core_DAO_Phone', $searchParams, $compareParams); - $searchParams = array('id' => CRM_Utils_Array::value('phone_2_id', $locElementIds), + $searchParams = array( + 'id' => CRM_Utils_Array::value('phone_2_id', $locElementIds), 'location_type_id' => 1, 'phone_type_id' => 2, ); $compareParams = array('phone' => '9833910234'); $this->assertDBCompareValues('CRM_Core_DAO_Phone', $searchParams, $compareParams); - $searchParams = array('id' => CRM_Utils_Array::value('im_id', $locElementIds), + $searchParams = array( + 'id' => CRM_Utils_Array::value('im_id', $locElementIds), 'location_type_id' => 1, 'is_primary' => 1, ); diff --git a/tests/phpunit/CRM/Core/BAO/PhoneTest.php b/tests/phpunit/CRM/Core/BAO/PhoneTest.php index 9a92a1873d..39fa33a468 100644 --- a/tests/phpunit/CRM/Core/BAO/PhoneTest.php +++ b/tests/phpunit/CRM/Core/BAO/PhoneTest.php @@ -114,5 +114,6 @@ class CRM_Core_BAO_PhoneTest extends CiviUnitTestCase { * AllEntityPhones() method - get all Phones for a location block, with primary Phone first * @todo FIXME: Fixing this test requires add helper functions in CiviTest to create location block and phone and link them to an event. Punting to 3.1 cycle. DGG */ - public function SKIPPED_testAllEntityPhones() {} + public function SKIPPED_testAllEntityPhones() { + } } diff --git a/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php b/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php index 756a450467..7abc2361ef 100644 --- a/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php +++ b/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php @@ -47,7 +47,8 @@ class CRM_Core_BAO_RecurringEntityTest extends CiviUnitTestCase { * This method is called after a test is executed. * */ - protected function tearDown() {} + protected function tearDown() { + } /** * Testing Activity Generation through Entity Recursion @@ -112,7 +113,7 @@ class CRM_Core_BAO_RecurringEntityTest extends CiviUnitTestCase { * Testing Event Generation through Entity Recursion */ public function testEventGeneration() { - //Event set initial params + //Event set initial params $daoEvent = new CRM_Event_DAO_Event(); $daoEvent->title = 'Test event for Recurring Entity'; $daoEvent->event_type_id = 3; @@ -138,7 +139,7 @@ class CRM_Core_BAO_RecurringEntityTest extends CiviUnitTestCase { $recursion->entity_id = $daoEvent->id; $recursion->entity_table = 'civicrm_event'; $recursion->dateColumns = array('start_date'); - $recursion->schedule = array ( + $recursion->schedule = array( 'entity_value' => $daoEvent->id, 'start_action_date' => $daoEvent->start_date, 'start_action_condition' => 'monday', diff --git a/tests/phpunit/CRM/Core/BAO/SettingTest.php b/tests/phpunit/CRM/Core/BAO/SettingTest.php index d0791870cc..a7ef13af41 100644 --- a/tests/phpunit/CRM/Core/BAO/SettingTest.php +++ b/tests/phpunit/CRM/Core/BAO/SettingTest.php @@ -131,7 +131,7 @@ class CRM_Core_BAO_SettingTest extends CiviUnitTestCase { $currentDomain = CRM_Core_Config::domainID(); // we are setting up an artificial situation here as we are trying to drive out // previous memory of this setting so we need to flush it out - $cachekey = CRM_Core_BAO_Setting::inCache('CiviCRM Preferences', 'max_attachments', NULL, NULL, TRUE, $currentDomain); + $cachekey = CRM_Core_BAO_Setting::inCache('CiviCRM Preferences', 'max_attachments', NULL, NULL, TRUE, $currentDomain); CRM_Core_BAO_Setting::flushCache($cachekey); CRM_Core_BAO_Setting::updateSettingsFromMetaData(); //check current domain diff --git a/tests/phpunit/CRM/Core/BAO/UFFieldTest.php b/tests/phpunit/CRM/Core/BAO/UFFieldTest.php index 70bdcfc339..93effc4684 100644 --- a/tests/phpunit/CRM/Core/BAO/UFFieldTest.php +++ b/tests/phpunit/CRM/Core/BAO/UFFieldTest.php @@ -176,11 +176,11 @@ class CRM_Core_BAO_UFFieldTest extends CiviUnitTestCase { * Make sure that the existence of a profile doesn't break listing all fields * public function testGetAvailable_mixed() { - // FIXME - $this->testGetAvailable_full(); - // $this->testGetAvailable_byGid(); - $this->testGetAvailable_full(); - // $this->testGetAvailable_byGid(); + // FIXME + $this->testGetAvailable_full(); + // $this->testGetAvailable_byGid(); + $this->testGetAvailable_full(); + // $this->testGetAvailable_byGid(); } // */ /** diff --git a/tests/phpunit/CRM/Core/Config/MailerTest.php b/tests/phpunit/CRM/Core/Config/MailerTest.php index e8201e45bc..1e8de86e7f 100644 --- a/tests/phpunit/CRM/Core/Config/MailerTest.php +++ b/tests/phpunit/CRM/Core/Config/MailerTest.php @@ -56,20 +56,20 @@ class CRM_Core_Config_MailerTest extends CiviUnitTestCase { public function testHookAlterMailer() { $test = $this; $mockMailer = new CRM_Utils_FakeObject(array( - 'send' => function ($recipients, $headers, $body) use ($test) { - $test->calls['send']++; - $test->assertEquals(array('to@example.org'), $recipients); - $test->assertEquals('Subject Example', $headers['Subject']); - } + 'send' => function ($recipients, $headers, $body) use ($test) { + $test->calls['send']++; + $test->assertEquals(array('to@example.org'), $recipients); + $test->assertEquals('Subject Example', $headers['Subject']); + } )); CRM_Utils_Hook::singleton()->setHook('civicrm_alterMailer', function (&$mailer, $driver, $params) use ($test, $mockMailer) { - $test->calls['civicrm_alterMailer']++; - $test->assertTrue(is_string($driver) && !empty($driver)); - $test->assertTrue(is_array($params)); - $test->assertTrue(is_callable(array($mailer, 'send'))); - $mailer = $mockMailer; + $test->calls['civicrm_alterMailer']++; + $test->assertTrue(is_string($driver) && !empty($driver)); + $test->assertTrue(is_array($params)); + $test->assertTrue(is_callable(array($mailer, 'send'))); + $mailer = $mockMailer; } ); diff --git a/tests/phpunit/CRM/Core/ErrorTest.php b/tests/phpunit/CRM/Core/ErrorTest.php index 5ae2faeb2c..d13c267983 100644 --- a/tests/phpunit/CRM/Core/ErrorTest.php +++ b/tests/phpunit/CRM/Core/ErrorTest.php @@ -41,7 +41,7 @@ class CRM_Core_ErrorTest extends CiviUnitTestCase { public function tearDown() { $config = CRM_Core_Config::singleton(); - $config->configAndLogDir= $this->oldConfigAndLogDir; + $config->configAndLogDir = $this->oldConfigAndLogDir; parent::tearDown(); } @@ -80,7 +80,7 @@ class CRM_Core_ErrorTest extends CiviUnitTestCase { $logger2->info('obj-3'); CRM_Core_Error::debug_log_message("static-5"); $this->assertLogRegexp('/static-1.*static-2.*obj-1.*static-3.*obj-2.*static-4.*obj-3.*static-5/s'); -} + } /** * @param $pattern diff --git a/tests/phpunit/CRM/Core/ManagedEntitiesTest.php b/tests/phpunit/CRM/Core/ManagedEntitiesTest.php index 537abfc8e6..b65cc2f6e6 100644 --- a/tests/phpunit/CRM/Core/ManagedEntitiesTest.php +++ b/tests/phpunit/CRM/Core/ManagedEntitiesTest.php @@ -237,7 +237,6 @@ class CRM_Core_ManagedEntitiesTest extends CiviUnitTestCase { $this->assertDBQuery(1, 'SELECT count(*) FROM civicrm_option_value WHERE name = "CRM_Example_One_Foo"'); $this->assertEquals($foo['id'], $foo2['id']); - // Override 'getrefcount' ==> The refcount is 0 $this->adhocProvider->addAction('getrefcount', 'access CiviCRM', function($apiRequest) { return civicrm_api3_create_success(array()); @@ -273,7 +272,7 @@ class CRM_Core_ManagedEntitiesTest extends CiviUnitTestCase { $me->reconcile(); $this->fail('Expected exception when using invalid declaration'); } catch (Exception $e) { - // good + // good } } @@ -298,7 +297,7 @@ class CRM_Core_ManagedEntitiesTest extends CiviUnitTestCase { $me->reconcile(); $this->fail('Expected exception when using invalid declaration'); } catch (Exception $e) { - // good + // good } } @@ -323,7 +322,7 @@ class CRM_Core_ManagedEntitiesTest extends CiviUnitTestCase { $me->reconcile(); $this->fail('Expected exception when using invalid declaration'); } catch (Exception $e) { - // good + // good } } diff --git a/tests/phpunit/CRM/Core/Page/AJAXTest.php b/tests/phpunit/CRM/Core/Page/AJAXTest.php index 0425e75fed..efc6f044b0 100644 --- a/tests/phpunit/CRM/Core/Page/AJAXTest.php +++ b/tests/phpunit/CRM/Core/Page/AJAXTest.php @@ -14,13 +14,12 @@ class CRM_Core_Page_AJAXTest extends CiviUnitTestCase { $cases[] = array('method', 'CRM_Contact_Page_AJAX', TRUE, 'getAddressDisplay'); $cases[] = array('method', 'CRM_Foo_Page_AJAX', FALSE, 'method('); $cases[] = array('method', 'CRM_Foo_Page_AJAX', FALSE, 'method()'); - $cases[] = array('method', 'othermethod;CRM_Foo_Page_AJAX', FALSE,'method'); - $cases[] = array('method', 'CRM_Foo_Page_AJAX;othermethod', FALSE,'method'); + $cases[] = array('method', 'othermethod;CRM_Foo_Page_AJAX', FALSE, 'method'); + $cases[] = array('method', 'CRM_Foo_Page_AJAX;othermethod', FALSE, 'method'); $cases[] = array('method', 'CRM_Foo_Page_Inline_Bar', FALSE, ''); $cases[] = array('method', 'CRM_Foo_Page_Inline_Bar', FALSE, 'method'); $cases[] = array('method', 'CRM_Foo->method', FALSE); - $cases[] = array('page', 'CRM_Foo', FALSE); $cases[] = array('page', 'CRM_Foo_Bar', FALSE); $cases[] = array('page', 'CRM_Foo_Page', FALSE); diff --git a/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php b/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php index b52b068dd1..b0e8dd15e0 100644 --- a/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php +++ b/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php @@ -73,7 +73,7 @@ class CRM_Core_Payment_AuthorizeNetIPNTest extends CiviUnitTestCase { $contribution = $this->callAPISuccess('contribution', 'get', array('contribution_recur_id' => $this->_contributionRecurID, 'sequential' => 1)); $this->assertEquals(2, $contribution['count']); $this->assertEquals('second_one', $contribution['values'][1]['trxn_id']); - $this->callAPISuccessGetSingle('membership_payment', array('contribution_id' => $contribution['values'][1]['id'],)); + $this->callAPISuccessGetSingle('membership_payment', array('contribution_id' => $contribution['values'][1]['id'])); $this->callAPISuccessGetSingle('line_item', array('contribution_id' => $contribution['values'][1]['id'], 'entity_table' => 'civicrm_membership')); } diff --git a/tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php b/tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php index df1b9cc10d..4db64adba8 100644 --- a/tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php +++ b/tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php @@ -51,7 +51,7 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase { // for some strange unknown reason, in batch mode this value gets set to null // so crude hack here to avoid an exception and hence an error - $GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array( ); + $GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array(); } public function tearDown() { diff --git a/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php b/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php index a086ef82d6..4b9555d653 100644 --- a/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php +++ b/tests/phpunit/CRM/Core/Payment/PayPalProIPNTest.php @@ -102,7 +102,7 @@ class CRM_Core_Payment_PayPalProIPNTest extends CiviUnitTestCase { $this->assertEquals('secondone', $contribution['values'][1]['trxn_id']); $this->callAPISuccessGetCount('line_item', array('entity_id' => $this->ids['membership'], 'entity_table' => 'civicrm_membership'), 2); $this->callAPISuccessGetSingle('line_item', array('contribution_id' => $contribution['values'][1]['id'], 'entity_table' => 'civicrm_membership')); - $this->callAPISuccessGetSingle('membership_payment', array('contribution_id' => $contribution['values'][1]['id'],)); + $this->callAPISuccessGetSingle('membership_payment', array('contribution_id' => $contribution['values'][1]['id'])); } /** diff --git a/tests/phpunit/CRM/Core/RegionTest.php b/tests/phpunit/CRM/Core/RegionTest.php index a9dfb8467a..fe869627d4 100644 --- a/tests/phpunit/CRM/Core/RegionTest.php +++ b/tests/phpunit/CRM/Core/RegionTest.php @@ -70,7 +70,7 @@ class CRM_Core_RegionTest extends CiviUnitTestCase { CRM_Core_Region::instance('testAllTypes')->add(array( // note: returns a value which gets appended to the region 'callback' => 'implode', - 'arguments' => array('-', array('callback','with','specific','args
')), + 'arguments' => array('-', array('callback', 'with', 'specific', 'args
')), )); CRM_Core_Region::instance('testAllTypes')->add(array( // note: returns a value which gets appended to the region @@ -108,8 +108,7 @@ class CRM_Core_RegionTest extends CiviUnitTestCase { . "\n" . "\n" . "\n" - . "\n" - ; + . "\n"; $this->assertEquals($expected, $actual); } diff --git a/tests/phpunit/CRM/Core/ResourcesTest.php b/tests/phpunit/CRM/Core/ResourcesTest.php index 9b3f66a808..640b94fc82 100644 --- a/tests/phpunit/CRM/Core/ResourcesTest.php +++ b/tests/phpunit/CRM/Core/ResourcesTest.php @@ -60,15 +60,13 @@ class CRM_Core_ResourcesTest extends CiviUnitTestCase { $this->res ->addScriptFile('com.example.ext', 'foo%20bar.js', 0, 'testAddScriptFile') ->addScriptFile('com.example.ext', 'foo%20bar.js', 0, 'testAddScriptFile') // extra - ->addScriptFile('civicrm', 'foo%20bar.js', 0, 'testAddScriptFile') - ; + ->addScriptFile('civicrm', 'foo%20bar.js', 0, 'testAddScriptFile'); $smarty = CRM_Core_Smarty::singleton(); $actual = $smarty->fetch('string:{crmRegion name=testAddScriptFile}{/crmRegion}'); $expected = "" // stable ordering: alphabetical by (snippet.weight,snippet.name) . "\n" - . "\n" - ; + . "\n"; $this->assertEquals($expected, $actual); } @@ -78,50 +76,45 @@ class CRM_Core_ResourcesTest extends CiviUnitTestCase { * FIXME: This can't work because the tests run in English and CRM_Core_Resources optimizes * away the English data from $settings['strings'] public function testAddScriptFile_strings() { - file_put_contents($this->mapper->keyToBasePath('com.example.ext') . '/hello.js', 'alert(ts("Hello world"));'); - $this->res->addScriptFile('com.example.ext', 'hello.js', 0, 'testAddScriptFile_strings'); - $settings = $this->res->getSettings(); - $expected = array('Hello world'); - $this->assertEquals($expected, $settings['strings']); + file_put_contents($this->mapper->keyToBasePath('com.example.ext') . '/hello.js', 'alert(ts("Hello world"));'); + $this->res->addScriptFile('com.example.ext', 'hello.js', 0, 'testAddScriptFile_strings'); + $settings = $this->res->getSettings(); + $expected = array('Hello world'); + $this->assertEquals($expected, $settings['strings']); } - */ + */ public function testAddScriptURL() { $this->res ->addScriptUrl('/whiz/foo%20bar.js', 0, 'testAddScriptURL') ->addScriptUrl('/whiz/foo%20bar.js', 0, 'testAddScriptURL') // extra - ->addScriptUrl('/whizbang/foo%20bar.js', 0, 'testAddScriptURL') - ; + ->addScriptUrl('/whizbang/foo%20bar.js', 0, 'testAddScriptURL'); $smarty = CRM_Core_Smarty::singleton(); $actual = $smarty->fetch('string:{crmRegion name=testAddScriptURL}{/crmRegion}'); $expected = "" // stable ordering: alphabetical by (snippet.weight,snippet.name) . "\n" - . "\n" - ; + . "\n"; $this->assertEquals($expected, $actual); } public function testAddScript() { $this->res ->addScript('alert("hi");', 0, 'testAddScript') - ->addScript('alert("there");', 0, 'testAddScript') - ; + ->addScript('alert("there");', 0, 'testAddScript'); $smarty = CRM_Core_Smarty::singleton(); $actual = $smarty->fetch('string:{crmRegion name=testAddScript}{/crmRegion}'); $expected = "" . "\n" - . "\n" - ; + . "\n"; $this->assertEquals($expected, $actual); } public function testAddVars() { $this->res ->addVars('food', array('fruit' => array('mine' => 'apple', 'ours' => 'banana'))) - ->addVars('food', array('fruit' => array('mine' => 'new apple', 'yours' => 'orange'))) - ; + ->addVars('food', array('fruit' => array('mine' => 'new apple', 'yours' => 'orange'))); $this->assertTreeEquals( array('vars' => array('food' => array('fruit' => array('yours' => 'orange', 'mine' => 'new apple', 'ours' => 'banana')))), $this->res->getSettings() @@ -131,8 +124,7 @@ class CRM_Core_ResourcesTest extends CiviUnitTestCase { public function testAddSetting() { $this->res ->addSetting(array('fruit' => array('mine' => 'apple'))) - ->addSetting(array('fruit' => array('yours' => 'orange'))) - ; + ->addSetting(array('fruit' => array('yours' => 'orange'))); $this->assertTreeEquals( array('fruit' => array('yours' => 'orange', 'mine' => 'apple')), $this->res->getSettings() @@ -186,8 +178,7 @@ class CRM_Core_ResourcesTest extends CiviUnitTestCase { $actual = $smarty->fetch('string:{crmRegion name=testCrmJS}{/crmRegion}'); $expected = "" // stable ordering: alphabetical by (snippet.weight,snippet.name) . "\n" - . "\n" - ; + . "\n"; $this->assertEquals($expected, $actual); } @@ -195,15 +186,13 @@ class CRM_Core_ResourcesTest extends CiviUnitTestCase { $this->res ->addStyleFile('com.example.ext', 'foo%20bar.css', 0, 'testAddStyleFile') ->addStyleFile('com.example.ext', 'foo%20bar.css', 0, 'testAddStyleFile') // extra - ->addStyleFile('civicrm', 'foo%20bar.css', 0, 'testAddStyleFile') - ; + ->addStyleFile('civicrm', 'foo%20bar.css', 0, 'testAddStyleFile'); $smarty = CRM_Core_Smarty::singleton(); $actual = $smarty->fetch('string:{crmRegion name=testAddStyleFile}{/crmRegion}'); $expected = "" // stable ordering: alphabetical by (snippet.weight,snippet.name) . "\n" - . "\n" - ; + . "\n"; $this->assertEquals($expected, $actual); } @@ -211,30 +200,26 @@ class CRM_Core_ResourcesTest extends CiviUnitTestCase { $this->res ->addStyleUrl('/whiz/foo%20bar.css', 0, 'testAddStyleURL') ->addStyleUrl('/whiz/foo%20bar.css', 0, 'testAddStyleURL') // extra - ->addStyleUrl('/whizbang/foo%20bar.css', 0, 'testAddStyleURL') - ; + ->addStyleUrl('/whizbang/foo%20bar.css', 0, 'testAddStyleURL'); $smarty = CRM_Core_Smarty::singleton(); $actual = $smarty->fetch('string:{crmRegion name=testAddStyleURL}{/crmRegion}'); $expected = "" // stable ordering: alphabetical by (snippet.weight,snippet.name) . "\n" - . "\n" - ; + . "\n"; $this->assertEquals($expected, $actual); } public function testAddStyle() { $this->res ->addStyle('body { background: black; }', 0, 'testAddStyle') - ->addStyle('body { text-color: black; }', 0, 'testAddStyle') - ; + ->addStyle('body { text-color: black; }', 0, 'testAddStyle'); $smarty = CRM_Core_Smarty::singleton(); $actual = $smarty->fetch('string:{crmRegion name=testAddStyle}{/crmRegion}'); $expected = "" . "\n" - . "\n" - ; + . "\n"; $this->assertEquals($expected, $actual); } @@ -250,8 +235,7 @@ class CRM_Core_ResourcesTest extends CiviUnitTestCase { $actual = $smarty->fetch('string:{crmRegion name=testCrmCSS}{/crmRegion}'); $expected = "" // stable ordering: alphabetical by (snippet.weight,snippet.name) . "\n" - . "\n" - ; + . "\n"; $this->assertEquals($expected, $actual); } diff --git a/tests/phpunit/CRM/Core/TransactionTest.php b/tests/phpunit/CRM/Core/TransactionTest.php index 1f8a1a68f0..128db9ea2a 100644 --- a/tests/phpunit/CRM/Core/TransactionTest.php +++ b/tests/phpunit/CRM/Core/TransactionTest.php @@ -202,10 +202,10 @@ class CRM_Core_TransactionTest extends CiviUnitTestCase { public function testCallback_commit() { $tx = new CRM_Core_Transaction(); - CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_COMMIT, array($this, '_preCommit'), array('qwe','rty')); - CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, array($this, '_postCommit'), array('uio','p[]')); - CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_ROLLBACK, array($this, '_preRollback'), array('asd','fgh')); - CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_ROLLBACK, array($this, '_postRollback'), array('jkl',';')); + CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_COMMIT, array($this, '_preCommit'), array('qwe', 'rty')); + CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, array($this, '_postCommit'), array('uio', 'p[]')); + CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_ROLLBACK, array($this, '_preRollback'), array('asd', 'fgh')); + CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_ROLLBACK, array($this, '_postRollback'), array('jkl', ';')); CRM_Core_DAO::executeQuery('UPDATE civicrm_contact SET id = 100 WHERE id = 100'); @@ -218,10 +218,10 @@ class CRM_Core_TransactionTest extends CiviUnitTestCase { public function testCallback_rollback() { $tx = new CRM_Core_Transaction(); - CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_COMMIT, array($this, '_preCommit'), array('ewq','ytr')); - CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, array($this, '_postCommit'), array('oiu','][p')); - CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_ROLLBACK, array($this, '_preRollback'), array('dsa','hgf')); - CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_ROLLBACK, array($this, '_postRollback'), array('lkj',';')); + CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_COMMIT, array($this, '_preCommit'), array('ewq', 'ytr')); + CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, array($this, '_postCommit'), array('oiu', '][p')); + CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_ROLLBACK, array($this, '_preRollback'), array('dsa', 'hgf')); + CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_ROLLBACK, array($this, '_postRollback'), array('lkj', ';')); CRM_Core_DAO::executeQuery('UPDATE civicrm_contact SET id = 100 WHERE id = 100'); $tx->rollback(); diff --git a/tests/phpunit/CRM/Dedupe/DedupeFinderTest.php b/tests/phpunit/CRM/Dedupe/DedupeFinderTest.php index 9bd434a5d1..3b8c19d813 100644 --- a/tests/phpunit/CRM/Dedupe/DedupeFinderTest.php +++ b/tests/phpunit/CRM/Dedupe/DedupeFinderTest.php @@ -191,7 +191,7 @@ class CRM_Dedupe_DedupeFinderTest extends CiviUnitTestCase { 'location_type_id' => 1, 'version' => 3, ); - $result = civicrm_api( 'address','create',$params ); + $result = civicrm_api( 'address', 'create', $params ); $contactIds[$count++] = $contact['id']; } diff --git a/tests/phpunit/CRM/Event/AllTests.php b/tests/phpunit/CRM/Event/AllTests.php index 848e7f084e..c6a41fdb4e 100644 --- a/tests/phpunit/CRM/Event/AllTests.php +++ b/tests/phpunit/CRM/Event/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Event_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Event/BAO/ParticipantStatusTest.php b/tests/phpunit/CRM/Event/BAO/ParticipantStatusTest.php index 810f98eb25..5d898e44ad 100644 --- a/tests/phpunit/CRM/Event/BAO/ParticipantStatusTest.php +++ b/tests/phpunit/CRM/Event/BAO/ParticipantStatusTest.php @@ -31,7 +31,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for CRM_Event_BAO_ParticipantStatus BAO * - * @package CiviCRM + * @package CiviCRM */ class CRM_Event_BAO_ParticipantStatusTest extends CiviUnitTestCase { @@ -49,7 +49,8 @@ class CRM_Event_BAO_ParticipantStatusTest extends CiviUnitTestCase { * This method is called after a test is executed. * */ - protected function tearDown() {} + protected function tearDown() { + } /** * create() and deleteParticipantStatusType() method diff --git a/tests/phpunit/CRM/Extension/AllTests.php b/tests/phpunit/CRM/Extension/AllTests.php index e1ce4bc97c..e5da16f22f 100644 --- a/tests/phpunit/CRM/Extension/AllTests.php +++ b/tests/phpunit/CRM/Extension/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Extension_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Extension/Container/AllTests.php b/tests/phpunit/CRM/Extension/Container/AllTests.php index e57e97caab..ee94f0d827 100644 --- a/tests/phpunit/CRM/Extension/Container/AllTests.php +++ b/tests/phpunit/CRM/Extension/Container/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Extension_Container_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Extension/Manager/AllTests.php b/tests/phpunit/CRM/Extension/Manager/AllTests.php index 49831b9f5a..51dbeb9aea 100644 --- a/tests/phpunit/CRM/Extension/Manager/AllTests.php +++ b/tests/phpunit/CRM/Extension/Manager/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Extension_Manager_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Extension/Manager/ModuleTest.php b/tests/phpunit/CRM/Extension/Manager/ModuleTest.php index 95c350a150..af009037d9 100644 --- a/tests/phpunit/CRM/Extension/Manager/ModuleTest.php +++ b/tests/phpunit/CRM/Extension/Manager/ModuleTest.php @@ -254,7 +254,7 @@ class CRM_Extension_Manager_ModuleTest extends CiviUnitTestCase { public function assertModuleActiveByKey($expectedIsActive, $key) { foreach (CRM_Core_Module::getAll() as $module) { if ($module->name == $key) { - $this->assertEquals((bool)$expectedIsActive, (bool)$module->is_active); + $this->assertEquals((bool) $expectedIsActive, (bool) $module->is_active); return; } } diff --git a/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php b/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php index de6e15cbac..a6df900deb 100755 --- a/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php +++ b/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php @@ -78,7 +78,7 @@ class CRM_Financial_BAO_FinancialItemTest extends CiviUnitTestCase { CRM_Financial_BAO_FinancialItem::add($lineItem, $contribution); $result = $this->assertDBNotNull( 'CRM_Financial_DAO_FinancialItem', - $lineItem->id , + $lineItem->id, 'amount', 'entity_id', 'Database check on added financial item record.' @@ -192,7 +192,7 @@ class CRM_Financial_BAO_FinancialItemTest extends CiviUnitTestCase { $result = $this->assertDBNotNull( 'CRM_Financial_DAO_FinancialItem', - $lineItem->id , + $lineItem->id, 'amount', 'entity_id', 'Database check on added financial item record.' @@ -201,7 +201,7 @@ class CRM_Financial_BAO_FinancialItemTest extends CiviUnitTestCase { $this->assertEquals( $result, $price, 'Verify Amount for Financial Item'); $entityResult = $this->assertDBNotNull( 'CRM_Financial_DAO_EntityFinancialTrxn', - $entityId , + $entityId, 'amount', 'entity_id', 'Database check on added entity financial trxn record.' @@ -236,7 +236,7 @@ class CRM_Financial_BAO_FinancialItemTest extends CiviUnitTestCase { $entityTrxn = CRM_Financial_BAO_FinancialItem::createEntityTrxn($params); $entityResult = $this->assertDBNotNull( 'CRM_Financial_DAO_EntityFinancialTrxn', - $financialTrxn->id , + $financialTrxn->id, 'amount', 'financial_trxn_id', 'Database check on added entity financial trxn record.' diff --git a/tests/phpunit/CRM/Financial/BAO/FinancialTypeAccountTest.php b/tests/phpunit/CRM/Financial/BAO/FinancialTypeAccountTest.php index c28fcdb910..f6c16c81c2 100755 --- a/tests/phpunit/CRM/Financial/BAO/FinancialTypeAccountTest.php +++ b/tests/phpunit/CRM/Financial/BAO/FinancialTypeAccountTest.php @@ -99,7 +99,7 @@ class CRM_Financial_BAO_FinancialTypeAccountTest extends CiviUnitTestCase { CRM_Financial_BAO_FinancialTypeAccount::del($financialAccountType->id); $params = array('id' => $financialAccountType->id ); $result = CRM_Financial_BAO_FinancialType::retrieve($params, $defaults); - $this->assertEquals( empty($result), true, 'Verify financial types record deletion.'); + $this->assertEquals( empty($result), TRUE, 'Verify financial types record deletion.'); } /** diff --git a/tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php b/tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php index dfda1823ee..7124a26277 100755 --- a/tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php +++ b/tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php @@ -53,7 +53,7 @@ class CRM_Financial_BAO_FinancialTypeTest extends CiviUnitTestCase { $financialType = CRM_Financial_BAO_FinancialType::add($params, $ids); $result = $this->assertDBNotNull( 'CRM_Financial_DAO_FinancialType', - $financialType->id , + $financialType->id, 'name', 'id', 'Database check on added financial type record.' @@ -92,10 +92,10 @@ class CRM_Financial_BAO_FinancialTypeTest extends CiviUnitTestCase { $ids = array(); $financialType = CRM_Financial_BAO_FinancialType::add($params, $ids); $result = CRM_Financial_BAO_FinancialType::setIsActive($financialType->id, 0); - $this->assertEquals($result, true , 'Verify financial type record updation for is_active.'); + $this->assertEquals($result, TRUE, 'Verify financial type record updation for is_active.'); $isActive = $this->assertDBNotNull( 'CRM_Financial_DAO_FinancialType', - $financialType->id , + $financialType->id, 'is_active', 'id', 'Database check on updated for financial type is_active.' @@ -118,6 +118,6 @@ class CRM_Financial_BAO_FinancialTypeTest extends CiviUnitTestCase { CRM_Financial_BAO_FinancialType::del($financialType->id); $params = array('id' => $financialType->id); $result = CRM_Financial_BAO_FinancialType::retrieve($params, $defaults); - $this->assertEquals(empty($result), true, 'Verify financial types record deletion.'); + $this->assertEquals(empty($result), TRUE, 'Verify financial types record deletion.'); } } diff --git a/tests/phpunit/CRM/Group/Page/AjaxTest.php b/tests/phpunit/CRM/Group/Page/AjaxTest.php index d92c4ea4fd..d86e5076a5 100644 --- a/tests/phpunit/CRM/Group/Page/AjaxTest.php +++ b/tests/phpunit/CRM/Group/Page/AjaxTest.php @@ -414,14 +414,14 @@ class CRM_Group_Page_AjaxTest extends CiviUnitTestCase { } /** - * Implements ACLGroup hook - * aclGroup function returns a list of permitted groups - * @param string $type - * @param int $contactID - * @param string $tableName - * @param array $allGroups - * @param array $currentGroups - */ + * Implements ACLGroup hook + * aclGroup function returns a list of permitted groups + * @param string $type + * @param int $contactID + * @param string $tableName + * @param array $allGroups + * @param array $currentGroups + */ public function hook_civicrm_aclGroup($type, $contactID, $tableName, &$allGroups, &$currentGroups) { //don't use api - you will get a loop $sql = " SELECT * FROM civicrm_group WHERE name LIKE '%pick%'"; diff --git a/tests/phpunit/CRM/Mailing/BAO/QueryTest.php b/tests/phpunit/CRM/Mailing/BAO/QueryTest.php index 0967ee2d44..d79e9d22e1 100644 --- a/tests/phpunit/CRM/Mailing/BAO/QueryTest.php +++ b/tests/phpunit/CRM/Mailing/BAO/QueryTest.php @@ -38,7 +38,7 @@ class CRM_Mailing_BAO_QueryTest extends CiviUnitTestCase { /** * Test CRM_Contact_BAO_Query::searchQuery() - * @dataProvider dataProvider + * @dataProvider dataProvider */ public function testSearch($fv, $count, $ids, $full) { $op = new PHPUnit_Extensions_Database_Operation_Insert(); diff --git a/tests/phpunit/CRM/Mailing/BAO/QueryTestDataProvider.php b/tests/phpunit/CRM/Mailing/BAO/QueryTestDataProvider.php index d526102901..ee809168f8 100644 --- a/tests/phpunit/CRM/Mailing/BAO/QueryTestDataProvider.php +++ b/tests/phpunit/CRM/Mailing/BAO/QueryTestDataProvider.php @@ -2,83 +2,104 @@ /** * Provide data to the CRM_Mailing_BAO_QueryTest class * - * @package CiviCRM + * @package CiviCRM */ class CRM_Mailing_BAO_QueryTestDataProvider implements Iterator { /** - * @var integer + * @var integer */ private $i = 0; /** - * @var mixed[] + * @var mixed[] * This dataset describes various form values and what contact * IDs should be selected when the form values are applied to the * database in dataset.xml */ private $dataset = array( - array('fv' => array('mailing_name' => 'First%', 'mailing_open_status' => 'Y'), + array( + 'fv' => array('mailing_name' => 'First%', 'mailing_open_status' => 'Y'), 'id' => array(109, 110, 111, 112), ), - array('fv' => array('mailing_name' => 'First%', 'mailing_open_status' => 'N'), + array( + 'fv' => array('mailing_name' => 'First%', 'mailing_open_status' => 'N'), 'id' => array(102, 103, 104, 105, 108), ), /*bounce*/ array( - 'fv' => array('mailing_name' => 'First%', 'mailing_delivery_status' + 'fv' => array( + 'mailing_name' => 'First%', + 'mailing_delivery_status' => 'N'), 'id' => array(105), ), /*bounce*/ array( - 'fv' => array('mailing_name' => 'First%', 'mailing_delivery_status' + 'fv' => array( + 'mailing_name' => 'First%', + 'mailing_delivery_status' => 'Y'), 'id' => array(102, 103, 104, 108, 109, 110, 111, 112), ), - array('fv' => array('mailing_name' => 'First%', 'mailing_reply_status' => 'Y'), + array( + 'fv' => array('mailing_name' => 'First%', 'mailing_reply_status' => 'Y'), 'id' => array(103, 108, 110, 112), ), - array('fv' => array('mailing_name' => 'First%', 'mailing_reply_status' => 'N'), + array( + 'fv' => array('mailing_name' => 'First%', 'mailing_reply_status' => 'N'), 'id' => array(102, 104, 105, 109, 111), ), - array('fv' => array('mailing_name' => 'First%', 'mailing_click_status' => 'Y'), + array( + 'fv' => array('mailing_name' => 'First%', 'mailing_click_status' => 'Y'), 'id' => array(104, 108, 111, 112), ), - array('fv' => array('mailing_name' => 'First%', 'mailing_click_status' => 'N'), + array( + 'fv' => array('mailing_name' => 'First%', 'mailing_click_status' => 'N'), 'id' => array(102, 103, 105, 109, 110), ), /*bounce*/ array( - 'fv' => array('mailing_name' => 'Second%', 'mailing_delivery_status' + 'fv' => array( + 'mailing_name' => 'Second%', + 'mailing_delivery_status' => 'N'), 'id' => array(), ), /*bounce*/ array( - 'fv' => array('mailing_name' => 'Second%', 'mailing_delivery_status' + 'fv' => array( + 'mailing_name' => 'Second%', + 'mailing_delivery_status' => 'Y'), 'id' => array(102, 103, 104, 108, 109, 110, 111, 112), ), - array('fv' => array('mailing_name' => 'Second%', 'mailing_reply_status' => 'Y'), + array( + 'fv' => array('mailing_name' => 'Second%', 'mailing_reply_status' => 'Y'), 'id' => array(103), ), - array('fv' => array('mailing_name' => 'Second%', 'mailing_click_status' => 'Y'), + array( + 'fv' => array('mailing_name' => 'Second%', 'mailing_click_status' => 'Y'), 'id' => array(104), ), - array('fv' => array('mailing_name' => 'Second%', 'mailing_click_status' => 'N'), + array( + 'fv' => array('mailing_name' => 'Second%', 'mailing_click_status' => 'N'), 'id' => array(102, 103, 108, 109, 110, 111, 112), ), - array('fv' => array('mailing_date_high' => '2011-05-25', 'mailing_open_status' => 'Y'), + array( + 'fv' => array('mailing_date_high' => '2011-05-25', 'mailing_open_status' => 'Y'), 'id' => array(109, 110, 111, 112), ), - array('fv' => array('mailing_date_high' => '2011-05-25', 'mailing_open_status' => 'N'), + array( + 'fv' => array('mailing_date_high' => '2011-05-25', 'mailing_open_status' => 'N'), 'id' => array(102, 103, 104, 105, 108), ), - array('fv' => array('mailing_date_low' => '2011-05-26', 'mailing_open_status' => 'Y'), + array( + 'fv' => array('mailing_date_low' => '2011-05-26', 'mailing_open_status' => 'Y'), 'id' => array(102), ), - array('fv' => array('mailing_date_low' => '2011-05-26', 'mailing_open_status' => 'N'), + array( + 'fv' => array('mailing_date_low' => '2011-05-26', 'mailing_open_status' => 'N'), 'id' => array(103, 104, 108, 109, 110, 111, 112), ), ); diff --git a/tests/phpunit/CRM/Mailing/BAO/SpoolTest.php b/tests/phpunit/CRM/Mailing/BAO/SpoolTest.php index 71e78c0f44..30df7dd12b 100644 --- a/tests/phpunit/CRM/Mailing/BAO/SpoolTest.php +++ b/tests/phpunit/CRM/Mailing/BAO/SpoolTest.php @@ -11,13 +11,13 @@ require_once 'CiviTest/CiviMailUtils.php'; */ class CRM_Mailing_BAO_SpoolTest extends CiviUnitTestCase { - protected $_mut = null; + protected $_mut = NULL; protected static $bodytext = 'Unit tests keep children safe.'; public function setUp() { parent::setUp(); - $this->_mut = new CiviMailUtils( $this, true ); + $this->_mut = new CiviMailUtils( $this, TRUE ); } public function tearDown() { @@ -76,15 +76,16 @@ class CRM_Mailing_BAO_SpoolTest extends CiviUnitTestCase { * @param $context * @param $mailPart */ - public static function mailWalkCallback( $context, $mailPart ) { + public static function mailWalkCallback($context, $mailPart) { if ( $mailPart instanceof ezcMailText ) { switch ( $mailPart->subType ) { - case 'plain': - self::assertContains( self::$bodytext, $mailPart->generateBody() ); - break; - case 'html': - self::assertContains( self::$bodytext . '

', $mailPart->generateBody() ); - break; + case 'plain': + self::assertContains( self::$bodytext, $mailPart->generateBody() ); + break; + + case 'html': + self::assertContains( self::$bodytext . '

', $mailPart->generateBody() ); + break; } } } diff --git a/tests/phpunit/CRM/Member/AllTests.php b/tests/phpunit/CRM/Member/AllTests.php index fee55687c0..bbb1e5490c 100644 --- a/tests/phpunit/CRM/Member/AllTests.php +++ b/tests/phpunit/CRM/Member/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Member_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Member/BAO/MembershipLogTest.php b/tests/phpunit/CRM/Member/BAO/MembershipLogTest.php index 2c53db8f2f..e2a7589414 100644 --- a/tests/phpunit/CRM/Member/BAO/MembershipLogTest.php +++ b/tests/phpunit/CRM/Member/BAO/MembershipLogTest.php @@ -5,7 +5,7 @@ * * (PHP 5) * - * @package CiviCRM + * @package CiviCRM * * This file is part of CiviCRM * @@ -31,7 +31,7 @@ require_once 'CiviTest/Membership.php'; /** * Test CRM/Member/BAO Membership Log add , delete functions * - * @package CiviCRM + * @package CiviCRM */ class CRM_Member_BAO_MembershipLogTest extends CiviUnitTestCase { @@ -88,9 +88,9 @@ class CRM_Member_BAO_MembershipLogTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_mebershipStatusID, @@ -116,9 +116,9 @@ class CRM_Member_BAO_MembershipLogTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_mebershipStatusID, @@ -145,9 +145,9 @@ class CRM_Member_BAO_MembershipLogTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_mebershipStatusID, diff --git a/tests/phpunit/CRM/Member/BAO/MembershipTest.php b/tests/phpunit/CRM/Member/BAO/MembershipTest.php index 6f54571cc8..e747af7d69 100644 --- a/tests/phpunit/CRM/Member/BAO/MembershipTest.php +++ b/tests/phpunit/CRM/Member/BAO/MembershipTest.php @@ -73,7 +73,7 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $this->membershipStatusDelete( $this->_membershipStatusID ); Contact::delete( $this->_contactID ); - $this->_contactID = $this->_membershipStatusID = $this->_membershipTypeID = null; + $this->_contactID = $this->_membershipStatusID = $this->_membershipTypeID = NULL; } public function testCreate() { @@ -83,9 +83,9 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_membershipStatusID, @@ -103,9 +103,9 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_membershipStatusID, @@ -189,9 +189,9 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_membershipStatusID, @@ -217,9 +217,9 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_membershipStatusID, @@ -239,9 +239,9 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'PaySource', 'is_override' => 1, 'status_id' => $this->_membershipStatusID, @@ -277,9 +277,9 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_membershipStatusID, @@ -304,9 +304,9 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_membershipStatusID, @@ -337,9 +337,9 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_membershipStatusID, @@ -347,7 +347,6 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $ids = array(); CRM_Member_BAO_Membership::create($params, $ids); - $membershipId = $this->assertDBNotNull('CRM_Member_BAO_Membership', $contactId, 'id', 'contact_id', 'Database check for created membership.' ); @@ -368,9 +367,9 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_membershipStatusID, @@ -400,9 +399,9 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_membershipStatusID, @@ -433,9 +432,9 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_membershipStatusID, @@ -468,9 +467,9 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase { $params = array( 'contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, - 'join_date' => date('Ymd',strtotime('2006-01-21')), - 'start_date' => date('Ymd',strtotime('2006-01-21')), - 'end_date' => date('Ymd',strtotime('2006-12-21')), + 'join_date' => date('Ymd', strtotime('2006-01-21')), + 'start_date' => date('Ymd', strtotime('2006-01-21')), + 'end_date' => date('Ymd', strtotime('2006-12-21')), 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_membershipStatusID, diff --git a/tests/phpunit/CRM/Member/Form/AllTests.php b/tests/phpunit/CRM/Member/Form/AllTests.php index ca7c7ae2f7..efb4cf5d9d 100644 --- a/tests/phpunit/CRM/Member/Form/AllTests.php +++ b/tests/phpunit/CRM/Member/Form/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Member_Form_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Member/Form/MembershipTest.php b/tests/phpunit/CRM/Member/Form/MembershipTest.php index 47d1ffb1c4..75f82ba965 100644 --- a/tests/phpunit/CRM/Member/Form/MembershipTest.php +++ b/tests/phpunit/CRM/Member/Form/MembershipTest.php @@ -5,11 +5,11 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @package CiviCRM + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'HTML/QuickForm/Page.php'; /** * Test APIv2 civicrm_activity_* functions * - * @package CiviCRM + * @package CiviCRM */ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { @@ -353,7 +353,8 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { public function testFormRuleOverrideNoStatus() { $unixNow = time(); $unixYearFromNow = $unixNow + (365 * 24 * 60 * 60); - $params = array('join_date' => date('m/d/Y', $unixNow), + $params = array( + 'join_date' => date('m/d/Y', $unixNow), 'membership_type_id' => array('23', '13'), 'is_override' => TRUE, ); @@ -375,7 +376,8 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { public function testFormRuleRollingJoin1MonthFromNow() { $unixNow = time(); $unix1MFmNow = $unixNow + (31 * 24 * 60 * 60); - $params = array('join_date' => date('m/d/Y', $unix1MFmNow), + $params = array( + 'join_date' => date('m/d/Y', $unix1MFmNow), 'start_date' => '', 'end_date' => '', 'membership_type_id' => array('23', '3'), @@ -399,7 +401,8 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { */ public function testFormRuleRollingJoinToday() { $unixNow = time(); - $params = array('join_date' => date('m/d/Y', $unixNow), + $params = array( + 'join_date' => date('m/d/Y', $unixNow), 'start_date' => '', 'end_date' => '', 'membership_type_id' => array('23', '3'), @@ -419,7 +422,8 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { public function testFormRuleRollingJoin1MonthAgo() { $unixNow = time(); $unix1MAgo = $unixNow - (31 * 24 * 60 * 60); - $params = array('join_date' => date('m/d/Y', $unix1MAgo), + $params = array( + 'join_date' => date('m/d/Y', $unix1MAgo), 'start_date' => '', 'end_date' => '', 'membership_type_id' => array('23', '3'), @@ -439,7 +443,8 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { public function testFormRuleRollingJoin6MonthsAgo() { $unixNow = time(); $unix6MAgo = $unixNow - (180 * 24 * 60 * 60); - $params = array('join_date' => date('m/d/Y', $unix6MAgo), + $params = array( + 'join_date' => date('m/d/Y', $unix6MAgo), 'start_date' => '', 'end_date' => '', 'membership_type_id' => array('23', '3'), @@ -459,7 +464,8 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { public function testFormRuleRollingJoin1YearAgo() { $unixNow = time(); $unix1YAgo = $unixNow - (370 * 24 * 60 * 60); - $params = array('join_date' => date('m/d/Y', $unix1YAgo), + $params = array( + 'join_date' => date('m/d/Y', $unix1YAgo), 'start_date' => '', 'end_date' => '', 'membership_type_id' => array('23', '3'), @@ -479,7 +485,8 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { public function testFormRuleRollingJoin2YearsAgo() { $unixNow = time(); $unix2YAgo = $unixNow - (2 * 365 * 24 * 60 * 60); - $params = array('join_date' => date('m/d/Y', $unix2YAgo), + $params = array( + 'join_date' => date('m/d/Y', $unix2YAgo), 'start_date' => '', 'end_date' => '', 'membership_type_id' => array('23', '3'), @@ -499,7 +506,8 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase { public function testFormRuleFixedJoin6MonthsAgo() { $unixNow = time(); $unix6MAgo = $unixNow - (180 * 24 * 60 * 60); - $params = array('join_date' => date('m/d/Y', $unix6MAgo), + $params = array( + 'join_date' => date('m/d/Y', $unix6MAgo), 'start_date' => '', 'end_date' => '', 'membership_type_id' => array('23', '7'), diff --git a/tests/phpunit/CRM/Member/Import/Parser/MembershipTest.php b/tests/phpunit/CRM/Member/Import/Parser/MembershipTest.php index eacc78812b..b140789e98 100644 --- a/tests/phpunit/CRM/Member/Import/Parser/MembershipTest.php +++ b/tests/phpunit/CRM/Member/Import/Parser/MembershipTest.php @@ -5,7 +5,7 @@ * * (PHP 5) * - * @package CiviCRM + * @package CiviCRM * * This file is part of CiviCRM * @@ -31,7 +31,7 @@ require_once 'CiviTest/Membership.php'; /** * Test CRM/Member/BAO Membership Log add , delete functions * - * @package CiviCRM + * @package CiviCRM */ class CRM_Member_Import_Parser_MembershipTest extends CiviUnitTestCase { /** @@ -131,7 +131,7 @@ class CRM_Member_Import_Parser_MembershipTest extends CiviUnitTestCase { 'mapper[1][0]' => 'membership_type_id', 'mapper[2][0]' => 'membership_start_date', ); -/* + /* $params = array( 'contact_id' => $contactId, diff --git a/tests/phpunit/CRM/PCP/BAO/PCPTest.php b/tests/phpunit/CRM/PCP/BAO/PCPTest.php index 883e1639d6..791045e0d0 100644 --- a/tests/phpunit/CRM/PCP/BAO/PCPTest.php +++ b/tests/phpunit/CRM/PCP/BAO/PCPTest.php @@ -31,7 +31,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for CRM_PCP_BAO_PCPTest BAO * - * @package CiviCRM + * @package CiviCRM */ class CRM_PCP_BAO_PCPTest extends CiviUnitTestCase { @@ -186,5 +186,6 @@ class CRM_PCP_BAO_PCPTest extends CiviUnitTestCase { * This method is called after a test is executed. * */ - protected function tearDown() {} + protected function tearDown() { + } } diff --git a/tests/phpunit/CRM/Pledge/AllTests.php b/tests/phpunit/CRM/Pledge/AllTests.php index 42b753847a..53fd640b2f 100644 --- a/tests/phpunit/CRM/Pledge/AllTests.php +++ b/tests/phpunit/CRM/Pledge/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Pledge_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Pledge/BAO/PledgeBlockTest.php b/tests/phpunit/CRM/Pledge/BAO/PledgeBlockTest.php index 3ec199c0ad..ee9365aaa6 100644 --- a/tests/phpunit/CRM/Pledge/BAO/PledgeBlockTest.php +++ b/tests/phpunit/CRM/Pledge/BAO/PledgeBlockTest.php @@ -32,7 +32,7 @@ require_once 'CiviTest/ContributionPage.php'; /** * Test class for CRM_Pledge_BAO_PledgeBlock BAO * - * @package CiviCRM + * @package CiviCRM */ class CRM_Pledge_BAO_PledgeBlockTest extends CiviUnitTestCase { @@ -51,7 +51,8 @@ class CRM_Pledge_BAO_PledgeBlockTest extends CiviUnitTestCase { * This method is called after a test is executed. * */ - protected function tearDown() {} + protected function tearDown() { + } /** * create() and deletepledgeblock() method diff --git a/tests/phpunit/CRM/Pledge/BAO/PledgePaymentTest.php b/tests/phpunit/CRM/Pledge/BAO/PledgePaymentTest.php index 7187d1f26e..cc65a250ac 100644 --- a/tests/phpunit/CRM/Pledge/BAO/PledgePaymentTest.php +++ b/tests/phpunit/CRM/Pledge/BAO/PledgePaymentTest.php @@ -31,7 +31,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for CRM_Pledge_BAO_PledgePayment BAO * - * @package CiviCRM + * @package CiviCRM */ class CRM_Pledge_BAO_PledgePaymentTest extends CiviUnitTestCase { @@ -49,7 +49,8 @@ class CRM_Pledge_BAO_PledgePaymentTest extends CiviUnitTestCase { * This method is called after a test is executed. * */ - protected function tearDown() {} + protected function tearDown() { + } /** * Test for Add/Update Pledge Payment. @@ -146,7 +147,7 @@ class CRM_Pledge_BAO_PledgePaymentTest extends CiviUnitTestCase { */ public function testDeletePledgePaymentsNullId() { $payment = CRM_Core_DAO::createTestObject('CRM_Pledge_BAO_PledgePayment'); - $paymentid = CRM_Pledge_BAO_PledgePayment::deletePayments(Null); + $paymentid = CRM_Pledge_BAO_PledgePayment::deletePayments(NULL); $this->assertEquals(count($paymentid), 1, "No payments deleted"); $result = CRM_Pledge_BAO_Pledge::deletePledge($payment->pledge_id); } diff --git a/tests/phpunit/CRM/Pledge/BAO/PledgeTest.php b/tests/phpunit/CRM/Pledge/BAO/PledgeTest.php index fcc1fe084c..860a9f3c09 100644 --- a/tests/phpunit/CRM/Pledge/BAO/PledgeTest.php +++ b/tests/phpunit/CRM/Pledge/BAO/PledgeTest.php @@ -32,7 +32,7 @@ require_once 'CiviTest/Contact.php'; /** * Test class for CRM_Pledge_BAO_Pledge BAO * - * @package CiviCRM + * @package CiviCRM */ class CRM_Pledge_BAO_PledgeTest extends CiviUnitTestCase { @@ -51,7 +51,8 @@ class CRM_Pledge_BAO_PledgeTest extends CiviUnitTestCase { * This method is called after a test is executed. * */ - protected function tearDown() {} + protected function tearDown() { + } /** * Test for Add/Update Pledge. diff --git a/tests/phpunit/CRM/Queue/AllTests.php b/tests/phpunit/CRM/Queue/AllTests.php index f55bf3e0c0..4c5a951827 100644 --- a/tests/phpunit/CRM/Queue/AllTests.php +++ b/tests/phpunit/CRM/Queue/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 25163 2009-11-17 23:43:46Z walt $ - * @package CiviCRM + * @version $Id: AllTests.php 25163 2009-11-17 23:43:46Z walt $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Queue_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Queue/Queue/AllTests.php b/tests/phpunit/CRM/Queue/Queue/AllTests.php index 25391ca56f..adf03c9d19 100644 --- a/tests/phpunit/CRM/Queue/Queue/AllTests.php +++ b/tests/phpunit/CRM/Queue/Queue/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 25163 2009-11-17 23:43:46Z walt $ - * @package CiviCRM + * @version $Id: AllTests.php 25163 2009-11-17 23:43:46Z walt $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Queue_Queue_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Utils/ArrayTest.php b/tests/phpunit/CRM/Utils/ArrayTest.php index d4e824812d..fad576b0bc 100644 --- a/tests/phpunit/CRM/Utils/ArrayTest.php +++ b/tests/phpunit/CRM/Utils/ArrayTest.php @@ -59,9 +59,9 @@ class CRM_Utils_ArrayTest extends CiviUnitTestCase { $this->assertEquals($expected, CRM_Utils_Array::collect('catWord', $arr)); $arr = array(); - $arr['en']= (object) array('catWord' => 'cat', 'dogWord' => 'dog'); - $arr['fr']= (object) array('catWord' => 'chat', 'dogWord' => 'chien'); - $arr['es']= (object) array('catWord' => 'gato'); + $arr['en'] = (object) array('catWord' => 'cat', 'dogWord' => 'dog'); + $arr['fr'] = (object) array('catWord' => 'chat', 'dogWord' => 'chien'); + $arr['es'] = (object) array('catWord' => 'gato'); $expected = array('en' => 'cat', 'fr' => 'chat', 'es' => 'gato'); $this->assertEquals($expected, CRM_Utils_Array::collect('catWord', $arr)); } @@ -107,11 +107,11 @@ class CRM_Utils_ArrayTest extends CiviUnitTestCase { public function testIsSubset() { $this->assertTrue(CRM_Utils_Array::isSubset(array(), array())); $this->assertTrue(CRM_Utils_Array::isSubset(array('a'), array('a'))); - $this->assertTrue(CRM_Utils_Array::isSubset(array('a'), array('b','a','c'))); - $this->assertTrue(CRM_Utils_Array::isSubset(array('b','d'), array('a','b','c','d'))); + $this->assertTrue(CRM_Utils_Array::isSubset(array('a'), array('b', 'a', 'c'))); + $this->assertTrue(CRM_Utils_Array::isSubset(array('b', 'd'), array('a', 'b', 'c', 'd'))); $this->assertFalse(CRM_Utils_Array::isSubset(array('a'), array())); $this->assertFalse(CRM_Utils_Array::isSubset(array('a'), array('b'))); - $this->assertFalse(CRM_Utils_Array::isSubset(array('a'), array('b','c','d'))); + $this->assertFalse(CRM_Utils_Array::isSubset(array('a'), array('b', 'c', 'd'))); } public function testRemove() { diff --git a/tests/phpunit/CRM/Utils/Cache/AllTests.php b/tests/phpunit/CRM/Utils/Cache/AllTests.php index da64970fc3..9f87bede3f 100644 --- a/tests/phpunit/CRM/Utils/Cache/AllTests.php +++ b/tests/phpunit/CRM/Utils/Cache/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all test suites * - * @package CiviCRM + * @package CiviCRM */ class CRM_Utils_Cache_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CRM/Utils/MailTest.php b/tests/phpunit/CRM/Utils/MailTest.php index 4798f40962..671b38d2cf 100644 --- a/tests/phpunit/CRM/Utils/MailTest.php +++ b/tests/phpunit/CRM/Utils/MailTest.php @@ -17,7 +17,8 @@ class CRM_Utils_MailTest extends CiviUnitTestCase { public function testFormatRFC822() { $values = array( - array('name' => "Test User", + array( + 'name' => "Test User", 'email' => "foo@bar.com", 'result' => "Test User ", ), diff --git a/tests/phpunit/CRM/Utils/NumberTest.php b/tests/phpunit/CRM/Utils/NumberTest.php index dac2682a48..81115a8eaf 100644 --- a/tests/phpunit/CRM/Utils/NumberTest.php +++ b/tests/phpunit/CRM/Utils/NumberTest.php @@ -45,12 +45,12 @@ class CRM_Utils_NumberTest extends CiviUnitTestCase { public function truncDecimalCases() { $cases = array(); // array($value, $precision, $expectedValue) - $cases[] = array(523, array(1,0), 5); - $cases[] = array(523, array(5,2), 523); - $cases[] = array(523, array(10,8), 52.3); - $cases[] = array(12345, array(3,3), 0.123); - $cases[] = array(0.12345, array(10,0), 12345); - $cases[] = array(-123.45, array(4,2), -12.34); + $cases[] = array(523, array(1, 0), 5); + $cases[] = array(523, array(5, 2), 523); + $cases[] = array(523, array(10, 8), 52.3); + $cases[] = array(12345, array(3, 3), 0.123); + $cases[] = array(0.12345, array(10, 0), 12345); + $cases[] = array(-123.45, array(4, 2), -12.34); return $cases; } diff --git a/tests/phpunit/CRM/Utils/QueryFormatterTest.php b/tests/phpunit/CRM/Utils/QueryFormatterTest.php index cafcb150e6..c3f416c70e 100644 --- a/tests/phpunit/CRM/Utils/QueryFormatterTest.php +++ b/tests/phpunit/CRM/Utils/QueryFormatterTest.php @@ -10,40 +10,40 @@ class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase { public function dataProvider() { $cases = array(); // array(0=>$inputText, 1=>$language, 2=>$options, 3=>$expectedText) - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_NONE, '%first second%'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_PHRASE, '%first second%'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '%first second%'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '%first%second%'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_NONE, '%first second%'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_PHRASE, '%first second%'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '%first second%'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '%first%second%'); $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, '%first%second%'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_NONE, 'first second'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_PHRASE, '"first second"'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '"*first second*"'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '*first* *second*'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_NONE, 'first second'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_PHRASE, '"first second"'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '"*first second*"'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '*first* *second*'); $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, 'first* second*'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_NONE, '+first +second'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_PHRASE, '+"first second"'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '+"*first second*"'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '+*first* +*second*'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_NONE, '+first +second'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_PHRASE, '+"first second"'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '+"*first second*"'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '+*first* +*second*'); $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, '+first* +second*'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_NONE, 'first second'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_PHRASE, '"first second"'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '"*first second*"'); - $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '*first* *second*'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_NONE, 'first second'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_PHRASE, '"first second"'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, '"*first second*"'); + $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_WILDWORDS, '*first* *second*'); $cases[] = array('first second', CRM_Utils_QueryFormatter::LANG_SOLR, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX, 'first* second*'); // if user supplies wildcards, then ignore mode foreach (array(CRM_Utils_QueryFormatter::MODE_NONE, CRM_Utils_QueryFormatter::MODE_WILDPHRASE, CRM_Utils_QueryFormatter::MODE_WILDWORDS, CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX) as $mode) { - $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first% second'); - $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first* second'); - $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, $mode, '+first* +second'); - $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SOLR, $mode, 'first* second'); - $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first second%'); - $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first second*'); - $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, $mode, '+first +second*'); - $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SOLR, $mode, 'first second*'); + $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first% second'); + $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first* second'); + $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, $mode, '+first* +second'); + $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SOLR, $mode, 'first* second'); + $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first second%'); + $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first second*'); + $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, $mode, '+first +second*'); + $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SOLR, $mode, 'first second*'); } return $cases; diff --git a/tests/phpunit/CRM/Utils/SQL/InsertTest.php b/tests/phpunit/CRM/Utils/SQL/InsertTest.php index 01cdd5e618..bb11f4ace9 100644 --- a/tests/phpunit/CRM/Utils/SQL/InsertTest.php +++ b/tests/phpunit/CRM/Utils/SQL/InsertTest.php @@ -8,8 +8,7 @@ class CRM_Utils_SQL_InsertTest extends CiviUnitTestCase { public function testRow_twice() { $insert = CRM_Utils_SQL_Insert::into('foo') ->row(array('first' => '1', 'second' => '2' )) - ->row(array('second' => '2b', 'first' => '1b')) - ; + ->row(array('second' => '2b', 'first' => '1b')); $expected = ' INSERT INTO foo (`first`,`second`) VALUES ("1","2"), @@ -25,8 +24,7 @@ class CRM_Utils_SQL_InsertTest extends CiviUnitTestCase { array('second' => '2b', 'first' => '1b'), array('first' => '1c', 'second' => '2c') )) - ->row(array('second' => '2d', 'first' => '1d')) - ; + ->row(array('second' => '2d', 'first' => '1d')); $expected = ' INSERT INTO foo (`first`,`second`) VALUES ("1","2"), diff --git a/tests/phpunit/CRM/Utils/SQL/SelectTest.php b/tests/phpunit/CRM/Utils/SQL/SelectTest.php index c0cdad913e..20d4fdf460 100644 --- a/tests/phpunit/CRM/Utils/SQL/SelectTest.php +++ b/tests/phpunit/CRM/Utils/SQL/SelectTest.php @@ -119,9 +119,9 @@ class CRM_Utils_SQL_SelectTest extends CiviUnitTestCase { $actual = CRM_Utils_SQL_Select::from('ignore')->interpolate( '(@escaped) (!unescaped) (#validated)', array( - '@escaped' => array('foo"bar', "whiz", "null", null, "bang"), + '@escaped' => array('foo"bar', "whiz", "null", NULL, "bang"), '!unescaped' => array('foo"bar', 'bar'), - '#validated' => array(1, 10, null, 100.1) + '#validated' => array(1, 10, NULL, 100.1) ) ); $this->assertLike('("foo\\"bar", "whiz", "null", NULL, "bang") (foo"bar, bar) (1, 10, NULL, 100.1)', $actual); diff --git a/tests/phpunit/CRM/Utils/StringTest.php b/tests/phpunit/CRM/Utils/StringTest.php index fd32bc9cba..5d3bb4e2fd 100644 --- a/tests/phpunit/CRM/Utils/StringTest.php +++ b/tests/phpunit/CRM/Utils/StringTest.php @@ -21,7 +21,6 @@ class CRM_Utils_StringTest extends CiviUnitTestCase { 'civicrm dashboard & force = 1,;' => 'civicrm_dashboard___force___1__', ); - foreach ($testSet as $in => $expected) { $out = CRM_Utils_String::stripPathChars($in); $this->assertEquals($out, $expected, "Output does not match"); diff --git a/tests/phpunit/CRM/Utils/SystemTest.php b/tests/phpunit/CRM/Utils/SystemTest.php index e67b75a601..7506bdac9a 100644 --- a/tests/phpunit/CRM/Utils/SystemTest.php +++ b/tests/phpunit/CRM/Utils/SystemTest.php @@ -15,7 +15,7 @@ class CRM_Utils_SystemTest extends CiviUnitTestCase { $config = CRM_Core_Config::singleton(); $this->assertTrue($config->userSystem instanceof CRM_Utils_System_UnitTests); $expected = '/index.php?q=civicrm/foo/bar&foo=ab&bar=cd%26ef'; - $actual = CRM_Utils_System::url('civicrm/foo/bar', 'foo=ab&bar=cd%26ef', false, null, false); + $actual = CRM_Utils_System::url('civicrm/foo/bar', 'foo=ab&bar=cd%26ef', FALSE, NULL, FALSE); $this->assertEquals($expected, $actual); } @@ -26,7 +26,7 @@ class CRM_Utils_SystemTest extends CiviUnitTestCase { $actual = CRM_Utils_System::url('civicrm/foo/bar', array( 'foo' => 'ab', 'bar' => 'cd&ef', - ), false, null, false); + ), FALSE, NULL, FALSE); $this->assertEquals($expected, $actual); } diff --git a/tests/phpunit/CRM/Utils/versionCheckTest.php b/tests/phpunit/CRM/Utils/versionCheckTest.php index a2d28d2dd4..3e881d7c9f 100644 --- a/tests/phpunit/CRM/Utils/versionCheckTest.php +++ b/tests/phpunit/CRM/Utils/versionCheckTest.php @@ -30,20 +30,20 @@ class CRM_Utils_versionCheckTest extends CiviUnitTestCase { array('version' => '4.2.1', 'date' => '2012-09-12'), array('version' => '4.2.2', 'date' => '2012-09-27'), array('version' => '4.2.4', 'date' => '2012-10-18'), - array('version' => '4.2.6', 'date' => '2012-11-01', 'security' => true), - array('version' => '4.2.7', 'date' => '2013-01-02', 'security' => true), + array('version' => '4.2.6', 'date' => '2012-11-01', 'security' => TRUE), + array('version' => '4.2.7', 'date' => '2013-01-02', 'security' => TRUE), array('version' => '4.2.8', 'date' => '2013-02-20'), array('version' => '4.2.9', 'date' => '2013-04-03'), - array('version' => '4.2.10', 'date' => '2013-07-29', 'security' => true), + array('version' => '4.2.10', 'date' => '2013-07-29', 'security' => TRUE), array('version' => '4.2.11', 'date' => '2013-09-25'), - array('version' => '4.2.12', 'date' => '2013-10-02', 'security' => true), - array('version' => '4.2.13', 'date' => '2013-11-06', 'security' => true), + array('version' => '4.2.12', 'date' => '2013-10-02', 'security' => TRUE), + array('version' => '4.2.13', 'date' => '2013-11-06', 'security' => TRUE), array('version' => '4.2.14', 'date' => '2013-11-20'), - array('version' => '4.2.15', 'date' => '2014-02-07', 'security' => true), + array('version' => '4.2.15', 'date' => '2014-02-07', 'security' => TRUE), array('version' => '4.2.16', 'date' => '2014-02-18'), - array('version' => '4.2.17', 'date' => '2014-07-01', 'security' => true), + array('version' => '4.2.17', 'date' => '2014-07-01', 'security' => TRUE), array('version' => '4.2.18', 'date' => '2014-08-06'), - array('version' => '4.2.19', 'date' => '2014-09-17', 'security' => true) + array('version' => '4.2.19', 'date' => '2014-09-17', 'security' => TRUE) ), ), '4.3' => array( @@ -53,29 +53,29 @@ class CRM_Utils_versionCheckTest extends CiviUnitTestCase { array('version' => '4.3.1', 'date' => '2013-04-18'), array('version' => '4.3.2', 'date' => '2013-05-02'), array('version' => '4.3.3', 'date' => '2013-05-08'), - array('version' => '4.3.4', 'date' => '2013-06-10', 'security' => true), - array('version' => '4.3.5', 'date' => '2013-07-08', 'security' => true), + array('version' => '4.3.4', 'date' => '2013-06-10', 'security' => TRUE), + array('version' => '4.3.5', 'date' => '2013-07-08', 'security' => TRUE), array('version' => '4.3.6', 'date' => '2013-09-25'), - array('version' => '4.3.7', 'date' => '2013-10-02', 'security' => true), - array('version' => '4.3.8', 'date' => '2013-11-06', 'security' => true), - array('version' => '4.3.9', 'date' => '2014-09-07', 'security' => true) + array('version' => '4.3.7', 'date' => '2013-10-02', 'security' => TRUE), + array('version' => '4.3.8', 'date' => '2013-11-06', 'security' => TRUE), + array('version' => '4.3.9', 'date' => '2014-09-07', 'security' => TRUE) ), ), '4.4' => array( 'status' => 'lts', 'releases' => array( array('version' => '4.4.0', 'date' => '2013-10-23'), - array('version' => '4.4.1', 'date' => '2013-11-06', 'security' => true), + array('version' => '4.4.1', 'date' => '2013-11-06', 'security' => TRUE), array('version' => '4.4.2', 'date' => '2013-11-20'), array('version' => '4.4.3', 'date' => '2013-12-05'), - array('version' => '4.4.4', 'date' => '2014-02-07', 'security' => true), + array('version' => '4.4.4', 'date' => '2014-02-07', 'security' => TRUE), array('version' => '4.4.5', 'date' => '2014-04-17'), - array('version' => '4.4.6', 'date' => '2014-07-01', 'security' => true), - array('version' => '4.4.7', 'date' => '2014-09-17', 'security' => true), + array('version' => '4.4.6', 'date' => '2014-07-01', 'security' => TRUE), + array('version' => '4.4.7', 'date' => '2014-09-17', 'security' => TRUE), array('version' => '4.4.8', 'date' => '2014-10-14'), array('version' => '4.4.9', 'date' => '2014-11-05'), array('version' => '4.4.10', 'date' => '2014-11-19'), - array('version' => '4.4.11', 'date' => '2014-12-17', 'security' => true) + array('version' => '4.4.11', 'date' => '2014-12-17', 'security' => TRUE) ), ), '4.5' => array( @@ -86,7 +86,7 @@ class CRM_Utils_versionCheckTest extends CiviUnitTestCase { array('version' => '4.5.2', 'date' => '2014-10-14'), array('version' => '4.5.3', 'date' => '2014-11-05'), array('version' => '4.5.4', 'date' => '2014-11-19'), - array('version' => '4.5.5', 'date' => '2014-12-17', 'security' => true), + array('version' => '4.5.5', 'date' => '2014-12-17', 'security' => TRUE), ) ), '4.6' => array( diff --git a/tests/phpunit/Civi/AllTests.php b/tests/phpunit/Civi/AllTests.php index 869ddef8d2..eb17fbeb37 100644 --- a/tests/phpunit/Civi/AllTests.php +++ b/tests/phpunit/Civi/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all CRM test suites * - * @package CiviCRM + * @package CiviCRM */ class Civi_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/CiviTest/CiviDBAssert.php b/tests/phpunit/CiviTest/CiviDBAssert.php index 1a39267ada..0c7575ec52 100644 --- a/tests/phpunit/CiviTest/CiviDBAssert.php +++ b/tests/phpunit/CiviTest/CiviDBAssert.php @@ -143,7 +143,6 @@ class CiviDBAssert { $dbValues = array(); CRM_Core_DAO::commonRetrieve($daoName, $searchParams, $dbValues); - // compare db values with expected values self::assertAttributesEquals($testCase, $expectedValues, $dbValues); } diff --git a/tests/phpunit/CiviTest/CiviMailUtils.php b/tests/phpunit/CiviTest/CiviMailUtils.php index a298e00de0..61f0f4602d 100644 --- a/tests/phpunit/CiviTest/CiviMailUtils.php +++ b/tests/phpunit/CiviTest/CiviMailUtils.php @@ -181,6 +181,7 @@ class CiviMailUtils extends PHPUnit_Framework_TestCase { case 'raw': // nothing to do break; + case 'ezc': $msg = $this->convertToEzc($msg); break; @@ -213,6 +214,7 @@ class CiviMailUtils extends PHPUnit_Framework_TestCase { case 'raw': // nothing to do break; + case 'ezc': foreach ($msgs as $i => $msg) { $msgs[$i] = $this->convertToEzc($msg); diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 17b85ed691..e761cb2e94 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -134,7 +134,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $cookie['path'] = '/'; } if (!isset($cookie['max_age'])) { - $cookie['max_age'] = 7*24*60*60; + $cookie['max_age'] = 7 * 24 * 60 * 60; } $this->deleteCookie($cookie['name'], $cookie['path']); $optionExprs = array(); @@ -247,7 +247,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { * @param string $element * @param string $waitFor */ - public function clickPopupLink($element, $waitFor=NULL) { + public function clickPopupLink($element, $waitFor = NULL) { $this->clickAjaxLink($element, 'css=.ui-dialog'); if ($waitFor) { $this->waitForElementPresent($waitFor); @@ -259,7 +259,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { * @param string $element * @param string $waitFor */ - public function clickAjaxLink($element, $waitFor=NULL) { + public function clickAjaxLink($element, $waitFor = NULL) { $this->click($element); if ($waitFor) { $this->waitForElementPresent($waitFor); @@ -495,7 +495,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { /** */ public function webtestFillAutocomplete($sortName, $fieldName = 'contact_id') { - $this->select2($fieldName,$sortName); + $this->select2($fieldName, $sortName); //$this->assertContains($sortName, $this->getValue($fieldName), "autocomplete expected $sortName but didn’t find it in " . $this->getValue($fieldName)); } @@ -673,7 +673,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->type('email-Primary', $params['email'] = "{$name}@example.com"); $this->clickAjaxLink('_qf_Edit_next'); - $this->waitForText("xpath=//div[@id='$selectId']","$name"); + $this->waitForText("xpath=//div[@id='$selectId']", "$name"); $params['sort_name'] = $contactType == 'Individual' ? $params['last_name'] . ', ' . $params['first_name'] : "$name $contactType"; $params['display_name'] = $contactType == 'Individual' ? $params['first_name'] . ' ' . $params['last_name'] : $params['sort_name']; @@ -713,10 +713,10 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { // Is new contact created? if ($lname) { - $this->waitForText("xpath=//div[@id='$selectId']","$lname, $fname"); + $this->waitForText("xpath=//div[@id='$selectId']", "$lname, $fname"); } else { - $this->waitForText("xpath=//div[@id='$selectId']","$fname"); + $this->waitForText("xpath=//div[@id='$selectId']", "$fname"); } } @@ -760,10 +760,10 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { /** * Returns a single argument from the url query */ - public function urlArg($arg, $url = NULL) { - $elements = $this->parseURL($url); - return isset($elements['queryString'][$arg]) ? $elements['queryString'][$arg] : NULL; - } + public function urlArg($arg, $url = NULL) { + $elements = $this->parseURL($url); + return isset($elements['queryString'][$arg]) ? $elements['queryString'][$arg] : NULL; + } /** * Define a payment processor for use by a webtest. Default is to create Dummy processor @@ -841,7 +841,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->openCiviPage('admin/paymentProcessor', 'action=add&reset=1&pp=' . $pid, 'name'); $this->type('name', $processorName); $this->select('financial_account_id', "label={$financialAccount}"); - foreach ($processorSettings AS $f => $v) { + foreach ($processorSettings as $f => $v) { $this->type($f, $v); } @@ -1461,7 +1461,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { break; } - $this->select2('member_of_contact_id',$membershipTitle); + $this->select2('member_of_contact_id', $membershipTitle); $this->type('minimum_fee', '100'); $this->select('financial_type_id', "value={$memTypeParams['financial_type']}"); @@ -2096,14 +2096,14 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { * * @param array $customSets * Custom sets i.e entity wise sets want to be created and checked. - e.g $customSets = array(array('entity' => 'Contribution', 'subEntity' => 'Donation', - 'triggerElement' => $triggerElement)) - array $triggerElement: the element which is responsible for custom group to load + e.g $customSets = array(array('entity' => 'Contribution', 'subEntity' => 'Donation', + 'triggerElement' => $triggerElement)) + array $triggerElement: the element which is responsible for custom group to load - which uses the entity info as its selection value + which uses the entity info as its selection value * @param array $pageUrl * The url which on which the ajax custom group load takes place. - * @param callable|boolean $beforeTriggering fn to execute before actual element triggering + * @param bool $beforeTriggering * @return void */ public function customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl, $beforeTriggering = NULL) { @@ -2222,7 +2222,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { /** * Type and select first occurance of autocomplete */ - public function select2($fieldName,$label, $multiple = FALSE, $xpath=FALSE) { + public function select2($fieldName, $label, $multiple = FALSE, $xpath = FALSE) { // In the case of chainSelect, wait for options to load $this->waitForElementNotPresent('css=select.loading'); if ($multiple) { @@ -2270,7 +2270,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { /** * Check for unobtrusive status message as set by CRM.status */ - public function checkCRMStatus($text=NULL) { + public function checkCRMStatus($text = NULL) { $this->waitForElementPresent("css=.crm-status-box-outer.status-success"); if ($text) { $this->assertElementContainsText("css=.crm-status-box-outer.status-success", $text); @@ -2280,7 +2280,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { /** * Check for obtrusive status message as set by CRM.alert */ - public function checkCRMAlert($text, $type='success') { + public function checkCRMAlert($text, $type = 'success') { $this->waitForElementPresent("css=div.ui-notify-message.$type"); $this->waitForText("css=div.ui-notify-message.$type", $text); // We got the message, now let's close it so the webtest doesn't get confused by lots of open alerts @@ -2294,7 +2294,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->openCiviPage('admin/setting/preferences/display', 'reset=1'); $isChecked = $this->isChecked('ajaxPopupsEnabled'); if (($isChecked && !$enabled) || (!$isChecked && $enabled)) { - $this->click('ajaxPopupsEnabled'); + $this->click('ajaxPopupsEnabled'); } if ($enabled) { $this->assertChecked('ajaxPopupsEnabled'); diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 21faf54560..e1f06d8477 100755 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -414,7 +414,6 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { //flush component settings CRM_Core_Component::getEnabledComponents(TRUE); - if ($this->_eNoticeCompliant) { error_reporting(E_ALL); } @@ -692,7 +691,8 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { * array(1 => array("Whiz", "String"))); */ public function assertDBQuery($expected, $query, $params = array(), $message = '') { - if ($message) $message .= ': '; + if ($message) { $message .= ': '; + } $actual = CRM_Core_DAO::singleValueQuery($query, $params); $this->assertEquals($expected, $actual, sprintf('%sexpected=[%s] actual=[%s] query=[%s]', @@ -896,12 +896,14 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { $params ); switch (strtolower($action)) { - case 'getvalue' : + case 'getvalue': return $this->callAPISuccessGetValue($entity, $params, $checkAgainst); - case 'getsingle' : + + case 'getsingle': return $this->callAPISuccessGetSingle($entity, $params, $checkAgainst); - case 'getcount' : - return $this->callAPISuccessGetCount($entity, $params, $checkAgainst); + + case 'getcount': + return $this->callAPISuccessGetCount($entity, $params, $checkAgainst); } $result = $this->civicrm_api($entity, $action, $params); $this->assertAPISuccess($result, "Failure in api call for $entity $action"); @@ -1054,7 +1056,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { * so the distinction between set * up & tested functions is clearer * - * @return array api Result + * @return array api Result */ public function createTestEntity(){ return $entity = $this->callAPISuccess($this->entity, 'create', $this->params); @@ -1130,11 +1132,11 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { $params[$key] = $values[$seq % sizeof($values)]; } if ($contact_type == 'Individual' ) { - $params['email'] = strtolower( + $params['email'] = strtolower( $params['first_name'] . '_' . $params['last_name'] . '@civicrm.org' ); - $params['prefix_id'] = 3; - $params['suffix_id'] = 3; + $params['prefix_id'] = 3; + $params['suffix_id'] = 3; } return $params; } @@ -1176,7 +1178,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { return; } $result = $this->callAPISuccess('contact', 'delete', $params); - return $result; + return $result; } /** @@ -1434,7 +1436,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { 'domain_id' => '1', ); $params = array_merge($defaults, $params); - $result = $this->callAPISuccess('Tag', 'create', $params); + $result = $this->callAPISuccess('Tag', 'create', $params); return $result['values'][$result['id']]; } @@ -1788,7 +1790,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { } - /** + /** * Function to add a Group * * @params array to add group @@ -1798,7 +1800,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { */ public function groupContactCreate($groupID, $totalCount = 10) { $params = array('group_id' => $groupID); - for ($i=1; $i <= $totalCount; $i++) { + for ($i = 1; $i <= $totalCount; $i++) { $contactID = $this->individualCreate(); if ($i == 1) { $params += array('contact_id' => $contactID); @@ -1997,7 +1999,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { $params = array_merge($defaults, $params); if (strlen($params['title']) > 13) { - $params['title'] = substr($params['title'], 0, 13); + $params['title'] = substr($params['title'], 0, 13); } //have a crack @ deleting it first in the hope this will prevent derailing our tests @@ -2070,7 +2072,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { public function entityCustomGroupWithSingleFieldCreate($function, $filename) { $params = array('title' => $function); $entity = substr(basename($filename), 0, strlen(basename($filename)) - 8); - $params['extends'] = $entity ? $entity : 'Contact'; + $params['extends'] = $entity ? $entity : 'Contact'; $customGroup = $this->CustomGroupCreate($params); $customField = $this->customFieldCreate(array('custom_group_id' => $customGroup['id'], 'label' => $function)); CRM_Core_PseudoConstant::flush(); @@ -2312,7 +2314,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { 'decision_date' => '20130805000000', ); - $keysToUnset = array('xdebug', 'undefined_fields',); + $keysToUnset = array('xdebug', 'undefined_fields'); foreach ($keysToUnset as $unwantedKey) { if(isset($result[$unwantedKey])) { unset($result[$unwantedKey]); @@ -2332,33 +2334,33 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { } foreach ($resultArray as $index => &$values) { - if(!is_array($values)) { - continue; - } - foreach($values as $key => &$value) { - if(substr($key, 0, 3) == 'api' && is_array($value)) { - if(isset($value['is_error'])) { - // we have a std nested result format - $this->tidyExampleResult($value); - } - else{ - foreach ($value as &$nestedResult) { - // this is an alternative syntax for nested results a keyed array of results - $this->tidyExampleResult($nestedResult); - } - } - } - if(in_array($key, $keysToUnset)) { - unset($values[$key]); - break; - } - if(array_key_exists($key, $fieldsToChange) && !empty($value)) { - $value = $fieldsToChange[$key]; + if(!is_array($values)) { + continue; + } + foreach($values as $key => &$value) { + if(substr($key, 0, 3) == 'api' && is_array($value)) { + if(isset($value['is_error'])) { + // we have a std nested result format + $this->tidyExampleResult($value); } - if(is_string($value)) { - $value = addslashes($value); + else{ + foreach ($value as &$nestedResult) { + // this is an alternative syntax for nested results a keyed array of results + $this->tidyExampleResult($nestedResult); + } } } + if(in_array($key, $keysToUnset)) { + unset($values[$key]); + break; + } + if(array_key_exists($key, $fieldsToChange) && !empty($value)) { + $value = $fieldsToChange[$key]; + } + if(is_string($value)) { + $value = addslashes($value); + } + } } } @@ -2619,7 +2621,7 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) } if (!empty($unformattedArray['values']) && is_array($unformattedArray['values'])) { foreach ($unformattedArray['values'] as $key => $value) { - if (is_Array($value)) { + if (is_array($value)) { foreach ($value as $k => $v) { if ($k == 'id') { unset($value[$k]); @@ -2719,7 +2721,7 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) */ public function setMockSettingsMetaData($extras) { CRM_Core_BAO_Setting::$_cache = array(); - $this->callAPISuccess('system','flush', array()); + $this->callAPISuccess('system', 'flush', array()); CRM_Core_BAO_Setting::$_cache = array(); CRM_Utils_Hook::singleton()->setHook('civicrm_alterSettingsMetaData', function (&$metadata, $domainId, $profile) use ($extras) { @@ -2935,12 +2937,12 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM'); $optionGroupID = $this->callAPISuccessGetValue('option_group', array('return' => 'id', 'name' => 'acl_role')); - $optionValue = $this->callAPISuccess('option_value', 'create', array('option_group_id' => $optionGroupID, + $optionValue = $this->callAPISuccess('option_value', 'create', array( + 'option_group_id' => $optionGroupID, 'label' => 'pick me', 'value' => 55, )); - CRM_Core_DAO::executeQuery(" TRUNCATE civicrm_acl_cache "); @@ -2949,7 +2951,6 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) TRUNCATE civicrm_acl_contact_cache "); - CRM_Core_DAO::executeQuery(" INSERT INTO civicrm_acl_entity_role ( `acl_role_id`, `entity_table`, `entity_id` diff --git a/tests/phpunit/CiviTest/Custom.php b/tests/phpunit/CiviTest/Custom.php index bcd956e176..73a70de32c 100644 --- a/tests/phpunit/CiviTest/Custom.php +++ b/tests/phpunit/CiviTest/Custom.php @@ -64,7 +64,7 @@ class Custom extends CiviUnitTestCase { * @param array $params * @param null $fields * @return object of created field -*/ + */ public static function createField($params, $fields = NULL) { if (empty($params)) { $params = array( diff --git a/tests/phpunit/CiviTest/Event.php b/tests/phpunit/CiviTest/Event.php index f062d99762..e29721d0bf 100644 --- a/tests/phpunit/CiviTest/Event.php +++ b/tests/phpunit/CiviTest/Event.php @@ -28,7 +28,6 @@ class Event extends PHPUnit_Framework_Testcase { 'contact_id' => $contactId, ); - $event = CRM_Event_BAO_Event::create($params); return $event->id; } diff --git a/tests/phpunit/CiviTest/PCP.php b/tests/phpunit/CiviTest/PCP.php index acc353cc6b..5abd17485d 100644 --- a/tests/phpunit/CiviTest/PCP.php +++ b/tests/phpunit/CiviTest/PCP.php @@ -102,7 +102,6 @@ class PCPBlock extends PHPUnit_Framework_Testcase { $delete_params = array('id' => $params['profileId']); $resulProfile = civicrm_api('uf_group', 'delete', $delete_params); - require_once 'CRM/Contribute/DAO/PCPBlock.php'; $dao = new CRM_Contribute_DAO_PCPBlock(); $dao->id = $params['blockId']; diff --git a/tests/phpunit/CiviTest/bootstrap.php b/tests/phpunit/CiviTest/bootstrap.php index 8073d31391..31920cc104 100644 --- a/tests/phpunit/CiviTest/bootstrap.php +++ b/tests/phpunit/CiviTest/bootstrap.php @@ -14,10 +14,10 @@ ini_set('include_path', # Relying on system timezone setting produces a warning, # doing the following prevents the warning message if ( file_exists( '/etc/timezone' ) ) { - $timezone = trim( file_get_contents( '/etc/timezone' ) ); - if ( ini_set('date.timezone', $timezone ) === false ) { - echo "ini_set( 'date.timezone', '$timezone' ) failed\n"; - } + $timezone = trim( file_get_contents( '/etc/timezone' ) ); + if ( ini_set('date.timezone', $timezone ) === FALSE ) { + echo "ini_set( 'date.timezone', '$timezone' ) failed\n"; + } } # Crank up the memory diff --git a/tests/phpunit/CiviTest/civicrm.settings.dist.php b/tests/phpunit/CiviTest/civicrm.settings.dist.php index 79aa179f16..0db1e5d69f 100644 --- a/tests/phpunit/CiviTest/civicrm.settings.dist.php +++ b/tests/phpunit/CiviTest/civicrm.settings.dist.php @@ -13,14 +13,14 @@ if ( ! defined( 'CIVICRM_DSN' ) && ! empty( $GLOBALS['mysql_user'] ) ) { if ( empty( $GLOBALS['mysql_pass'] ) && $GLOBALS['mysql_pass_need_password'] ) { $GLOBALS['mysql_pass'] = PHPUnit_TextUI_Command::getPassword( 'Password' ); } - define( 'CIVICRM_DSN' , "mysql://{$GLOBALS['mysql_user']}:{$GLOBALS['mysql_pass']}@{$GLOBALS['mysql_host']}/{$dbName}?new_link=true" ); + define( 'CIVICRM_DSN', "mysql://{$GLOBALS['mysql_user']}:{$GLOBALS['mysql_pass']}@{$GLOBALS['mysql_host']}/{$dbName}?new_link=true" ); } if (!defined("CIVICRM_DSN")) { - $dsn= getenv("CIVICRM_TEST_DSN"); + $dsn = getenv("CIVICRM_TEST_DSN"); if (!empty ($dsn)) { - define("CIVICRM_DSN",$dsn); + define("CIVICRM_DSN", $dsn); } else { echo "\nFATAL: no DB connection configured (CIVICRM_DSN). \nYou can either create/edit " . __DIR__ . "/civicrm.settings.local.php\n"; if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { @@ -29,7 +29,7 @@ if (!defined("CIVICRM_DSN")) { echo "OR set it in your shell:\n SETX CIVICRM_TEST_DSN mysql://db_username:db_password@localhost/civicrm_tests_dev \n (you will need to open a new command shell before it takes effect)"; } -echo "\n\n + echo "\n\n If you haven't done so already, you need to create (once) a database dedicated to the unit tests: mysql -uroot -p create database civicrm_tests_dev; @@ -59,7 +59,7 @@ define('CIVICRM_UF', 'UnitTests'); global $civicrm_root; if (empty($civicrm_root)) { - $civicrm_root = dirname (dirname (dirname (dirname( __FILE__ ) ))); + $civicrm_root = dirname(dirname(dirname(dirname( __FILE__ ) ))); } #$civicrm_root = '/var/www/drupal7.dev.civicrm.org/public/sites/devel.drupal7.tests.dev.civicrm.org/modules/civicrm'; @@ -68,7 +68,7 @@ if (empty($civicrm_root)) { if (!defined("CIVICRM_TEMPLATE_COMPILEDIR")) { if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - define( 'CIVICRM_TEMPLATE_COMPILEDIR', getenv ('TMP') . DIRECTORY_SEPARATOR . 'civi' . DIRECTORY_SEPARATOR ); + define( 'CIVICRM_TEMPLATE_COMPILEDIR', getenv('TMP') . DIRECTORY_SEPARATOR . 'civi' . DIRECTORY_SEPARATOR ); } else { define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/tmp/civi/' ); } @@ -102,7 +102,7 @@ define( 'CIVICRM_SITE_KEY', 'phpunittestfakekey' ); * */ if (!defined('CIVICRM_UF_BASEURL')) { - define( 'CIVICRM_UF_BASEURL' , 'http://FIX ME' ); + define( 'CIVICRM_UF_BASEURL', 'http://FIX ME' ); } /** @@ -126,9 +126,9 @@ $include_path = '.' . PATH_SEPARATOR . set_include_path( $include_path ); if ( function_exists( 'variable_get' ) && variable_get('clean_url', '0') != '0' ) { - define( 'CIVICRM_CLEANURL', 1 ); + define( 'CIVICRM_CLEANURL', 1 ); } else { - define( 'CIVICRM_CLEANURL', 0 ); + define( 'CIVICRM_CLEANURL', 0 ); } // force PHP to auto-detect Mac line endings @@ -139,12 +139,12 @@ $memLimitString = trim(ini_get('memory_limit')); $memLimitUnit = strtolower(substr($memLimitString, -1)); $memLimit = (int) $memLimitString; switch ($memLimitUnit) { - case 'g': $memLimit *= 1024; - case 'm': $memLimit *= 1024; - case 'k': $memLimit *= 1024; + case 'g': $memLimit *= 1024; + case 'm': $memLimit *= 1024; + case 'k': $memLimit *= 1024; } if ($memLimit >= 0 and $memLimit < 67108864) { - ini_set('memory_limit', '64M'); + ini_set('memory_limit', '64M'); } require_once 'CRM/Core/ClassLoader.php'; diff --git a/tests/phpunit/Utils.php b/tests/phpunit/Utils.php index 9093b3c960..57eaec47b0 100644 --- a/tests/phpunit/Utils.php +++ b/tests/phpunit/Utils.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: Utils.php 40328 2012-05-11 23:06:13Z allen $ - * @package CiviCRM + * @version $Id: Utils.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -32,13 +32,13 @@ /** * Utility functions - * @package CiviCRM + * @package CiviCRM */ class Utils { /** * PDO for the database - * @var PDO + * @var PDO */ public $pdo; @@ -62,8 +62,8 @@ class Utils { * Prepare and execute a query * * If the query fails, output a diagnostic message - * @param string Query to run - * @return mixed PDOStatement => Results of the query + * @param string Query to run + * @return mixed PDOStatement => Results of the query * false => Query failed */ public function do_query($query) { diff --git a/tests/phpunit/WebTest/Activity/AddRecurringActivityTest.php b/tests/phpunit/WebTest/Activity/AddRecurringActivityTest.php index f3b57fb493..a0d9d5fffd 100644 --- a/tests/phpunit/WebTest/Activity/AddRecurringActivityTest.php +++ b/tests/phpunit/WebTest/Activity/AddRecurringActivityTest.php @@ -62,10 +62,9 @@ class WebTest_Activity_AddRecurringActivityTest extends CiviSeleniumTestCase { // ...need to use mouseDownAt on first result (which is a li element), click does not work $this->clickAt("xpath=//div[@class='select2-result-label']"); - $this->waitForText("xpath=//div[@id='s2id_target_contact_id']","$contact1"); + $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$contact1"); $this->assertElementContainsText("xpath=//div[@id='s2id_target_contact_id']", "Karan, $contact1", 'Contact not found in line ' . __LINE__); - //Assigned To field $this->click("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input"); $this->keyDown("xpath=//div[@id='s2id_assignee_contact_id']/ul/li/input", " "); @@ -79,7 +78,7 @@ class WebTest_Activity_AddRecurringActivityTest extends CiviSeleniumTestCase { $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up... - $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$contact2"); + $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']", "$contact2"); // ...and verifying if the page contains properly formatted display name for chosen contact. $this->assertElementContainsText("xpath=//div[@id='s2id_assignee_contact_id']", "Jane, $contact2", 'Contact not found in line ' . __LINE__); diff --git a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php index 3229879853..3d448bbe4f 100644 --- a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php @@ -73,7 +73,7 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up... - $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$firstName1"); + $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']", "$firstName1"); // ...and verifying if the page contains properly formatted display name for chosen contact. $this->assertElementContainsText("xpath=//div[@id='s2id_assignee_contact_id']", "Summerson, $firstName1", 'Contact not found in line ' . __LINE__); @@ -181,7 +181,6 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { // ...need to use mouseDownAt on first result (which is a li element), click does not work $this->clickAt("xpath=//div[@class='select2-result-label']"); - // ...and verifying if the page contains properly formatted display name for chosen contact. $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$firstName1", 'Contact not found in line ' . __LINE__); @@ -197,7 +196,6 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { // ...need to use mouseDownAt on first result (which is a li element), click does not work $this->clickAt("xpath=//div[@class='select2-result-label']"); - // ...and verifying if the page contains properly formatted display name for chosen contact. $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$firstName2", 'Contact not found in line ' . __LINE__); diff --git a/tests/phpunit/WebTest/Activity/IcalTest.php b/tests/phpunit/WebTest/Activity/IcalTest.php index 821cc9f33b..688f715268 100644 --- a/tests/phpunit/WebTest/Activity/IcalTest.php +++ b/tests/phpunit/WebTest/Activity/IcalTest.php @@ -73,7 +73,7 @@ class WebTest_Activity_IcalTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//div[@class='select2-result-label']"); $this->clickAt("xpath=//div[@class='select2-result-label']"); - $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$firstName1"); + $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']", "$firstName1"); $subject = "Testing Ical attachment for activity assignee"; $this->type("subject", $subject); diff --git a/tests/phpunit/WebTest/Activity/StandaloneAddTest.php b/tests/phpunit/WebTest/Activity/StandaloneAddTest.php index 3826f3ae67..0e4e4c43d0 100644 --- a/tests/phpunit/WebTest/Activity/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Activity/StandaloneAddTest.php @@ -65,7 +65,7 @@ class WebTest_Activity_StandaloneAddTest extends CiviSeleniumTestCase { $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up (span with delete token class indicates that it's present)... - $this->waitForText("xpath=//div[@id='s2id_target_contact_id']","$firstName1"); + $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$firstName1"); //..and verifying if the page contains properly formatted display name for chosen contact. $this->assertElementContainsText("xpath=//div[@id='s2id_target_contact_id']", "Anderson, $firstName1", 'Contact not found in line ' . __LINE__); @@ -84,7 +84,7 @@ class WebTest_Activity_StandaloneAddTest extends CiviSeleniumTestCase { $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up... - $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$firstName2"); + $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']", "$firstName2"); // ...and verifying if the page contains properly formatted display name for chosen contact. $this->assertElementContainsText("xpath=//div[@id='s2id_assignee_contact_id']", "Summerson, $firstName2", 'Contact not found in line ' . __LINE__); @@ -182,8 +182,8 @@ class WebTest_Activity_StandaloneAddTest extends CiviSeleniumTestCase { */ public function VerifyTabularData($expected, $xpathPrefix = NULL) { foreach ($expected as $label => $value) { - $this->waitForElementPresent("xpath=//table/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td/span"); - $this->verifyText("xpath=//table/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td/span", preg_quote($value), 'In line ' . __LINE__); + $this->waitForElementPresent("xpath=//table/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td/span"); + $this->verifyText("xpath=//table/tbody/tr/td{$xpathPrefix}[text()='{$label}']/../following-sibling::td/span", preg_quote($value), 'In line ' . __LINE__); } } } diff --git a/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php b/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php index 061910d57f..df683f0ee6 100644 --- a/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php +++ b/tests/phpunit/WebTest/Admin/MoveCustomDataTest.php @@ -100,7 +100,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { } //Go to the contacts page and check that the custom field is in the right group - $this->openCiviPage('contact/view',"reset=1&cid={$cid_all}"); + $this->openCiviPage('contact/view', "reset=1&cid={$cid_all}"); //load the names of the custom fieldsets $source = $this->webtest_civicrm_api("CustomGroup", "get", array('id' => $from_group_id)); @@ -373,6 +373,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { $this->select("date_format", "value=yy-mm-dd"); $this->click("//option[@value='yy-mm-dd']"); break; + //TODO allow for more things.... } @@ -397,8 +398,7 @@ class WebTest_Admin_MoveCustomDataTest extends CiviSeleniumTestCase { * @param string $prefix * @param array $values */ - function _createFieldOptions($count = 3, $prefix = "option", $values = array( - )) { + function _createFieldOptions($count = 3, $prefix = "option", $values = array()) { // Only support up to 10 options on the creation form $count = $count > 10 ? 10 : $count; diff --git a/tests/phpunit/WebTest/AllTests.php b/tests/phpunit/WebTest/AllTests.php index d772ec0541..f6bb7f4c7c 100644 --- a/tests/phpunit/WebTest/AllTests.php +++ b/tests/phpunit/WebTest/AllTests.php @@ -33,7 +33,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all CRM test suites * - * @package CiviCRM + * @package CiviCRM */ class WebTest_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/WebTest/Campaign/ActivityTest.php b/tests/phpunit/WebTest/Campaign/ActivityTest.php index 5231316748..6129025224 100644 --- a/tests/phpunit/WebTest/Campaign/ActivityTest.php +++ b/tests/phpunit/WebTest/Campaign/ActivityTest.php @@ -190,7 +190,7 @@ class WebTest_Campaign_ActivityTest extends CiviSeleniumTestCase { $this->type("followup_activity_subject", "This is subject of schedule follow-up activity"); // Clicking save. - $this->clickLink("_qf_Activity_upload",'link=View',FALSE); + $this->clickLink("_qf_Activity_upload", 'link=View', FALSE); // Is status message correct? $this->waitForText('crm-notification-container', $subject); diff --git a/tests/phpunit/WebTest/Campaign/MailingTest.php b/tests/phpunit/WebTest/Campaign/MailingTest.php index 8d0ebbfb2c..a77a7bc5a3 100644 --- a/tests/phpunit/WebTest/Campaign/MailingTest.php +++ b/tests/phpunit/WebTest/Campaign/MailingTest.php @@ -227,7 +227,7 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // verify undelivered status message - $this->assertElementContainsText('crm-container',"Delivery has not yet begun for this mailing. If the scheduled delivery date and time is past, ask the system administrator or technical support contact for your site to verify that the automated mailer task ('cron job') is running - and how frequently."); + $this->assertElementContainsText('crm-container', "Delivery has not yet begun for this mailing. If the scheduled delivery date and time is past, ask the system administrator or technical support contact for your site to verify that the automated mailer task ('cron job') is running - and how frequently."); // do check for recipient group $this->assertElementContainsText('crm-container', "Members of $groupName"); diff --git a/tests/phpunit/WebTest/Campaign/OfflineContributionTest.php b/tests/phpunit/WebTest/Campaign/OfflineContributionTest.php index a51326fa2c..dd67c00a69 100644 --- a/tests/phpunit/WebTest/Campaign/OfflineContributionTest.php +++ b/tests/phpunit/WebTest/Campaign/OfflineContributionTest.php @@ -185,7 +185,6 @@ class WebTest_Campaign_OfflineContributionTest extends CiviSeleniumTestCase { $this->type("invoice_id", time()); $this->webtestFillDate('thankyou_date'); - //Premium section $this->click("Premium"); $this->waitForElementPresent("fulfilled_date"); diff --git a/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php b/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php index e447b25be9..852e36a79d 100644 --- a/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php +++ b/tests/phpunit/WebTest/Campaign/OnlineEventRegistrationTest.php @@ -218,7 +218,7 @@ class WebTest_Campaign_OnlineEventRegistrationTest extends CiviSeleniumTestCase $this->waitForElementPresent("_qf_Fee_upload-bottom"); $this->click("CIVICRM_QFID_1_is_monetary"); $this->check("payment_processor[$processorId]"); - $this->select("financial_type_id", "value=4"); + $this->select("financial_type_id", "value=4"); if ($priceSet) { // get one - TBD } diff --git a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php index 3fa42bb6f0..fc6ec38509 100644 --- a/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php +++ b/tests/phpunit/WebTest/Campaign/SurveyUsageScenarioTest.php @@ -234,12 +234,12 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { $this->waitForElementPresent("_qf_Interview_cancel_interview"); $this->click("CIVICRM_QFID_1_2"); - $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[8]/select","value=Label $title 1"); + $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[8]/select", "value=Label $title 1"); $this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[1]/td[9]/a"); $this->click("CIVICRM_QFID_2_8"); - $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[8]/select","value=Label $title 2"); + $this->select("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[8]/select", "value=Label $title 2"); $this->click("xpath=//table[@class='display crm-copy-fields dataTable no-footer']/tbody/tr[2]/td[9]/a"); $this->click("_qf_Interview_cancel_interview"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -298,7 +298,7 @@ class WebTest_Campaign_SurveyUsageScenarioTest extends CiviSeleniumTestCase { $this->waitForElementPresent('_qf_Search_refresh'); $this->clickLink("_qf_Search_refresh"); - $this->waitForText("xpath=//div[@id='search-status']/table/tbody/tr[1]/td[1]",'1 Result'); + $this->waitForText("xpath=//div[@id='search-status']/table/tbody/tr[1]/td[1]", '1 Result'); } public function testSurveyReportTest() { diff --git a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php index a7c71e254c..fd07cfc3d7 100644 --- a/tests/phpunit/WebTest/Case/ActivityToCaseTest.php +++ b/tests/phpunit/WebTest/Case/ActivityToCaseTest.php @@ -232,7 +232,7 @@ class WebTest_Case_ActivityToCaseTest extends CiviSeleniumTestCase { $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up... - $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$firstName1"); + $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']", "$firstName1"); // ...and verifying if the page contains properly formatted display name for chosen contact. $this->assertElementContainsText("xpath=//div[@id='s2id_assignee_contact_id']", "Summerson, $firstName1", 'Contact not found in line ' . __LINE__); diff --git a/tests/phpunit/WebTest/Case/AddCaseTest.php b/tests/phpunit/WebTest/Case/AddCaseTest.php index b0d71e8a70..a335d94fbb 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTest.php @@ -129,7 +129,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { //change the case status to Resolved to get the end date $this->click("xpath=//form[@id='CaseView']/div[2]/table/tbody/tr/td[4]/a"); $this->waitForElementPresent("_qf_Activity_cancel-bottom"); - $this->select("case_status_id","value=2"); + $this->select("case_status_id", "value=2"); $this->click("_qf_Activity_upload-top"); $this->_testSearchbyDate($client['first_name'], $client['last_name'], "this.quarter"); @@ -277,7 +277,7 @@ class WebTest_Case_AddCaseTest extends CiviSeleniumTestCase { * * test for assign case to another client */ - public function _testAssignToClient($firstName, $lastName, $caseTypeLabel) { + public function _testAssignToClient($firstName, $lastName, $caseTypeLabel) { $this->openCiviPage('case/search', 'reset=1', '_qf_Search_refresh-bottom'); $this->type('sort_name', $firstName); $this->clickLink('_qf_Search_refresh-bottom'); diff --git a/tests/phpunit/WebTest/Case/AddCaseTypeTest.php b/tests/phpunit/WebTest/Case/AddCaseTypeTest.php index 78bb0fc777..49083679eb 100644 --- a/tests/phpunit/WebTest/Case/AddCaseTypeTest.php +++ b/tests/phpunit/WebTest/Case/AddCaseTypeTest.php @@ -37,8 +37,8 @@ class WebTest_Case_AddCaseTypeTest extends CiviSeleniumTestCase { public function testAddEditCaseType() { $caseRoles = array(1 => 'Parent of', 2 => 'Spouse of', 3 => 'Partner of'); - $activityTypes = array(1 => 'Meeting',2 => 'Contribution',3 => 'Event Registration'); - $timelineActivityTypes = array(1 => 'Meeting',2 => 'Phone Call',3 => 'Email'); + $activityTypes = array(1 => 'Meeting', 2 => 'Contribution', 3 => 'Event Registration'); + $timelineActivityTypes = array(1 => 'Meeting', 2 => 'Phone Call', 3 => 'Email'); // Log in as admin first to verify permissions for CiviCase $this->webtestLogin('admin'); diff --git a/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php b/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php index a99bd5e377..f47dec00e1 100644 --- a/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php +++ b/tests/phpunit/WebTest/Case/CaseCustomFieldsTest.php @@ -177,7 +177,7 @@ class WebTest_Case_CaseCustomFieldsTest extends CiviSeleniumTestCase { * * @return array */ - public function _testGetCustomFieldId($customGrpId1, $noteRichEditor=FALSE) { + public function _testGetCustomFieldId($customGrpId1, $noteRichEditor = FALSE) { $customId = array(); $this->openCiviPage('admin/custom/group/field/add', array('reset' => 1, 'action' => 'add', 'gid' => $customGrpId1)); diff --git a/tests/phpunit/WebTest/Contact/AddContactsToEventAdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/AddContactsToEventAdvancedSearchTest.php index 18fe0f54ad..77225702bd 100644 --- a/tests/phpunit/WebTest/Contact/AddContactsToEventAdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/AddContactsToEventAdvancedSearchTest.php @@ -48,7 +48,6 @@ class WebTest_Contact_AddContactsToEventAdvancedSearchTest extends CiviSeleniumT $this->select('task', "label=Add Contacts to Event"); - // Select event. Based on label for now. $this->waitForElementPresent('event_id'); $this->select2('event_id', "Rain-forest Cup Youth Soccer Tournament"); diff --git a/tests/phpunit/WebTest/Contact/AddTest.php b/tests/phpunit/WebTest/Contact/AddTest.php index e4d37dbec4..17daa2834e 100644 --- a/tests/phpunit/WebTest/Contact/AddTest.php +++ b/tests/phpunit/WebTest/Contact/AddTest.php @@ -409,7 +409,6 @@ class WebTest_Contact_AddTest extends CiviSeleniumTestCase { //create new current employer $currentEmployer = substr(sha1(rand()), 0, 7) . "Web Access"; - //fill in email $this->type("email_1_email", substr(sha1(rand()), 0, 7) . "john@gmail.com"); diff --git a/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php b/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php index d07e969c51..40b7094ae4 100644 --- a/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php +++ b/tests/phpunit/WebTest/Contact/AdvanceSearchPaneTest.php @@ -89,8 +89,7 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase { /** * @param array $openedPanes */ - function _checkOpenedPanes($openedPanes = array( - )) { + function _checkOpenedPanes($openedPanes = array()) { if (!$this->isTextPresent('None found.')) { $this->click('css=div.crm-advanced_search_form-accordion div.crm-accordion-header'); } @@ -112,8 +111,7 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase { * @param $paneRef * @param array $selectFields */ - function _selectPaneFields($paneRef, $selectFields = array( - )) { + function _selectPaneFields($paneRef, $selectFields = array()) { $pane = $this->_advanceSearchPanes($paneRef); $this->click("css=div.crm-accordion-wrapper {$pane['headerLocator']}"); diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php index aa1eccedf1..65c297baed 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php @@ -187,7 +187,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $cal = $count / $perPageRow; $mod = $count % $perPageRow; $j = 1; - for ($i=1; $i<=$cal; $i++) { + for ($i = 1; $i <= $cal; $i++) { $subTotal = $i * $perPageRow; $lastPageSub = $subTotal + 1; @@ -236,7 +236,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->select2("group", "Summer", TRUE); $this->select2("group", "Advisory", TRUE); $this->clickAjaxLink("location", 'country'); - $this->select2("country", "United States", False); + $this->select2("country", "United States", FALSE); $this->waitForElementPresent('state_province'); $this->multiselect2("state_province", array("Ohio", "New York", "New Mexico", "Connecticut", "Georgia", "New Jersey", "Texas")); $this->clickLink("_qf_Advanced_refresh", "xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]"); @@ -307,7 +307,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->click("xpath=//div[@id='activity']/table/tbody/tr[2]/td[1]/div[1]//div/label[text()=\"$labels\"]"); } // fill date range - $this->select("activity_date_relative","value=0"); + $this->select("activity_date_relative", "value=0"); $this->webtestFillDate("activity_date_low", "-1 day"); $this->webtestFillDate("activity_date_high", "+1 day"); $this->type("activity_subject", "Student - membership source$firstName - Status: New"); @@ -320,12 +320,12 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { // function to fill demographic search details public function addDemographicSearchDetail() { // fill birth date range - $this->select("birth_date_relative","value=0"); + $this->select("birth_date_relative", "value=0"); $this->webtestFillDate("birth_date_low", "-3 year"); $this->webtestFillDate("birth_date_high", "now"); // fill deceased date range $this->click("xpath=//div[@id='demographics']/table/tbody//tr/td/label[text()='Deceased']/../label[text()='Yes']"); - $this->select("deceased_date_relative","value=0"); + $this->select("deceased_date_relative", "value=0"); $this->webtestFillDate("deceased_date_low", "-1 month"); $this->webtestFillDate("deceased_date_high", "+1 month"); // fill gender (male) @@ -338,7 +338,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { */ public function addContributionSearchDetail($firstName) { // fill contribution date range - $this->select("contribution_date_relative","value=0"); + $this->select("contribution_date_relative", "value=0"); $this->webtestFillDate("contribution_date_low", "-1 day"); $this->webtestFillDate("contribution_date_high", "+1 day"); // fill amount range @@ -351,8 +351,8 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { $this->type("contribution_check_number", "chqNo$firstName"); // fill transaction id $this->type("contribution_transaction_id", "trid$firstName"); - // fill financial type - $this->select("financial_type_id", "Event Fee"); + // fill financial type + $this->select("financial_type_id", "Event Fee"); // fill currency type $this->select("contribution_currency_type", "USD"); } @@ -388,15 +388,15 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { // check to search primary member $this->click("xpath=//div[@id='memberForm']/table/tbody/tr[2]/td[2]/p/input"); // add join date range - $this->select("member_join_date_relative","value=0"); + $this->select("member_join_date_relative", "value=0"); $this->webtestFillDate("member_join_date_low", "-1 day"); $this->webtestFillDate("member_join_date_high", "+1 day"); // add start date range - $this->select("member_start_date_relative","value=0"); + $this->select("member_start_date_relative", "value=0"); $this->webtestFillDate("member_start_date_low", "-1 day"); $this->webtestFillDate("member_start_date_high", "+1 day"); // add end date range - $this->select("member_end_date_relative","value=0"); + $this->select("member_end_date_relative", "value=0"); $this->webtestFillDate("member_end_date_low", "-1 year"); $this->webtestFillDate("member_end_date_high", "+2 year"); } @@ -407,7 +407,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { */ public function addPledgeSearchDetail($firstName) { // fill pledge schedule date range - $this->select("pledge_payment_date_relative","value=0"); + $this->select("pledge_payment_date_relative", "value=0"); $this->webtestFillDate("pledge_payment_date_low", "-1 day"); $this->webtestFillDate("pledge_payment_date_high", "+1 day"); // fill Pledge payment status diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php index c026d41d33..52377cbfd5 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php @@ -60,7 +60,8 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $Id = explode('-', $this->getAttribute("xpath=//div[@id='event_status_id']/div[2]/table/tbody/tr@id")); $eventId = $Id[1]; - $params = array('label_a_b' => 'Owner of ' . rand(), + $params = array( + 'label_a_b' => 'Owner of ' . rand(), 'label_b_a' => 'Belongs to ' . rand(), 'contact_type_a' => 'Individual', 'contact_type_b' => 'Individual', @@ -303,11 +304,11 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->assertElementContainsText('search-status', '2 Contacts'); } - public function testAdvanceSearchForLog() { + public function testAdvanceSearchForLog() { $this->webtestLogin(); - $Pdate = date('F jS, Y h:i:s A', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 1, date( 'Y' )) ); - $Ndate = date('F jS, Y h:i:s A', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) + 1, date( 'Y' )) ); + $Pdate = date('F jS, Y h:i:s A', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 1, date( 'Y' )) ); + $Ndate = date('F jS, Y h:i:s A', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) + 1, date( 'Y' )) ); //create a contact and return the contact id $firstNameSoft = "John_".substr(sha1(rand()), 0, 5); @@ -320,15 +321,15 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes $this->type('sort_name', $lastNameSoft.', '.$firstNameSoft); $this->click('changeLog'); $this->waitForElementPresent("log_date_low"); - $this->select("log_date_relative","value=0"); + $this->select("log_date_relative", "value=0"); $this->webtestFillDate('log_date_low', "-1 day"); $this->webtestFillDate('log_date_high', "+1 day"); $this->click('_qf_Advanced_refresh'); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->assertTrue(True, 'greater than or equal to "{$Pdate}" AND less than or equal to "{$Ndate}"'); + $this->assertTrue(TRUE, 'greater than or equal to "{$Pdate}" AND less than or equal to "{$Ndate}"'); $value = "$lastNameSoft, $firstNameSoft"; $this->verifyText("xpath= id('rowid{$cid}')/td[3]/a", preg_quote($value)); -} + } } diff --git a/tests/phpunit/WebTest/Contact/ContactTagTest.php b/tests/phpunit/WebTest/Contact/ContactTagTest.php index 0d13e9c013..5e4ab7eac9 100644 --- a/tests/phpunit/WebTest/Contact/ContactTagTest.php +++ b/tests/phpunit/WebTest/Contact/ContactTagTest.php @@ -136,7 +136,6 @@ class WebTest_Contact_ContactTagTest extends CiviSeleniumTestCase { // ...need to use mouseDownAt on first result (which is a li element), click does not work $this->clickAt("xpath=//div[@class='select2-result-label']"); - // Type search name in autocomplete. $this->click("css=input#sort_name_navigation"); $this->type("css=input#sort_name_navigation", $firstName); diff --git a/tests/phpunit/WebTest/Contact/CustomDataAddTest.php b/tests/phpunit/WebTest/Contact/CustomDataAddTest.php index 0af12c2c52..0e73c825a6 100644 --- a/tests/phpunit/WebTest/Contact/CustomDataAddTest.php +++ b/tests/phpunit/WebTest/Contact/CustomDataAddTest.php @@ -206,7 +206,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { //Get the customFieldsetID $this->openCiviPage('admin/custom/group', 'reset=1'); $customFieldsetId = explode('&gid=', $this->getAttribute("xpath=//div[@id='custom_group']//table/tbody//tr/td/span[text()='$customGroupTitle']/../../td[7]/span/a@href")); - $customFieldsetId = $customFieldsetId[1]; + $customFieldsetId = $customFieldsetId[1]; //create Individual contact $this->openCiviPage("contact/add", "reset=1&ct=Individual"); @@ -285,7 +285,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->click("xpath=//table//tr/td/label[text()=\"$customField\"]"); $value = "custom".rand(); - $this->type("xpath=//table//tr/td/label[text()=\"$customField\"]/../following-sibling::td/input",$value); + $this->type("xpath=//table//tr/td/label[text()=\"$customField\"]/../following-sibling::td/input", $value); //check for matching contact $this->click("_qf_Contact_refresh_dedupe"); @@ -318,7 +318,7 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->clickLink("xpath=//ul[@id='actions']/li[2]/a/span"); $this->click("xpath=//table//tr/td/label[text()=\"$customField\"]"); $value1 = "custom_1".rand(); - $this->type("xpath=//table//tr/td/label[text()=\"$customField\"]/../following-sibling::td/input",$value1); + $this->type("xpath=//table//tr/td/label[text()=\"$customField\"]/../following-sibling::td/input", $value1); $this->click("_qf_Contact_upload_view-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->click("css=#tab_log a"); diff --git a/tests/phpunit/WebTest/Contact/DupeContactTest.php b/tests/phpunit/WebTest/Contact/DupeContactTest.php index d73fe00bb8..c941b0b988 100644 --- a/tests/phpunit/WebTest/Contact/DupeContactTest.php +++ b/tests/phpunit/WebTest/Contact/DupeContactTest.php @@ -68,7 +68,7 @@ class WebTest_Contact_DupeContactTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); $this->waitForText('crm-notification-container', "Contact Saved"); - $this->openCiviPage('contact/add' , 'reset=1&ct=Individual'); + $this->openCiviPage('contact/add', 'reset=1&ct=Individual'); //contact details section diff --git a/tests/phpunit/WebTest/Contact/EditContactTest.php b/tests/phpunit/WebTest/Contact/EditContactTest.php index f4d9453cb8..b39909663d 100644 --- a/tests/phpunit/WebTest/Contact/EditContactTest.php +++ b/tests/phpunit/WebTest/Contact/EditContactTest.php @@ -42,8 +42,8 @@ class WebTest_Contact_EditContactTest extends CiviSeleniumTestCase { $firstName = 'WebTest' . substr(sha1(rand()), 0, 7); $lastName = 'ContactEdit' . substr(sha1(rand()), 0, 7); $this->openCiviPage("contact/add", "reset=1&ct=Individual"); - $this->type("first_name",$firstName); - $this->type("last_name",$lastName); + $this->type("first_name", $firstName); + $this->type("last_name", $lastName); //fill in phone 1 $this->type("phone_1_phone", "111113333"); @@ -91,7 +91,7 @@ class WebTest_Contact_EditContactTest extends CiviSeleniumTestCase { $this->type("phone_2_phone_ext", "111"); $this->select('phone_2_location_type_id', 'value=3'); - //Edit in phone 3 + //Edit in phone 3 $this->type("phone_3_phone", "777777699"); $this->type("phone_3_phone_ext", "197"); $this->select('phone_3_location_type_id', 'value=1'); diff --git a/tests/phpunit/WebTest/Contact/GroupAddTest.php b/tests/phpunit/WebTest/Contact/GroupAddTest.php index 5ed83771bf..d79c2b4d38 100644 --- a/tests/phpunit/WebTest/Contact/GroupAddTest.php +++ b/tests/phpunit/WebTest/Contact/GroupAddTest.php @@ -232,9 +232,9 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase { $this->waitForTextPresent("The role has been deleted."); } - /** - * Webtest for add contact to group (CRM-15108) - */ + /** + * Webtest for add contact to group (CRM-15108) + */ public function testAddContactToGroup() { $this->webtestLogin(); $this->openCiviPage("contact/add", "reset=1&ct=Individual"); @@ -273,7 +273,7 @@ class WebTest_Contact_GroupAddTest extends CiviSeleniumTestCase { $this->openCiviPage('contact/search', 'reset=1'); $this->waitForElementPresent("_qf_Basic_refresh"); $this->type('sort_name', $firstName); - $this->select('group',"Advisory Board"); + $this->select('group', "Advisory Board"); $this->click('_qf_Basic_refresh'); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[3]/a[text()='{$lastName}, {$firstName}']")); diff --git a/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php b/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php index 6aa890b982..4ff94545c8 100644 --- a/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php +++ b/tests/phpunit/WebTest/Contact/InlineFieldsEditTest.php @@ -261,6 +261,7 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { case 'boolean': $this->click($item); break; + case 'string': if (substr($val, 0, 5) == 'date:') { $this->webtestFillDate($item, trim(substr($val, 5))); @@ -269,10 +270,12 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { $this->type($item, $val); } break; + case 'integer': $method = $val ? 'check' : 'uncheck'; $this->$method($item); break; + case 'array': foreach ($val as $option) { $selector = is_int($option) ? 'value' : 'label'; @@ -282,7 +285,7 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { } } $this->click("css=#$block input.crm-form-submit"); - if ($valid !== 'error' && $valid !='errorJs') { + if ($valid !== 'error' && $valid != 'errorJs') { // Verify the form saved $this->waitForElementPresent("css=#$block > .crm-inline-block-content"); $validate = FALSE; @@ -316,10 +319,12 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { $this->assertElementValueEquals($item, $val); } break; + case 'integer': $method = $val ? 'assertChecked' : 'assertNotChecked'; $this->$method($item); break; + case 'array': foreach ($val as $option) { $method = is_int($option) ? 'assertIsSelected' : 'assertSelected'; @@ -339,6 +344,7 @@ class WebTest_Contact_InlineFieldsEditTest extends CiviSeleniumTestCase { case 'errorJs': $this->waitForElementPresent('css=label.error'); break; + default: $this->waitForElementPresent('css=#crm-notification-container .error.ui-notify-message'); $this->click('css=#crm-notification-container .error .ui-notify-cross'); diff --git a/tests/phpunit/WebTest/Contact/MergeContactsTest.php b/tests/phpunit/WebTest/Contact/MergeContactsTest.php index 8b32daa619..bd671eb5e3 100644 --- a/tests/phpunit/WebTest/Contact/MergeContactsTest.php +++ b/tests/phpunit/WebTest/Contact/MergeContactsTest.php @@ -276,7 +276,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { // Now we're filling the "Assigned To" field. // Typing contact's name into the field (using typeKeys(), not type()!)... - $this->select2("assignee_contact_id", $firstName,TRUE,FALSE); + $this->select2("assignee_contact_id", $firstName, TRUE, FALSE); // ...and verifying if the page contains properly formatted display name for chosen contact. $this->assertTrue($this->isTextPresent("$lastName, " . $firstName), "Contact not found in line " . __LINE__); @@ -507,7 +507,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $firstName = "Kerry".substr(sha1(rand()), 0, 7); //last name $lastName = "King".substr(sha1(rand()), 0, 7); - $this->_createContacts($firstName,$lastName); + $this->_createContacts($firstName, $lastName); //add contact2 and its duplicate //These are the contacts with conflicts in communication preference.these contacts will be skipped during merge. @@ -579,14 +579,14 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $firstName2 = "David".substr(sha1(rand()), 0, 7); //fill in last name $lastName2 = "Gilmour".substr(sha1(rand()), 0, 7); - $this->_createContacts($firstName2,$lastName2); + $this->_createContacts($firstName2, $lastName2); // add contact4 and its duplicate //fill in first name $firstName3 = "Dave".substr(sha1(rand()), 0, 7); //fill in last name $lastName3 = "Mustaine".substr(sha1(rand()), 0, 7); - $this->_createContacts($firstName3,$lastName3); + $this->_createContacts($firstName3, $lastName3); // Find and Merge Contacts with Supervised Rule $this->openCiviPage("contact/dedupefind", "reset=1&rgid=1&action=renew", "css=#DedupeFind table.pagerDisplay tbody tr"); @@ -597,7 +597,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { // Check confirmation alert. $this->assertTrue( - (bool)preg_match("/^This will run the batch merge process on the listed duplicates. The operation will run in safe mode - only records with no direct data conflicts will be merged. Click OK to proceed if you are sure you wish to run this operation./", + (bool) preg_match("/^This will run the batch merge process on the listed duplicates. The operation will run in safe mode - only records with no direct data conflicts will be merged. Click OK to proceed if you are sure you wish to run this operation./", $this->getConfirmation() )); $this->chooseOkOnNextConfirmation(); @@ -972,7 +972,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->openCiviPage("contact/dedupefind", "reset=1&action=update&rgid=4"); $this->click("xpath=//a/span[text()='Refresh Duplicates']"); - $this->assertTrue((bool)preg_match("/This will refresh the duplicates list. Click OK to proceed./", $this->getConfirmation())); + $this->assertTrue((bool) preg_match("/This will refresh the duplicates list. Click OK to proceed./", $this->getConfirmation())); $this->chooseOkOnNextConfirmation(); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->waitForElementPresent("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']"); diff --git a/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php b/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php index 7750dad7a2..0bcbaba77f 100644 --- a/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php +++ b/tests/phpunit/WebTest/Contact/MultipleContactSubTypes.php @@ -198,7 +198,7 @@ class WebTest_Contact_MultipleContactSubTypes extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // Check confirmation alert. - $this->assertTrue((bool)preg_match("/One or more contact subtypes have been de-selected from the list for this contact. Any custom data associated with de-selected subtype will be removed. Click OK to proceed, or Cancel to review your changes before saving./", $this->getConfirmation())); + $this->assertTrue((bool) preg_match("/One or more contact subtypes have been de-selected from the list for this contact. Any custom data associated with de-selected subtype will be removed. Click OK to proceed, or Cancel to review your changes before saving./", $this->getConfirmation())); $this->chooseOkOnNextConfirmation(); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php index d669c3285b..f200fdb267 100644 --- a/tests/phpunit/WebTest/Contact/RelationshipAddTest.php +++ b/tests/phpunit/WebTest/Contact/RelationshipAddTest.php @@ -79,7 +79,6 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //fill in the individual $this->select2('related_contact_id', $sortName, TRUE); - //fill in the relationship start date $this->webtestFillDate('start_date', '-2 year'); $this->webtestFillDate('end_date', '+1 year'); @@ -164,7 +163,6 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //fill in the individual $this->select2('related_contact_id', $sortName, TRUE); - //fill in the relationship start date $this->webtestFillDate('start_date', '-2 year'); $this->webtestFillDate('end_date', '+1 year'); @@ -323,7 +321,7 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { $this->type('organization_name', $orgName); $this->type('email-Primary', "info@" . $orgName . ".com"); $this->click('_qf_Edit_next'); - $this->waitForText("xpath=//div[@id='s2id_related_contact_id']","$orgName"); + $this->waitForText("xpath=//div[@id='s2id_related_contact_id']", "$orgName"); //fill in the relationship start date $this->webtestFillDate('start_date', '-2 year'); @@ -336,7 +334,6 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { //$this->click("_qf_Relationship_upload"); $this->click("_qf_Relationship_upload-bottom"); - //check the status message $this->waitForText('crm-notification-container', 'Relationship created.'); @@ -402,7 +399,7 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { $this->type('organization_name', $orgName); $this->type('email-Primary', "info@" . $orgName . ".com"); $this->click('_qf_Edit_next'); - $this->waitForText("xpath=//div[@id='s2id_related_contact_id']","$orgName"); + $this->waitForText("xpath=//div[@id='s2id_related_contact_id']", "$orgName"); //fill in the relationship start date $this->webtestFillDate('start_date', '-2 year'); @@ -411,7 +408,6 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { $description = "Current employee test."; $this->type("description", $description); - //save the relationship //$this->click("_qf_Relationship_upload"); $this->click('_qf_Relationship_upload-bottom'); @@ -429,6 +425,6 @@ class WebTest_Contact_RelationshipAddTest extends CiviSeleniumTestCase { 'Status' => 'Enabled', ) ); - $this->assertTrue($this->isTextPresent("Employee of"),"Employee of relationship type not visible on View Relationship page."); + $this->assertTrue($this->isTextPresent("Employee of"), "Employee of relationship type not visible on View Relationship page."); } } diff --git a/tests/phpunit/WebTest/Contact/SearchTest.php b/tests/phpunit/WebTest/Contact/SearchTest.php index d5db1f9ab0..7d62358848 100644 --- a/tests/phpunit/WebTest/Contact/SearchTest.php +++ b/tests/phpunit/WebTest/Contact/SearchTest.php @@ -117,7 +117,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { // add to group $this->select("group_id", "label=$groupName"); $this->click("_qf_GroupContact_next"); - $this->waitForText("crm-notification-container","Contact has been added to '$groupName'."); + $this->waitForText("crm-notification-container", "Contact has been added to '$groupName'."); // tag a contact // visit tag tab @@ -206,7 +206,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { // add to group $this->select("group_id", "label=$parentGroupName"); $this->click("_qf_GroupContact_next"); - $this->waitForText("crm-notification-container","Contact has been added to '$parentGroupName'."); + $this->waitForText("crm-notification-container", "Contact has been added to '$parentGroupName'."); // Adding child group contact // We're using Quick Add block on the main page for this. @@ -224,7 +224,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase { // add to child group $this->select("group_id", "*$childGroupName"); $this->click("_qf_GroupContact_next"); - $this->waitForText("crm-notification-container","Contact has been added to '$childGroupName'."); + $this->waitForText("crm-notification-container", "Contact has been added to '$childGroupName'."); // visit contact search page $this->openCiviPage("contact/search", "reset=1"); diff --git a/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php b/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php index d93e0211db..dc70445f81 100644 --- a/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php +++ b/tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php @@ -65,90 +65,90 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { $this->webtestLogin(); $this->openCiviPage("contribute/search", "reset=1"); - $this->select("contribution_date_relative","value=previous_before.quarter"); + $this->select("contribution_date_relative", "value=previous_before.quarter"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("contribution_date_relative","value=previous_2.quarter"); + $this->select("contribution_date_relative", "value=previous_2.quarter"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("contribution_date_relative","value=earlier.quarter"); + $this->select("contribution_date_relative", "value=earlier.quarter"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("contribution_date_relative","value=ending.year"); + $this->select("contribution_date_relative", "value=ending.year"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); $this->openCiviPage("member/search", "reset=1"); - $this->select("member_end_date_relative","value=previous_before.month"); + $this->select("member_end_date_relative", "value=previous_before.month"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("member_end_date_relative","value=previous_2.month"); + $this->select("member_end_date_relative", "value=previous_2.month"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("member_end_date_relative","value=earlier.month"); + $this->select("member_end_date_relative", "value=earlier.month"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("member_end_date_relative","value=ending.month"); + $this->select("member_end_date_relative", "value=ending.month"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); $this->openCiviPage("event/search", "reset=1"); - $this->select("event_relative","value=previous_before.week"); + $this->select("event_relative", "value=previous_before.week"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("event_relative","value=previous_2.week"); + $this->select("event_relative", "value=previous_2.week"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("event_relative","value=earlier.week"); + $this->select("event_relative", "value=earlier.week"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("event_relative","value=ending.week"); + $this->select("event_relative", "value=ending.week"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); $this->openCiviPage("activity/search", "reset=1"); - $this->select("activity_date_relative","value=previous_before.day"); + $this->select("activity_date_relative", "value=previous_before.day"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("activity_date_relative","value=previous_2.day"); + $this->select("activity_date_relative", "value=previous_2.day"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("activity_date_relative","value=earlier.day"); + $this->select("activity_date_relative", "value=earlier.day"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("activity_date_relative","value=ending.quarter"); + $this->select("activity_date_relative", "value=ending.quarter"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); $this->openCiviPage("pledge/search", "reset=1"); - $this->select("pledge_payment_date_relative","value=greater.week"); + $this->select("pledge_payment_date_relative", "value=greater.week"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); $this->click("xpath=//form[@id='Search']/div[2]/div/div"); - $this->select("pledge_payment_date_relative","value=greater.day"); + $this->select("pledge_payment_date_relative", "value=greater.day"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); $this->click("xpath=//form[@id='Search']/div[2]/div/div"); - $this->select("pledge_payment_date_relative","value=greater.quarter"); + $this->select("pledge_payment_date_relative", "value=greater.quarter"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); $this->click("xpath=//form[@id='Search']/div[2]/div/div"); - $this->select("pledge_payment_date_relative","value=greater.month"); + $this->select("pledge_payment_date_relative", "value=greater.month"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); $this->openCiviPage("mailing", "reset=1"); - $this->select("mailing_relative","value=previous_before.year"); + $this->select("mailing_relative", "value=previous_before.year"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("mailing_relative","value=previous_2.year"); + $this->select("mailing_relative", "value=previous_2.year"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("mailing_relative","value=earlier.year"); + $this->select("mailing_relative", "value=earlier.year"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); - $this->select("mailing_relative","value=greater.year"); + $this->select("mailing_relative", "value=greater.year"); $this->click("_qf_Search_refresh"); $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); } @@ -156,8 +156,7 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { /** * @param array $openedPanes */ - function _checkOpenedPanes($openedPanes = array( - )) { + function _checkOpenedPanes($openedPanes = array()) { if (!$this->isTextPresent('None found.')) { $this->click('css=div.crm-advanced_search_form-accordion div.crm-accordion-header'); } @@ -179,8 +178,7 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase { * @param $paneRef * @param array $selectFields */ - function _selectPaneFields($paneRef, $selectFields = array( - )) { + function _selectPaneFields($paneRef, $selectFields = array()) { $pane = $this->_advanceSearchPanesDateFilter($paneRef); $this->click("css=div.crm-accordion-wrapper {$pane['headerLocator']}"); diff --git a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php index 02da19d9e3..42ac2ce6ce 100644 --- a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php +++ b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php @@ -122,7 +122,7 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase { $this->select("task", "label=Add Contacts to Group"); $this->waitForPageToLoad($this->getTimeoutMsec()); - // Select the new group and click to add + // Select the new group and click to add $this->click("group_id"); $this->select("group_id", "label=" . $newGroupName); $this->click("_qf_AddToGroup_next-bottom"); diff --git a/tests/phpunit/WebTest/Contact/UpdateProfileTest.php b/tests/phpunit/WebTest/Contact/UpdateProfileTest.php index 7aed12092f..5b682729ed 100644 --- a/tests/phpunit/WebTest/Contact/UpdateProfileTest.php +++ b/tests/phpunit/WebTest/Contact/UpdateProfileTest.php @@ -37,7 +37,7 @@ class WebTest_Contact_UpdateProfileTest extends CiviSeleniumTestCase { public function testUpdateProfile() { // Create new via profile - include_once ('WebTest/Contact/AddViaProfileTest.php'); + include_once 'WebTest/Contact/AddViaProfileTest.php'; WebTest_Contact_AddViaProfileTest::testAddViaCreateProfile(); // Open profile for editing diff --git a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php index 46069009df..738245953b 100644 --- a/tests/phpunit/WebTest/Contribute/AddBatchesTest.php +++ b/tests/phpunit/WebTest/Contribute/AddBatchesTest.php @@ -211,7 +211,7 @@ class WebTest_Contribute_AddBatchesTest extends CiviSeleniumTestCase { $this->click("css=span#{$row}.pledge-adjust-option a"); $this->type("field_{$row}_total_amount", $data['amount']); } - } + } elseif ($type == "Contribution") { $this->select("field_{$row}_financial_type", $data['financial_type']); $this->type("field_{$row}_total_amount", $data['amount']); diff --git a/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php b/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php index 0b83135ac4..e6e04636cb 100644 --- a/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContactContextAddTest.php @@ -76,7 +76,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { $isDefault ); - $this->webtestAddContact($firstName, "Anderson", true); + $this->webtestAddContact($firstName, "Anderson", TRUE); // Get the contact id of the new contact $contactUrl = $this->parseURL(); @@ -128,7 +128,6 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase { $this->type("invoice_id", time()); $this->webtestFillDate('thankyou_date'); - //Premium section $this->click("Premium"); $this->waitForElementPresent("fulfilled_date"); diff --git a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php index 570e1779a5..e4bec6a247 100644 --- a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php @@ -225,7 +225,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->type('first_name', $firstName); $this->type('last_name', $lastName); - $this->select('state_province-1',"value=1002"); + $this->select('state_province-1', "value=1002"); $this->clickLink('_qf_Main_upload-bottom', '_qf_Confirm_next-bottom'); $this->click('_qf_Confirm_next-bottom'); @@ -238,7 +238,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->openCiviPage("contribute/search", "reset=1", 'contribution_date_low'); $this->type('sort_name', "$lastName $firstName"); - $this->select('financial_type_id',"label=Member Dues"); + $this->select('financial_type_id', "label=Member Dues"); $this->clickLink('_qf_Search_refresh', "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom', FALSE); $expected = array( @@ -256,7 +256,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $this->click("xpath=id('Search')/div[2]/div/div[1]"); $this->waitForElementPresent("financial_type_id"); $this->type("sort_name", $firstName); - $this->select('financial_type_id',"label=Donation"); + $this->select('financial_type_id', "label=Donation"); $this->clickLink('_qf_Search_refresh', "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", '_qf_ContributionView_cancel-bottom', FALSE); diff --git a/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php b/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php index 68354ecd6a..14be822256 100644 --- a/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php @@ -137,8 +137,6 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { $this->type("invoice_id", time()); $this->webtestFillDate('thankyou_date'); - - //Premium section $this->click("Premium"); $this->waitForElementPresent("fulfilled_date"); diff --git a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php index 6040db78e4..e66f3207cf 100644 --- a/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php +++ b/tests/phpunit/WebTest/Contribute/OnBehalfOfOrganization.php @@ -537,7 +537,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, - null, + NULL, $amountSection, $payLater, $onBehalf, @@ -557,7 +557,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $honoreeSection ); - $this->_testOrganization($pageId, $cid, $pageTitle); + $this->_testOrganization($pageId, $cid, $pageTitle); } public function testWithContactSubtypeDupe() { @@ -598,7 +598,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, - null, + NULL, $amountSection, $payLater, $onBehalf, @@ -618,7 +618,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $honoreeSection ); - //Open Live Contribution Page + //Open Live Contribution Page $this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom"); $this->waitForElementPresent("onbehalf_state_province-3"); @@ -1368,7 +1368,7 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { $this->click("xpath=//div[@id='current-relationships']/div/table/tbody//tr/td[2]/a[text()='{$orgName1}']/../../td[9]/span[2][text()='more ']/ul/li[2]/a[text()='Delete']"); // Check confirmation alert. - $this->assertTrue((bool)preg_match("/^Are you sure you want to delete this relationship?/", + $this->assertTrue((bool) preg_match("/^Are you sure you want to delete this relationship?/", $this->getConfirmation() )); $this->chooseOkOnNextConfirmation(); @@ -1508,8 +1508,8 @@ class WebTest_Contribute_OnBehalfOfOrganization extends CiviSeleniumTestCase { or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 0, 0, 0); $text_color = imagecolorallocate($im, 233, 14, 91); - imagestring($im, 1, 5, 5, "On Behalf-Org Logo", $text_color); - imagepng($im,"/tmp/file.png"); + imagestring($im, 1, 5, 5, "On Behalf-Org Logo", $text_color); + imagepng($im, "/tmp/file.png"); $imagePath = "/tmp/file.png"; $this->webtestAttachFile('onbehalf_image_URL', $imagePath); diff --git a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php index 27c4f586cc..093d9e6675 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php @@ -146,7 +146,7 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { $this->type("sort_name", "$lastName $firstName"); $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); - $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom",FALSE); + $this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); //View Contribution Record and verify data $expected = array( @@ -176,7 +176,7 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { // Is contact present? $this->assertTrue($this->isTextPresent("$honorDisplayName"), "Honoree contact not found."); - } + } public function testOnlineContributionWithZeroAmount () { $this->webtestLogin(); @@ -293,13 +293,12 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { $this->clickLink("_qf_Confirm_next-bottom", NULL); - //login to check contribution // Log in using webtestLogin() method $this->webtestLogin(); - //Find Contribution + //Find Contribution $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); $this->type("sort_name", "$lastName $firstName"); diff --git a/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php b/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php index 529cef24ad..cc91535ff7 100644 --- a/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Contribute/StandaloneAddTest.php @@ -115,7 +115,6 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase { $this->type("invoice_id", time()); $this->webtestFillDate('thankyou_date'); - //Premium section $this->click("Premium"); $this->waitForElementPresent("fulfilled_date"); @@ -126,7 +125,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase { // Clicking save. $this->click("_qf_Contribution_upload"); // Ask for confirmation to send a receipt to the contributor on 'is_email_reciept' check - $this->assertTrue((bool)preg_match("/^Click OK to save this contribution record AND send a receipt to the contributor now./",$this->getConfirmation())); + $this->assertTrue((bool) preg_match("/^Click OK to save this contribution record AND send a receipt to the contributor now./", $this->getConfirmation())); $this->chooseOkOnNextConfirmation(); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php index f59904a5ad..6ce7c1b187 100755 --- a/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdateContributionTest.php @@ -32,338 +32,338 @@ require_once 'CiviTest/CiviSeleniumTestCase.php'; */ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { - protected function setUp() { + protected function setUp() { parent::setUp(); } - public function testChangeContributionAmount() { - $this->webtestLogin(); - $amount = 100; - //Offline Pay Later Contribution - $contact = $this->_testOfflineContribution($amount, "Pending"); - - $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); - - $this->type("sort_name", $contact['sort_name']); - $this->click("_qf_Search_refresh"); - - $this->waitForElementPresent("xpath=//*[@id='Search']//div[@id='contributionSearch']"); - $contriIDOff = explode('&', $this->getAttribute("xpath=//div[@id='contributionSearch']//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[1]@href")); - if (!empty($contriIDOff)) { - $contriIDOff = substr($contriIDOff[1], (strrpos($contriIDOff[1], '=') + 1)); - } - - $this->clickLink("xpath=//tr[@id='rowid{$contriIDOff}']/td[11]/span/a[2]", "total_amount", FALSE); - $this->type("total_amount", "90"); - $this->clickLink('_qf_Contribution_upload','',FALSE); - - // Is status message correct? - $this->waitForText('crm-notification-container', "The contribution record has been saved."); - - //For Contribution - $searchParams = array('id' => $contriIDOff); - $compareParams = array('total_amount' => '90.00'); - //For LineItem - $lineItemSearchParams = array('entity_id' => $contriIDOff); - $lineItemCompareParams = array('line_total' => '90.00'); - - $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compareParams); - $this->assertDBCompareValues('CRM_Price_DAO_LineItem', $lineItemSearchParams, $lineItemCompareParams); - - $total = $this->_getTotalContributedAmount($contriIDOff); - $compare = array('total_amount' => $total); - $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare); - - $amount = $this->_getFinancialItemAmount($contriIDOff); - $compare = array('total_amount' => $amount); - $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare); - - $financialTrxnAmount = $this->_getFinancialTrxnAmount($contriIDOff); - $compare = array('total_amount' => $financialTrxnAmount); - $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare); - } - - public function testPayLater() { - $this->webtestLogin(); - $amount = 100.00; - //Offline Pay Later Contribution - $this->_testOfflineContribution($amount, "Pending"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']"); - $contId = $this->urlArg('id', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); - $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom'); - $this->select("contribution_status_id", "label=Completed"); - $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']"); - $this->checkCRMAlert("The contribution record has been saved."); - - //Assertions - $search = array('id' => $contId); - $compare = array('contribution_status_id' => 1); - $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare); - - $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); - $search = array( 'entity_id' => $lineItem ); - $compare = array( 'status_id' => 1 ); - $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare); - - $status = $this->_getPremiumActualCost($contId, 'Accounts Receivable', 'Payment Processor Account', NULL, "'civicrm_contribution'", "ft.status_id as status"); - $this->assertEquals($status, '1', "Verify Completed Status"); - } - - public function testChangePremium() { - $this->webtestLogin(); - $from = 'Premiums'; - $to = 'Premiums inventory'; - $financialType = array( + public function testChangeContributionAmount() { + $this->webtestLogin(); + $amount = 100; + //Offline Pay Later Contribution + $contact = $this->_testOfflineContribution($amount, "Pending"); + + $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); + + $this->type("sort_name", $contact['sort_name']); + $this->click("_qf_Search_refresh"); + + $this->waitForElementPresent("xpath=//*[@id='Search']//div[@id='contributionSearch']"); + $contriIDOff = explode('&', $this->getAttribute("xpath=//div[@id='contributionSearch']//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[1]@href")); + if (!empty($contriIDOff)) { + $contriIDOff = substr($contriIDOff[1], (strrpos($contriIDOff[1], '=') + 1)); + } + + $this->clickLink("xpath=//tr[@id='rowid{$contriIDOff}']/td[11]/span/a[2]", "total_amount", FALSE); + $this->type("total_amount", "90"); + $this->clickLink('_qf_Contribution_upload', '', FALSE); + + // Is status message correct? + $this->waitForText('crm-notification-container', "The contribution record has been saved."); + + //For Contribution + $searchParams = array('id' => $contriIDOff); + $compareParams = array('total_amount' => '90.00'); + //For LineItem + $lineItemSearchParams = array('entity_id' => $contriIDOff); + $lineItemCompareParams = array('line_total' => '90.00'); + + $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compareParams); + $this->assertDBCompareValues('CRM_Price_DAO_LineItem', $lineItemSearchParams, $lineItemCompareParams); + + $total = $this->_getTotalContributedAmount($contriIDOff); + $compare = array('total_amount' => $total); + $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare); + + $amount = $this->_getFinancialItemAmount($contriIDOff); + $compare = array('total_amount' => $amount); + $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare); + + $financialTrxnAmount = $this->_getFinancialTrxnAmount($contriIDOff); + $compare = array('total_amount' => $financialTrxnAmount); + $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare); + } + + public function testPayLater() { + $this->webtestLogin(); + $amount = 100.00; + //Offline Pay Later Contribution + $this->_testOfflineContribution($amount, "Pending"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']"); + $contId = $this->urlArg('id', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); + $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom'); + $this->select("contribution_status_id", "label=Completed"); + $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']"); + $this->checkCRMAlert("The contribution record has been saved."); + + //Assertions + $search = array('id' => $contId); + $compare = array('contribution_status_id' => 1); + $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare); + + $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); + $search = array( 'entity_id' => $lineItem ); + $compare = array( 'status_id' => 1 ); + $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare); + + $status = $this->_getPremiumActualCost($contId, 'Accounts Receivable', 'Payment Processor Account', NULL, "'civicrm_contribution'", "ft.status_id as status"); + $this->assertEquals($status, '1', "Verify Completed Status"); + } + + public function testChangePremium() { + $this->webtestLogin(); + $from = 'Premiums'; + $to = 'Premiums inventory'; + $financialType = array( 'name' => 'Test Financial'.substr(sha1(rand()), 0, 7), 'is_reserved' => 1, 'is_deductible' => 1, - ); - $this->addeditFinancialType($financialType); - $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']"); - $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']"); - $this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']"); - $this->clickAjaxLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom"); - $this->select("account_relationship", "label=Premiums Inventory Account is"); - $this->waitForElementPresent("xpath=//select[@id='financial_account_id']/option[3][text()='Deposit Bank Account']"); - $this->select("financial_account_id", "label=$to"); - $this->clickAjaxLink("_qf_FinancialTypeAccount_next-botttom", "xpath=//a[@id='newfinancialTypeAccount']"); - - $premiumName = 'Premium'.substr(sha1(rand()), 0, 7); - $amount = 500; - $sku = 'SKU'; - $price = 300; - $cost = 3.00; - $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1"); - // add premium - $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']); - - //add second premium - $premiumName2 = 'Premium'.substr(sha1(rand()), 0, 7); - $amount2 = 600; - $sku2 = 'SKU'; - $price2 = 200; - $cost2 = 2.00; - $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1"); - $this->addPremium($premiumName2, $sku2, $amount2, $price2, $cost2, $financialType['name']); - - // add contribution with premium - $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone"); - - // create new contact using dialog - $this->createDialogContact(); - // select financial type - $this->select( "financial_type_id", "value=1" ); - // total amount - $this->type("total_amount", "100"); - // fill Premium information - $this->clickAjaxLink("xpath=//div[@id='Premium']", "product_name_0"); - $this->select('product_name_0', "label=$premiumName ( $sku )"); - // Clicking save. - $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']"); - // Is status message correct? - $this->checkCRMAlert("The contribution record has been saved."); - // verify if Contribution is created - //click through to the Contribution edit screen - $contId = $this->urlArg('id', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); - $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "product_name_0"); - - $this->select('product_name_0', "label=$premiumName2 ( $sku2 )"); - // Clicking save. - $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[7][text()='$premiumName2']"); - $this->checkCRMAlert("The contribution record has been saved."); - - //Assertions - $actualAmount = $this->_getPremiumActualCost($contId, $to, $from, $cost2, "'civicrm_contribution'"); - $this->assertEquals($actualAmount, $cost2, "Verify actual cost for changed premium"); - - $deletedAmount = $this->_getPremiumActualCost($contId, $from, $to, $cost, "'civicrm_contribution'"); - $this->assertEquals($deletedAmount, $cost, "Verify actual cost for deleted premium"); - } - - public function testDeletePremium() { - $this->webtestLogin(); - $from = 'Premiums'; - $to = 'Premiums inventory'; - $financialType = array( + ); + $this->addeditFinancialType($financialType); + $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']"); + $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']"); + $this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']"); + $this->clickAjaxLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom"); + $this->select("account_relationship", "label=Premiums Inventory Account is"); + $this->waitForElementPresent("xpath=//select[@id='financial_account_id']/option[3][text()='Deposit Bank Account']"); + $this->select("financial_account_id", "label=$to"); + $this->clickAjaxLink("_qf_FinancialTypeAccount_next-botttom", "xpath=//a[@id='newfinancialTypeAccount']"); + + $premiumName = 'Premium'.substr(sha1(rand()), 0, 7); + $amount = 500; + $sku = 'SKU'; + $price = 300; + $cost = 3.00; + $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1"); + // add premium + $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']); + + //add second premium + $premiumName2 = 'Premium'.substr(sha1(rand()), 0, 7); + $amount2 = 600; + $sku2 = 'SKU'; + $price2 = 200; + $cost2 = 2.00; + $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1"); + $this->addPremium($premiumName2, $sku2, $amount2, $price2, $cost2, $financialType['name']); + + // add contribution with premium + $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone"); + + // create new contact using dialog + $this->createDialogContact(); + // select financial type + $this->select( "financial_type_id", "value=1" ); + // total amount + $this->type("total_amount", "100"); + // fill Premium information + $this->clickAjaxLink("xpath=//div[@id='Premium']", "product_name_0"); + $this->select('product_name_0', "label=$premiumName ( $sku )"); + // Clicking save. + $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']"); + // Is status message correct? + $this->checkCRMAlert("The contribution record has been saved."); + // verify if Contribution is created + //click through to the Contribution edit screen + $contId = $this->urlArg('id', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); + $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "product_name_0"); + + $this->select('product_name_0', "label=$premiumName2 ( $sku2 )"); + // Clicking save. + $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[7][text()='$premiumName2']"); + $this->checkCRMAlert("The contribution record has been saved."); + + //Assertions + $actualAmount = $this->_getPremiumActualCost($contId, $to, $from, $cost2, "'civicrm_contribution'"); + $this->assertEquals($actualAmount, $cost2, "Verify actual cost for changed premium"); + + $deletedAmount = $this->_getPremiumActualCost($contId, $from, $to, $cost, "'civicrm_contribution'"); + $this->assertEquals($deletedAmount, $cost, "Verify actual cost for deleted premium"); + } + + public function testDeletePremium() { + $this->webtestLogin(); + $from = 'Premiums'; + $to = 'Premiums inventory'; + $financialType = array( 'name' => 'Test Financial' . substr(sha1(rand()), 0, 7), 'is_reserved' => 1, 'is_deductible' => 1, - ); - $this->addeditFinancialType($financialType); - $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']"); - $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']"); - $this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']"); - $this->clickLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom", FALSE); - - $this->select("account_relationship", "label=Premiums Inventory Account is"); - $this->waitForElementPresent("xpath=//select[@id='financial_account_id']/option[3][text()='Deposit Bank Account']"); - $this->select("financial_account_id", "label=$to"); - $this->clickLink("_qf_FinancialTypeAccount_next-botttom", "xpath=//a[@id='newfinancialTypeAccount']", FALSE); - $premiumName = 'Premium' . substr(sha1(rand()), 0, 7); - $amount = 500; - $sku = 'SKU'; - $price = 300; - $cost = 3.00; - $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1"); - // add premium - $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']); - - // add contribution with premium - $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone"); - - // create new contact using dialog - $this->createDialogContact(); - // select financial type - $this->select("financial_type_id", "value=1"); - // total amount - $this->type("total_amount", "100"); - // fill Premium information - $this->click("xpath=//div[@id='Premium']"); - $this->waitForElementPresent("product_name_0"); - $this->select('product_name_0', "label=$premiumName ( $sku )"); - // Clicking save. - $this->clickLink("_qf_Contribution_upload"); - // Is status message correct? - $this->waitForText('crm-notification-container', "The contribution record has been saved."); - // verify if Contribution is created - $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']"); - //click through to the Contribution edit screen - $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); - $contId = explode('&', $contId[1]); - $contId = $contId[0]; - $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "_qf_Contribution_upload-bottom", FALSE); - $this->waitForElementPresent("product_name_0"); - $this->select('product_name_0', "value=0"); - // Clicking save. - $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[7][not(text())]", FALSE); - - //Assertions - $actualAmount = $this->_getPremiumActualCost($contId, $from, $to, NULL, "'civicrm_contribution'"); - $this->assertEquals($actualAmount, $cost, "Verify actual cost for deleted premium"); - } - - public function testChangePaymentInstrument() { - $this->webtestLogin(); - $label = 'TEST'.substr(sha1(rand()), 0, 7); - $amount = 100.00; - $financialAccount = CRM_Contribute_PseudoConstant::financialAccount(); - $to = array_search('Accounts Receivable', $financialAccount); - $from = array_search('Deposit Bank Account', $financialAccount); - $this->addPaymentInstrument($label, $to); - $this->_testOfflineContribution($amount); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']"); - $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE); - $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); - $contId = explode('&', $contId[1]); - $contId = $contId[0]; - //change payment processor to newly created value - $this->select("payment_instrument_id", "label=$label"); - $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE); - $this->waitForAjaxContent(); - //Assertions - $subtractedTotal = $this->_getPremiumActualCost($contId, NULL, 'Payment Processor Account'); - $this->assertEquals($subtractedTotal, -$amount, "Verify amount deleted from old account"); - $totalAmount = $this->_getPremiumActualCost($contId, NULL, 'Accounts Receivable'); - $this->assertEquals($totalAmount, $amount, "Verify amount for newly inserted values"); - } - - public function testRefundContribution() { - $this->webtestLogin(); - $amount = 100.00; - $this->_testOfflineContribution($amount); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']"); - $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom'); - //Contribution status - $this->select("contribution_status_id", "label=Refunded"); - $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); - $contId = explode('&', $contId[1]); - $contId = $contId[0]; - $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[6][text()='Refunded']"); - - //Assertions - $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); - $search = array('entity_id' => $lineItem); - $compare = array( + ); + $this->addeditFinancialType($financialType); + $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']"); + $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']"); + $this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']"); + $this->clickLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom", FALSE); + + $this->select("account_relationship", "label=Premiums Inventory Account is"); + $this->waitForElementPresent("xpath=//select[@id='financial_account_id']/option[3][text()='Deposit Bank Account']"); + $this->select("financial_account_id", "label=$to"); + $this->clickLink("_qf_FinancialTypeAccount_next-botttom", "xpath=//a[@id='newfinancialTypeAccount']", FALSE); + $premiumName = 'Premium' . substr(sha1(rand()), 0, 7); + $amount = 500; + $sku = 'SKU'; + $price = 300; + $cost = 3.00; + $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1"); + // add premium + $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']); + + // add contribution with premium + $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone"); + + // create new contact using dialog + $this->createDialogContact(); + // select financial type + $this->select("financial_type_id", "value=1"); + // total amount + $this->type("total_amount", "100"); + // fill Premium information + $this->click("xpath=//div[@id='Premium']"); + $this->waitForElementPresent("product_name_0"); + $this->select('product_name_0', "label=$premiumName ( $sku )"); + // Clicking save. + $this->clickLink("_qf_Contribution_upload"); + // Is status message correct? + $this->waitForText('crm-notification-container', "The contribution record has been saved."); + // verify if Contribution is created + $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']"); + //click through to the Contribution edit screen + $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); + $contId = explode('&', $contId[1]); + $contId = $contId[0]; + $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "_qf_Contribution_upload-bottom", FALSE); + $this->waitForElementPresent("product_name_0"); + $this->select('product_name_0', "value=0"); + // Clicking save. + $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[7][not(text())]", FALSE); + + //Assertions + $actualAmount = $this->_getPremiumActualCost($contId, $from, $to, NULL, "'civicrm_contribution'"); + $this->assertEquals($actualAmount, $cost, "Verify actual cost for deleted premium"); + } + + public function testChangePaymentInstrument() { + $this->webtestLogin(); + $label = 'TEST'.substr(sha1(rand()), 0, 7); + $amount = 100.00; + $financialAccount = CRM_Contribute_PseudoConstant::financialAccount(); + $to = array_search('Accounts Receivable', $financialAccount); + $from = array_search('Deposit Bank Account', $financialAccount); + $this->addPaymentInstrument($label, $to); + $this->_testOfflineContribution($amount); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']"); + $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE); + $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); + $contId = explode('&', $contId[1]); + $contId = $contId[0]; + //change payment processor to newly created value + $this->select("payment_instrument_id", "label=$label"); + $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE); + $this->waitForAjaxContent(); + //Assertions + $subtractedTotal = $this->_getPremiumActualCost($contId, NULL, 'Payment Processor Account'); + $this->assertEquals($subtractedTotal, -$amount, "Verify amount deleted from old account"); + $totalAmount = $this->_getPremiumActualCost($contId, NULL, 'Accounts Receivable'); + $this->assertEquals($totalAmount, $amount, "Verify amount for newly inserted values"); + } + + public function testRefundContribution() { + $this->webtestLogin(); + $amount = 100.00; + $this->_testOfflineContribution($amount); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']"); + $this->clickAjaxLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom'); + //Contribution status + $this->select("contribution_status_id", "label=Refunded"); + $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); + $contId = explode('&', $contId[1]); + $contId = $contId[0]; + $this->clickAjaxLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[6][text()='Refunded']"); + + //Assertions + $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); + $search = array('entity_id' => $lineItem); + $compare = array( 'amount' => '100.00', 'status_id' => 1, - ); - $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare); - $amount = $this->_getPremiumActualCost($contId, NULL, 'Payment Processor Account', -100.00, "'civicrm_contribution'"); - $this->assertEquals($amount, '-100.00', 'Verify Financial Trxn Amount.'); - } - - public function testCancelPayLater() { - $this->webtestLogin(); - $amount = 100.00; - $this->_testOfflineContribution($amount, "Pending"); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']"); - $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE); - //Contribution status - $this->select("contribution_status_id", "label=Cancelled"); - $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); - $contId = explode('&', $contId[1]); - $contId = $contId[0]; - $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE); - $this->waitForText('crm-notification-container', "The contribution record has been saved."); - - //Assertions - $search = array('id' => $contId); - $compare = array('contribution_status_id' => 3); - $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare); - $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); - $itemParams = array( + ); + $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare); + $amount = $this->_getPremiumActualCost($contId, NULL, 'Payment Processor Account', -100.00, "'civicrm_contribution'"); + $this->assertEquals($amount, '-100.00', 'Verify Financial Trxn Amount.'); + } + + public function testCancelPayLater() { + $this->webtestLogin(); + $amount = 100.00; + $this->_testOfflineContribution($amount, "Pending"); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']"); + $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE); + //Contribution status + $this->select("contribution_status_id", "label=Cancelled"); + $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); + $contId = explode('&', $contId[1]); + $contId = $contId[0]; + $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE); + $this->waitForText('crm-notification-container', "The contribution record has been saved."); + + //Assertions + $search = array('id' => $contId); + $compare = array('contribution_status_id' => 3); + $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare); + $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); + $itemParams = array( 'amount' => '-100.00', 'entity_id' => $lineItem, - ); - $defaults = array(); - $items = CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $defaults); - $this->assertEquals($items->amount, $itemParams['amount'], 'Verify Amount for financial Item'); - $totalAmount = $this->_getPremiumActualCost($items->id, 'Accounts Receivable', NULL, "-100.00", "'civicrm_financial_item'"); - $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn'); - $totalAmount = $this->_getPremiumActualCost($contId, 'Accounts Receivable', NULL, "-100.00", "'civicrm_contribution'"); - $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn'); - } - - public function testChangeFinancialType() { - $this->webtestLogin(); - $amount = 100.00; - $this->_testOfflineContribution($amount); - $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']"); - $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE); - //Contribution status - $this->select("financial_type_id", "value=3"); - $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); - $contId = explode('&', $contId[1]); - $contId = $contId[0]; - $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE); - $this->waitForText('crm-notification-container', "The contribution record has been saved."); - - //Assertions - $search = array( 'id' => $contId ); - $compare = array( 'financial_type_id' => 3 ); - $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare); - - $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); - $itemParams = array( + ); + $defaults = array(); + $items = CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $defaults); + $this->assertEquals($items->amount, $itemParams['amount'], 'Verify Amount for financial Item'); + $totalAmount = $this->_getPremiumActualCost($items->id, 'Accounts Receivable', NULL, "-100.00", "'civicrm_financial_item'"); + $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn'); + $totalAmount = $this->_getPremiumActualCost($contId, 'Accounts Receivable', NULL, "-100.00", "'civicrm_contribution'"); + $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn'); + } + + public function testChangeFinancialType() { + $this->webtestLogin(); + $amount = 100.00; + $this->_testOfflineContribution($amount); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']"); + $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE); + //Contribution status + $this->select("financial_type_id", "value=3"); + $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href")); + $contId = explode('&', $contId[1]); + $contId = $contId[0]; + $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE); + $this->waitForText('crm-notification-container', "The contribution record has been saved."); + + //Assertions + $search = array( 'id' => $contId ); + $compare = array( 'financial_type_id' => 3 ); + $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare); + + $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); + $itemParams = array( 'amount' => '-100.00', 'entity_id' => $lineItem, - ); - $item1 = $item2 = array(); - CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $item1); - $this->assertEquals($item1['amount'], "-100.00", "Verify Amount for New Financial Item"); - $itemParams['amount'] = '100.00'; - CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $item2); - $this->assertEquals($item2['amount'], "100.00", "Verify Amount for New Financial Item"); - - $cValue1 = $this->_getPremiumActualCost($contId, NULL, NULL, "-100.00", "'civicrm_contribution'"); - $fValue1 = $this->_getPremiumActualCost($item1['id'], NULL, NULL, "-100.00", "'civicrm_financial_item'"); - $this->assertEquals($cValue1, "-100.00", "Verify Amount"); - $this->assertEquals($fValue1, "-100.00", "Verify Amount"); - $cValue2 = $this->_getPremiumActualCost($contId, NULL, NULL, "100.00", "'civicrm_contribution'"); - $fValue2 = $this->_getPremiumActualCost($item2['id'], NULL, NULL, "100.00", "'civicrm_financial_item'"); - $this->assertEquals($cValue2, "100.00", "Verify Amount"); - $this->assertEquals($fValue2, "100.00", "Verify Amount"); - } + ); + $item1 = $item2 = array(); + CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $item1); + $this->assertEquals($item1['amount'], "-100.00", "Verify Amount for New Financial Item"); + $itemParams['amount'] = '100.00'; + CRM_Financial_BAO_FinancialItem::retrieve($itemParams, $item2); + $this->assertEquals($item2['amount'], "100.00", "Verify Amount for New Financial Item"); + + $cValue1 = $this->_getPremiumActualCost($contId, NULL, NULL, "-100.00", "'civicrm_contribution'"); + $fValue1 = $this->_getPremiumActualCost($item1['id'], NULL, NULL, "-100.00", "'civicrm_financial_item'"); + $this->assertEquals($cValue1, "-100.00", "Verify Amount"); + $this->assertEquals($fValue1, "-100.00", "Verify Amount"); + $cValue2 = $this->_getPremiumActualCost($contId, NULL, NULL, "100.00", "'civicrm_contribution'"); + $fValue2 = $this->_getPremiumActualCost($item2['id'], NULL, NULL, "100.00", "'civicrm_financial_item'"); + $this->assertEquals($cValue2, "100.00", "Verify Amount"); + $this->assertEquals($fValue2, "100.00", "Verify Amount"); + } /** * @param int $entityId @@ -376,29 +376,29 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { * @return null|string */ function _getPremiumActualCost($entityId, $from = NULL, $to = NULL, $cost = NULL, $entityTable = NULL, $select = "ft.total_amount AS amount") { - $financialAccount = CRM_Contribute_PseudoConstant::financialAccount(); - $query = "SELECT + $financialAccount = CRM_Contribute_PseudoConstant::financialAccount(); + $query = "SELECT {$select} FROM civicrm_financial_trxn ft INNER JOIN civicrm_entity_financial_trxn eft ON eft.financial_trxn_id = ft.id AND eft.entity_id = {$entityId}"; - if ($entityTable) { - $query .= " AND eft.entity_table = {$entityTable}"; - } - if (!empty($to)) { - $to = array_search($to, $financialAccount); - $query .= " AND ft.to_financial_account_id = {$to}"; - } - if (!empty($from)) { - $from = array_search($from, $financialAccount); - $query .= " AND ft.from_financial_account_id = {$from}"; - } - if (!empty($cost)) { - $query .= " AND eft.amount = {$cost}"; - } - $query .= " ORDER BY ft.id DESC LIMIT 1"; - $result = CRM_Core_DAO::singleValueQuery($query); - return $result; - } + if ($entityTable) { + $query .= " AND eft.entity_table = {$entityTable}"; + } + if (!empty($to)) { + $to = array_search($to, $financialAccount); + $query .= " AND ft.to_financial_account_id = {$to}"; + } + if (!empty($from)) { + $from = array_search($from, $financialAccount); + $query .= " AND ft.from_financial_account_id = {$from}"; + } + if (!empty($cost)) { + $query .= " AND eft.amount = {$cost}"; + } + $query .= " ORDER BY ft.id DESC LIMIT 1"; + $result = CRM_Core_DAO::singleValueQuery($query); + return $result; + } /** * @param int $contId @@ -406,15 +406,15 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { * @return null|string */ function _getFinancialTrxnAmount($contId) { - $query = "SELECT + $query = "SELECT SUM( ft.total_amount ) AS total FROM civicrm_financial_trxn AS ft LEFT JOIN civicrm_entity_financial_trxn AS ceft ON ft.id = ceft.financial_trxn_id WHERE ceft.entity_table = 'civicrm_contribution' AND ceft.entity_id = {$contId}"; - $result = CRM_Core_DAO::singleValueQuery($query); - return $result; - } + $result = CRM_Core_DAO::singleValueQuery($query); + return $result; + } /** * @param int $contId @@ -422,15 +422,15 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { * @return null|string */ function _getFinancialItemAmount($contId) { - $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); - $query = "SELECT + $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); + $query = "SELECT SUM(amount) FROM civicrm_financial_item WHERE entity_table = 'civicrm_line_item' AND entity_id = {$lineItem}"; - $result = CRM_Core_DAO::singleValueQuery($query); - return $result; - } + $result = CRM_Core_DAO::singleValueQuery($query); + return $result; + } /** * @param int $contId @@ -438,66 +438,64 @@ class WebTest_Contribute_UpdateContributionTest extends CiviSeleniumTestCase { * @return null|string */ function _getTotalContributedAmount($contId) { - $query = "SELECT + $query = "SELECT SUM(amount) FROM civicrm_entity_financial_trxn WHERE entity_table = 'civicrm_contribution' AND entity_id = {$contId}"; - $result = CRM_Core_DAO::singleValueQuery($query); - return $result; - } + $result = CRM_Core_DAO::singleValueQuery($query); + return $result; + } /** * @param $amount * @param string $status * @return array */ - public function _testOfflineContribution($amount, $status="Completed") { - - $this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload"); + public function _testOfflineContribution($amount, $status = "Completed") { - // create new contact using dialog - $contact = $this->createDialogContact(); + $this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload"); - // select financial type - $this->select( "financial_type_id", "value=1" ); + // create new contact using dialog + $contact = $this->createDialogContact(); - //Contribution status - $this->select("contribution_status_id", "label=$status"); + // select financial type + $this->select( "financial_type_id", "value=1" ); - // total amount - $this->type("total_amount", $amount); + //Contribution status + $this->select("contribution_status_id", "label=$status"); - // select payment instrument type - $this->select("payment_instrument_id", "label=Credit Card"); + // total amount + $this->type("total_amount", $amount); + // select payment instrument type + $this->select("payment_instrument_id", "label=Credit Card"); - $this->type("trxn_id", "P20901X1" . rand(100, 10000)); + $this->type("trxn_id", "P20901X1" . rand(100, 10000)); + //Custom Data + //$this->click('CIVICRM_QFID_3_6'); - //Custom Data - //$this->click('CIVICRM_QFID_3_6'); + // Clicking save. + $this->clickLink("_qf_Contribution_upload"); - // Clicking save. - $this->clickLink("_qf_Contribution_upload"); + // Is status message correct? + $this->checkCRMAlert("The contribution record has been saved."); - // Is status message correct? - $this->checkCRMAlert("The contribution record has been saved."); + $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']"); + // verify if Membership is created - $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']"); - // verify if Membership is created + //click through to the Membership view screen + $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']"); - //click through to the Membership view screen - $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']"); - - $expected = array( + $expected = array( 'Financial Type' => 'Donation', 'Total Amount' => '100.00', 'Contribution Status' => $status, - ); - $this->webtestVerifyTabularData($expected); - $this->click("_qf_ContributionView_cancel-bottom"); + ); + $this->webtestVerifyTabularData($expected); + $this->click("_qf_ContributionView_cancel-bottom"); return $contact; - } + } } diff --git a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php index a79ee310d4..2d529a7da9 100644 --- a/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php @@ -126,7 +126,6 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC $this->type("invoice_id", time()); $this->webtestFillDate('thankyou_date'); - //Premium section $this->click("Premium"); $this->waitForElementPresent("fulfilled_date"); diff --git a/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php b/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php index 9cce6b5939..9b20ebaac5 100644 --- a/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/VerifySSLContributionTest.php @@ -52,7 +52,7 @@ class WebTest_Contribute_VerifySSLContributionTest extends CiviSeleniumTestCase public function _initialize() { if (!$this->initialized) { // log in - $this->webtestLogin(); + $this->webtestLogin(); // build names $hash = substr(sha1(rand()), 0, 7); diff --git a/tests/phpunit/WebTest/Event/AddEventTest.php b/tests/phpunit/WebTest/Event/AddEventTest.php index 6569342dc1..d008af01d9 100644 --- a/tests/phpunit/WebTest/Event/AddEventTest.php +++ b/tests/phpunit/WebTest/Event/AddEventTest.php @@ -915,11 +915,11 @@ WHERE ceft.entity_id = %1 AND ceft.entity_table = 'civicrm_contribution'"; $this->click('CIVICRM_QFID_1_is_monetary'); $processorName = 'Test Processor'; $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']"); - $this->select('financial_type_id','label=Event Fee'); - $this->type("label[1]",'Junior Stars'); - $this->type("value[1]",'500.00'); - $this->type("label[2]",'Super Stars'); - $this->type("value[2]",'1000.00'); + $this->select('financial_type_id', 'label=Event Fee'); + $this->type("label[1]", 'Junior Stars'); + $this->type("value[1]", '500.00'); + $this->type("label[2]", 'Super Stars'); + $this->type("value[2]", '1000.00'); $this->check('default'); $this->click('_qf_Fee_upload-bottom'); $this->waitForText('crm-notification-container', "'Fees' information has been saved."); @@ -927,41 +927,41 @@ WHERE ceft.entity_id = %1 AND ceft.entity_table = 'civicrm_contribution'"; // intro text for registration page $registerIntro = 'Fill in all the fields below and click Continue.'; - // Go to Online Registration tab - $this->click('link=Online Registration'); - $this->waitForElementPresent('_qf_Registration_upload-bottom'); - $this->click('is_online_registration'); - $this->assertChecked('is_online_registration'); - - //Requires Approvel - $this->click('requires_approval'); - $this->assertChecked('requires_approval'); - $this->click('_qf_Registration_upload-bottom'); - $this->waitForText('crm-notification-container', "'Online Registration' information has been saved."); - - // verify event input on info page - // start at Manage Events listing - $this->openCiviPage('event/manage', 'reset=1'); - $this->click("link=$eventTitle"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - $firstName = substr(sha1(rand()), 0, 7); - $this->webtestAddContact($firstName, 'Anderson', TRUE); - $contactName = "Anderson, $firstName"; - $displayName = "$firstName Anderson"; - $this->openCiviPage("event/register", "reset=1&id=$id", '_qf_Register_upload-bottom'); - $this->type('first_name',$firstName); - - //fill in last name - $lastName = 'Recuron'.substr(sha1(rand()), 0, 7); - $this->type('last_name', $contactName); - $email = $firstName . '@example.com'; - $this->type('email-Primary', $email); - $this->click('_qf_Register_upload'); - $this->waitForElementPresent("_qf_Confirm_next"); - $this->click('_qf_Confirm_next'); + // Go to Online Registration tab + $this->click('link=Online Registration'); + $this->waitForElementPresent('_qf_Registration_upload-bottom'); + $this->click('is_online_registration'); + $this->assertChecked('is_online_registration'); + + //Requires Approvel + $this->click('requires_approval'); + $this->assertChecked('requires_approval'); + $this->click('_qf_Registration_upload-bottom'); + $this->waitForText('crm-notification-container', "'Online Registration' information has been saved."); + + // verify event input on info page + // start at Manage Events listing + $this->openCiviPage('event/manage', 'reset=1'); + $this->click("link=$eventTitle"); + $this->waitForPageToLoad($this->getTimeoutMsec()); + $firstName = substr(sha1(rand()), 0, 7); + $this->webtestAddContact($firstName, 'Anderson', TRUE); + $contactName = "Anderson, $firstName"; + $displayName = "$firstName Anderson"; + $this->openCiviPage("event/register", "reset=1&id=$id", '_qf_Register_upload-bottom'); + $this->type('first_name', $firstName); + + //fill in last name + $lastName = 'Recuron'.substr(sha1(rand()), 0, 7); + $this->type('last_name', $contactName); + $email = $firstName . '@example.com'; + $this->type('email-Primary', $email); + $this->click('_qf_Register_upload'); + $this->waitForElementPresent("_qf_Confirm_next"); + $this->click('_qf_Confirm_next'); $this->waitForPageToLoad($this->getTimeoutMsec()); - $this->waitForElementPresent("xpath=//div[@class='section']"); - $this->assertTextPresent("Thank You for Registering"); + $this->waitForElementPresent("xpath=//div[@class='section']"); + $this->assertTextPresent("Thank You for Registering"); } @@ -969,10 +969,10 @@ WHERE ceft.entity_id = %1 AND ceft.entity_table = 'civicrm_contribution'"; * @param $status */ public function _testEnableParticipantStatuses($status) { - // enable participant status - if ($this->isElementPresent("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Enable']")) { - $this->click("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Enable']"); - $this->waitForElementPresent("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Disable']"); - } - } + // enable participant status + if ($this->isElementPresent("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Enable']")) { + $this->click("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Enable']"); + $this->waitForElementPresent("xpath=//td[@class='crm-participant-label crm-editable crm-editable-enabled'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Disable']"); + } + } } diff --git a/tests/phpunit/WebTest/Event/AddParticipationTest.php b/tests/phpunit/WebTest/Event/AddParticipationTest.php index e96484c5c5..2d853a456e 100644 --- a/tests/phpunit/WebTest/Event/AddParticipationTest.php +++ b/tests/phpunit/WebTest/Event/AddParticipationTest.php @@ -349,16 +349,18 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { foreach($contacts as $contact) { $this->verifyText("xpath=//div[@id='participantSearch']//table//tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$contact['sort_name']}']/../../td[9]", preg_quote($status)); $this->verifyText("xpath=//div[@id='participantSearch']//table//tbody//tr/td[@class='crm-participant-sort_name']/a[text()='{$contact['sort_name']}']/../../td[4]/a", preg_quote($eventName)); -} + } } public function testAjaxCustomGroupLoad() { $this->webtestLogin(); $customSets = array( - array('entity' => 'ParticipantEventName', 'subEntity' => 'Fall Fundraiser Dinner', + array( + 'entity' => 'ParticipantEventName', + 'subEntity' => 'Fall Fundraiser Dinner', 'triggerElement' => array('name' => "event_id", 'type' => "select2")), - array('entity' => 'ParticipantRole', 'subEntity' => 'Attendee','triggerElement' => array('name' => 'role_id', 'type' => "select")) + array('entity' => 'ParticipantRole', 'subEntity' => 'Attendee', 'triggerElement' => array('name' => 'role_id', 'type' => "select")) ); $pageUrl = array('url' => "participant/add", 'args' => "reset=1&action=add&context=standalone"); $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl, TRUE); @@ -372,14 +374,20 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->webtestLogin(); $customSets = array( - array('entity' => 'ParticipantEventType', 'subEntity' => '- Any -', + array( + 'entity' => 'ParticipantEventType', + 'subEntity' => '- Any -', 'triggerElement' => array('name' => "event_id", 'type' => "select")), - array('entity' => 'ParticipantEventName', 'subEntity' => '- Any -', + array( + 'entity' => 'ParticipantEventName', + 'subEntity' => '- Any -', 'triggerElement' => array('name' => "event_id", 'type' => "select")), - array('entity' => 'ParticipantEventName', 'subEntity' => 'Rain-forest Cup Youth Soccer Tournament', + array( + 'entity' => 'ParticipantEventName', + 'subEntity' => 'Rain-forest Cup Youth Soccer Tournament', 'triggerElement' => array('name' => "event_id", 'type' => "select")), - array('entity' => 'ParticipantRole', 'subEntity' => '- Any -','triggerElement' => array('type' => "checkbox")), - array('entity' => 'ParticipantRole', 'subEntity' => 'Volunteer','triggerElement' => array('type' => "checkbox")) + array('entity' => 'ParticipantRole', 'subEntity' => '- Any -', 'triggerElement' => array('type' => "checkbox")), + array('entity' => 'ParticipantRole', 'subEntity' => 'Volunteer', 'triggerElement' => array('type' => "checkbox")) ); $return = $this->addCustomGroupField($customSets); diff --git a/tests/phpunit/WebTest/Event/AddPricesetTest.php b/tests/phpunit/WebTest/Event/AddPricesetTest.php index 9999a51931..0f822a94b7 100644 --- a/tests/phpunit/WebTest/Event/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Event/AddPricesetTest.php @@ -118,7 +118,8 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { case 'Select': $options = array( - 1 => array('label' => 'Chicken', + 1 => array( + 'label' => 'Chicken', 'amount' => '30.00', 'financial_type_id' => 'Donation' ), @@ -136,7 +137,8 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { case 'Radio': $options = array( - 1 => array('label' => 'Yes', + 1 => array( + 'label' => 'Yes', 'amount' => '50.00', 'financial_type_id' => 'Donation' @@ -156,7 +158,8 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { case 'CheckBox': $options = array( - 1 => array('label' => 'First Night', + 1 => array( + 'label' => 'First Night', 'amount' => '15.00', 'financial_type_id' => 'Donation' ), @@ -261,10 +264,9 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->waitForElementPresent('_qf_Fee_upload_done-bottom'); $this->click('CIVICRM_QFID_1_is_monetary'); $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']"); - $this->select('financial_type_id','label=Event Fee'); + $this->select('financial_type_id', 'label=Event Fee'); $this->select('price_set_id', 'label=' . $setTitle); - // intro text for registration page $registerIntro = 'Fill in all the fields below and click Continue.'; $this->clickLink('_qf_Fee_upload-bottom', 'link=Online Registration', FALSE); @@ -422,7 +424,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->waitForElementPresent('_qf_Fee_upload-bottom'); $this->click('CIVICRM_QFID_1_is_monetary'); $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']"); - $this->select('financial_type_id','label=Event Fee'); + $this->select('financial_type_id', 'label=Event Fee'); $this->select('price_set_id', 'label=' . $setTitle); $this->clickLink('_qf_Fee_upload-bottom', 'link=Online Registration', FALSE); @@ -573,11 +575,11 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->click('link=Fees'); $this->waitForElementPresent('_qf_Fee_upload-bottom'); $this->click('CIVICRM_QFID_1_is_monetary'); - $this->select('financial_type_id','label=Event Fee'); + $this->select('financial_type_id', 'label=Event Fee'); $this->select('price_set_id', 'label=' . $setTitle); $this->click('_qf_Fee_upload-bottom'); - $this->waitForText("crm-notification-container","'Fees' information has been saved."); + $this->waitForText("crm-notification-container", "'Fees' information has been saved."); $this->openCiviPage('participant/add', 'reset=1&action=add&context=standalone', '_qf_Participant_upload-bottom'); @@ -719,7 +721,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->click('link=Fees'); $this->waitForElementPresent('_qf_Fee_upload-bottom'); $this->click('CIVICRM_QFID_1_is_monetary'); - $this->select('financial_type_id','label=Event Fee'); + $this->select('financial_type_id', 'label=Event Fee'); $this->select('price_set_id', 'label=' . $setTitle); $templateId = $this->urlArg('id'); $this->click('_qf_Fee_upload-bottom'); @@ -736,7 +738,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { $this->openCiviPage("admin/price", "reset=1"); $this->click("xpath=//table[@id='option11']/tbody/tr/td[4]/span[2]/ul/li[3]/a"); // Check confirmation alert. - $this->assertTrue((bool)preg_match("/^Are you sure you want to delete this price set?/", + $this->assertTrue((bool) preg_match("/^Are you sure you want to delete this price set?/", $this->getConfirmation() )); $this->chooseOkOnNextConfirmation(); diff --git a/tests/phpunit/WebTest/Event/AdditionalPaymentTest.php b/tests/phpunit/WebTest/Event/AdditionalPaymentTest.php index 287f594ce8..b67ae2370d 100644 --- a/tests/phpunit/WebTest/Event/AdditionalPaymentTest.php +++ b/tests/phpunit/WebTest/Event/AdditionalPaymentTest.php @@ -97,7 +97,7 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase { // check for proper info message displayed regarding status $this->chooseCancelOnNextConfirmation(); $this->click('_qf_Participant_upload-bottom'); - $this->assertTrue((bool)preg_match("/Payment amount is less than the amount owed. Expected participant status is 'Partially paid'. Are you sure you want to set the participant status to Registered/", $this->getConfirmation())); + $this->assertTrue((bool) preg_match("/Payment amount is less than the amount owed. Expected participant status is 'Partially paid'. Are you sure you want to set the participant status to Registered/", $this->getConfirmation())); // select partially paid status again and click on save $this->select('status_id', 'label=Partially paid'); @@ -155,7 +155,7 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase { // verify balance $text = $this->getText("xpath=id('AdditionalPayment')/div[2]//table/tbody/tr[3]/td[2]"); - $this->assertTrue((bool)preg_match("/{$balance}/", $text)); + $this->assertTrue((bool) preg_match("/{$balance}/", $text)); // check form rule error $errorBalance = $balance + 1; diff --git a/tests/phpunit/WebTest/Event/PCPAddTest.php b/tests/phpunit/WebTest/Event/PCPAddTest.php index fddc73fd24..b2d74127e5 100644 --- a/tests/phpunit/WebTest/Event/PCPAddTest.php +++ b/tests/phpunit/WebTest/Event/PCPAddTest.php @@ -493,7 +493,7 @@ class WebTest_Event_PCPAddTest extends CiviSeleniumTestCase { $this->clickLink("_qf_Search_refresh"); $this->clickLink("xpath=//div[@id='participantSearch']/table/tbody/tr[1]/td[@class='crm-participant-sort_name']/a[text()='{$sortName}']/../../td[11]/span/a[text()='View']", "xpath=//table[@class='selector row-highlight']/tbody/tr/td[8]/span/a[text()='View']", FALSE); - $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']", "_qf_ParticipantView_cancel-bottom", false); + $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']", "_qf_ParticipantView_cancel-bottom", FALSE); $this->webtestVerifyTabularData( array( diff --git a/tests/phpunit/WebTest/Event/ParticipantSearchTest.php b/tests/phpunit/WebTest/Event/ParticipantSearchTest.php index c4eaab8da5..638ee82287 100644 --- a/tests/phpunit/WebTest/Event/ParticipantSearchTest.php +++ b/tests/phpunit/WebTest/Event/ParticipantSearchTest.php @@ -158,7 +158,6 @@ class WebTest_Event_ParticipantSearchTest extends CiviSeleniumTestCase { $this->webtestFillDate('event_start_date_low', '-2 year'); $this->webtestFillDate('event_end_date_high', '+1 year'); - $this->click("_qf_Search_refresh"); $this->waitForElementPresent("xpath=//form[@id='Search']/div[3]/div/div[1]/div"); diff --git a/tests/phpunit/WebTest/Export/ContactTest.php b/tests/phpunit/WebTest/Export/ContactTest.php index 7d1c9d8cee..b244c7178d 100644 --- a/tests/phpunit/WebTest/Export/ContactTest.php +++ b/tests/phpunit/WebTest/Export/ContactTest.php @@ -46,7 +46,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { // We're using Quick Add block on the main page for this. $firstContactName = 'TestExport' . substr(sha1(rand()), 0, 7); - list($emailContactFirst,$prefixLabelContactFrst,$suffixLabelContactFrst,$genderLabelContactFrst) = WebTest_Export_ContactTest::webtestAddContactWithGenderPrefixSuffix($firstContactName, "Smith", "$firstContactName.smith@example.org", Null); + list($emailContactFirst, $prefixLabelContactFrst, $suffixLabelContactFrst, $genderLabelContactFrst) = WebTest_Export_ContactTest::webtestAddContactWithGenderPrefixSuffix($firstContactName, "Smith", "$firstContactName.smith@example.org", NULL); $sortFirstName = "Smith, $firstContactName"; $displayFirstName = "$firstContactName Smith"; @@ -62,7 +62,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { $this->waitForAjaxContent(); $secondContactName = 'TestExport2' . substr(sha1(rand()), 0, 7); - list($emailContactSecond,$prefixLabelContactScnd,$suffixLabelContactScnd,$genderLabelContactScnd) = WebTest_Export_ContactTest::webtestAddContactWithGenderPrefixSuffix($secondContactName, "John", "$secondContactName.john@example.org", Null); + list($emailContactSecond, $prefixLabelContactScnd, $suffixLabelContactScnd, $genderLabelContactScnd) = WebTest_Export_ContactTest::webtestAddContactWithGenderPrefixSuffix($secondContactName, "John", "$secondContactName.john@example.org", NULL); $sortSecondName = "John, $secondContactName"; $displaySecondName = "$secondContactName John"; @@ -446,14 +446,14 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { $this->select("suffix_id", "value=$suffix"); $this->click("demographics"); $this->waitForElementPresent("civicrm_gender_Female_1"); - $this->click($genderLabel,"value=$gender"); + $this->click($genderLabel, "value=$gender"); $this->waitForElementPresent('_qf_Contact_upload_view-bottom'); $this->click('_qf_Contact_upload_view-bottom'); $this->waitForPageToLoad($this->getTimeoutMsec()); - $prefixLabel = WebTest_Export_ContactTest::getOptionLabel('individual_prefix',$prefix); - $suffixLabel = WebTest_Export_ContactTest::getOptionLabel('individual_suffix',$suffix); - $genderLabel = WebTest_Export_ContactTest::getOptionLabel('gender',$gender); - return array($email,$prefixLabel,$suffixLabel,$genderLabel); + $prefixLabel = WebTest_Export_ContactTest::getOptionLabel('individual_prefix', $prefix); + $suffixLabel = WebTest_Export_ContactTest::getOptionLabel('individual_suffix', $suffix); + $genderLabel = WebTest_Export_ContactTest::getOptionLabel('gender', $gender); + return array($email, $prefixLabel, $suffixLabel, $genderLabel); } /** @@ -462,7 +462,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { * * @return array|int */ - public function getOptionLabel($optionGroupName,$optionValue){ + public function getOptionLabel($optionGroupName, $optionValue){ $params = array( 'version' => 3, 'sequential' => 1, @@ -470,7 +470,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase { 'value' => $optionValue, 'return' => 'label' ); - $optionLabel = $this->webtest_civicrm_api("OptionValue", "getvalue",$params); + $optionLabel = $this->webtest_civicrm_api("OptionValue", "getvalue", $params); return $optionLabel; } } diff --git a/tests/phpunit/WebTest/Export/ExportCiviSeleniumTestCase.php b/tests/phpunit/WebTest/Export/ExportCiviSeleniumTestCase.php index a027787550..5dbf2928d8 100644 --- a/tests/phpunit/WebTest/Export/ExportCiviSeleniumTestCase.php +++ b/tests/phpunit/WebTest/Export/ExportCiviSeleniumTestCase.php @@ -55,7 +55,7 @@ class ExportCiviSeleniumTestCase extends CiviSeleniumTestCase { $this->click($selector); // Wait for file to be downloaded - for ($i=1; $i<15; ++$i) { + for ($i = 1; $i < 15; ++$i) { sleep(2); if (file_exists($file)) { return $file; @@ -77,13 +77,13 @@ class ExportCiviSeleniumTestCase extends CiviSeleniumTestCase { * Array of header and rows according to row index. * eg: array( * 1 => array( - // Row index 1 - // column name 'First Name', value 'Jones' + // Row index 1 + // column name 'First Name', value 'Jones' * 'First Name' => 'Jones', * 'Last Name' => 'Franklin' * ), * 2 => array( - // Row index 2 + // Row index 2 * 'First Name' => 'Rajan', * 'Last Name' => 'mayekar' * ), diff --git a/tests/phpunit/WebTest/Financial/FinancialAccountTest.php b/tests/phpunit/WebTest/Financial/FinancialAccountTest.php index a1a39328c1..883d070b1b 100644 --- a/tests/phpunit/WebTest/Financial/FinancialAccountTest.php +++ b/tests/phpunit/WebTest/Financial/FinancialAccountTest.php @@ -40,7 +40,7 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { // Add new Financial Account $orgName = 'Alberta '.substr(sha1(rand()), 0, 7); - $uniqueName = explode(" ",$orgName); + $uniqueName = explode(" ", $orgName); $financialAccountTitle = 'Financial Account '.substr(sha1(rand()), 0, 4); $financialAccountDescription = "{$financialAccountTitle} Description"; $accountingCode = 1033; @@ -72,7 +72,8 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { $this->clickLink("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom', FALSE); //Varify Data after Adding new Financial Account - $verifyData = array('name' => $financialAccountTitle, + $verifyData = array( + 'name' => $financialAccountTitle, 'description' => $financialAccountDescription, 'accounting_code' => $accountingCode, 'tax_rate' => $taxRate, @@ -97,7 +98,7 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { if ($orgNameEdit) { $orgNameEdit = 'NGO '.substr(sha1(rand()), 0, 7); $this->webtestAddOrganization($orgNameEdit); - $uniqueName = explode(" ",$orgNameEdit); + $uniqueName = explode(" ", $orgNameEdit); } $this->_testEditFinancialAccount($editfinancialAccount, @@ -119,7 +120,8 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']"); $this->clickLink("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom', FALSE); - $verifyData = array( 'name' => $financialAccountTitle, + $verifyData = array( + 'name' => $financialAccountTitle, 'description' => $financialAccountDescription, 'accounting_code' => $accountingCode, 'tax_rate' => $taxRate, @@ -131,7 +133,7 @@ class WebTest_Financial_FinancialAccountTest extends CiviSeleniumTestCase { $this->assertEquals($orgName, $this->getText("xpath=//*[@id='s2id_contact_id']/a/span[1]")); $this->_assertFinancialAccount($verifyData); - $verifySelectFieldData = array('financial_account_type_id' => $financialAccountType); + $verifySelectFieldData = array('financial_account_type_id' => $financialAccountType); $this->_assertSelectVerify($verifySelectFieldData); $this->click('_qf_FinancialAccount_cancel-botttom'); $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Delete']"); diff --git a/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php b/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php index 8b72ca9228..e2e6ff774f 100644 --- a/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php +++ b/tests/phpunit/WebTest/Financial/FinancialAccountTypeTest.php @@ -42,8 +42,8 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { //Add new Financial Type $financialType['name'] = 'FinancialType '.substr(sha1(rand()), 0, 4); - $financialType['is_deductible'] = true; - $financialType['is_reserved'] = false; + $financialType['is_deductible'] = TRUE; + $financialType['is_reserved'] = FALSE; $this->addeditFinancialType($financialType); $expected = array( array( @@ -68,7 +68,7 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { $this->click("xpath=id('ltype')/div/table/tbody/tr/td[1][text()='$financialType[name]']/../td[7]/span/a[text()='Accounts']"); $this->waitForElementPresent('newfinancialTypeAccount'); - foreach ($expected as $value => $label) { + foreach ($expected as $value => $label) { $this->verifyText("xpath=//div[@id='ltype']/div/table/tbody/tr/td[2][text()='$label[financial_account]']/../td[1]", preg_quote($label['account_relationship'])); } @@ -93,10 +93,10 @@ class WebTest_Financial_FinancialAccountTypeTest extends CiviSeleniumTestCase { //edit financial type $financialType['oldname'] = $financialType['name']; $financialType['name'] = 'Edited FinancialType '.substr(sha1(rand()), 0, 4); - $financialType['is_deductible'] = true; - $financialType['is_reserved'] = false; - $this->addeditFinancialType($financialType , 'Edit'); + $financialType['is_deductible'] = TRUE; + $financialType['is_reserved'] = FALSE; + $this->addeditFinancialType($financialType, 'Edit'); //delete financialtype - $this->addeditFinancialType($financialType , 'Delete'); + $this->addeditFinancialType($financialType, 'Delete'); } } diff --git a/tests/phpunit/WebTest/Generic/CheckActivityTest.php b/tests/phpunit/WebTest/Generic/CheckActivityTest.php index 95cdd48b49..36ba575c38 100644 --- a/tests/phpunit/WebTest/Generic/CheckActivityTest.php +++ b/tests/phpunit/WebTest/Generic/CheckActivityTest.php @@ -64,7 +64,7 @@ class WebTest_Generic_CheckActivityTest extends CiviSeleniumTestCase { $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up (span with delete token class indicates that it's present)... - $this->waitForText("xpath=//div[@id='s2id_target_contact_id']","$contactFirstName1"); + $this->waitForText("xpath=//div[@id='s2id_target_contact_id']", "$contactFirstName1"); // Now we're doing the same for "Assigned To" field. // Typing contact's name into the field (using typeKeys(), not type()!)... @@ -80,6 +80,6 @@ class WebTest_Generic_CheckActivityTest extends CiviSeleniumTestCase { $this->clickAt("xpath=//div[@class='select2-result-label']"); // ...again, waiting for the box with contact name to show up... - $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']","$contactFirstName2"); + $this->waitForText("xpath=//div[@id='s2id_assignee_contact_id']", "$contactFirstName2"); } } diff --git a/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php b/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php index 32684f2531..5514019865 100644 --- a/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php +++ b/tests/phpunit/WebTest/Generic/GeneralClickAroundTest.php @@ -257,7 +257,6 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens"); $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Profiles']"); - $this->assertTextPresent("CiviCRM Profile"); // Verify Reserved Profiles @@ -315,7 +314,6 @@ class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase { $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens"); $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Activity Types']"); - // Verify activity types $this->assertTextPresent("Meeting"); $this->assertTextPresent("Print PDF Letter"); diff --git a/tests/phpunit/WebTest/Import/AddressImportTest.php b/tests/phpunit/WebTest/Import/AddressImportTest.php index 91e64336d3..8b7e122451 100644 --- a/tests/phpunit/WebTest/Import/AddressImportTest.php +++ b/tests/phpunit/WebTest/Import/AddressImportTest.php @@ -84,11 +84,12 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { 'state' => 'State', 'country' => 'Country', ); - foreach( $customDataParams['headers'] as $key =>$value){ + foreach( $customDataParams['headers'] as $key => $value){ $headers[$key] = $value; } - $rows = array( 0 => + $rows = array( + 0 => array( 'first_name' => $firstName1, @@ -140,7 +141,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { // clicking save $this->click('_qf_Field_done-bottom'); - $this->waitForText('crm-notification-container',"Custom field '{$customField}' has been saved."); + $this->waitForText('crm-notification-container', "Custom field '{$customField}' has been saved."); $this->waitForElementPresent("xpath=//span[text()='$customField']"); $customFieldId = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr/td/span[text()='$customField']/../../td[8]/span/a@href")); $customFieldId = $customFieldId[1]; @@ -150,7 +151,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $this->waitForElementPresent('_qf_Field_done-bottom'); $customField1 = 'Customfield_int ' . substr(sha1(rand()), 0, 4); $this->type('label', $customField1); - $this->select("data_type[0]","value=1"); + $this->select("data_type[0]", "value=1"); // clicking save $this->click('_qf_Field_done-bottom'); @@ -165,7 +166,7 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $this->waitForElementPresent('_qf_Field_done-bottom'); $customField2 = 'Customfield_Number ' . substr(sha1(rand()), 0, 4); $this->type('label', $customField2); - $this->select("data_type[0]","value=2"); + $this->select("data_type[0]", "value=2"); // clicking save $this->click('_qf_Field_done-bottom'); @@ -179,44 +180,44 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $this->click("newCustomField"); $this->waitForElementPresent('_qf_Field_done-bottom'); $customField3 = 'Customfield_alp_select' . substr(sha1(rand()), 0, 4); - $customFieldId3 = $this->_createMultipleValueCustomField($customField3,'Select'); + $customFieldId3 = $this->_createMultipleValueCustomField($customField3, 'Select'); // create custom field - "alphanumeric radio" $this->click("newCustomField"); $this->waitForElementPresent('_qf_Field_done-bottom'); $customField4 = 'Customfield_alp_radio' . substr(sha1(rand()), 0, 4); - $customFieldId4 = $this->_createMultipleValueCustomField($customField4,'Radio'); + $customFieldId4 = $this->_createMultipleValueCustomField($customField4, 'Radio'); // create custom field - "alphanumeric checkbox" $this->click("newCustomField"); $this->waitForElementPresent('_qf_Field_done-bottom'); $customField5 = 'Customfield_alp_checkbox' . substr(sha1(rand()), 0, 4); - $customFieldId5 = $this->_createMultipleValueCustomField($customField5,'CheckBox'); + $customFieldId5 = $this->_createMultipleValueCustomField($customField5, 'CheckBox'); // create custom field - "alphanumeric multiselect" $this->click("newCustomField"); $this->waitForElementPresent('_qf_Field_done-bottom'); $customField6 = 'Customfield_alp_multiselect' . substr(sha1(rand()), 0, 4); - $customFieldId6 = $this->_createMultipleValueCustomField($customField6,'Multi-Select'); + $customFieldId6 = $this->_createMultipleValueCustomField($customField6, 'Multi-Select'); // create custom field - "alphanumeric advmultiselect" $this->click("newCustomField"); $this->waitForElementPresent('_qf_Field_done-bottom'); $customField7 = 'Customfield_alp_advmultiselect' . substr(sha1(rand()), 0, 4); - $customFieldId7 = $this->_createMultipleValueCustomField($customField7,'AdvMulti-Select'); + $customFieldId7 = $this->_createMultipleValueCustomField($customField7, 'AdvMulti-Select'); // create custom field - "alphanumeric autocompleteselect" $this->click("newCustomField"); $this->waitForElementPresent('_qf_Field_done-bottom'); $customField8 = 'Customfield_alp_autocompleteselect' . substr(sha1(rand()), 0, 4); - $customFieldId8 = $this->_createMultipleValueCustomField($customField8,'Autocomplete-Select'); + $customFieldId8 = $this->_createMultipleValueCustomField($customField8, 'Autocomplete-Select'); // create custom field - Money $this->click("newCustomField"); $this->waitForElementPresent('_qf_Field_done-bottom'); $customField9 = 'Customfield_Money' . substr(sha1(rand()), 0, 4); $this->type('label', $customField9); - $this->select("data_type[0]","value=3"); + $this->select("data_type[0]", "value=3"); // clicking save $this->click('_qf_Field_done-bottom'); @@ -231,8 +232,8 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { $this->waitForElementPresent('_qf_Field_done-bottom'); $customField10 = 'Customfield_Date' . substr(sha1(rand()), 0, 4); $this->type('label', $customField10); - $this->select("data_type[0]","value=5"); - $this->select("date_format","value=yy-mm-dd"); + $this->select("data_type[0]", "value=5"); + $this->select("date_format", "value=yy-mm-dd"); // clicking save $this->click('_qf_Field_done-bottom'); @@ -293,14 +294,14 @@ class WebTest_Import_AddressImportTest extends ImportCiviSeleniumTestCase { * * @return array */ - public function _createMultipleValueCustomField( $customFieldName, $type ){ + public function _createMultipleValueCustomField($customFieldName, $type){ $this->type('label', $customFieldName); - $this->select("data_type[0]","value=0"); - $this->select("data_type[1]","value=".$type); - $this->type("option_label_1","label1"); - $this->type("option_value_1","label1"); - $this->type("option_label_2","label2"); - $this->type("option_value_2","label2"); + $this->select("data_type[0]", "value=0"); + $this->select("data_type[1]", "value=".$type); + $this->type("option_label_1", "label1"); + $this->type("option_value_1", "label1"); + $this->type("option_label_2", "label2"); + $this->type("option_value_2", "label2"); // clicking save $this->click('_qf_Field_done-bottom'); diff --git a/tests/phpunit/WebTest/Import/AddressParsingTest.php b/tests/phpunit/WebTest/Import/AddressParsingTest.php index ced446e197..e399dbc142 100644 --- a/tests/phpunit/WebTest/Import/AddressParsingTest.php +++ b/tests/phpunit/WebTest/Import/AddressParsingTest.php @@ -203,7 +203,8 @@ class WebTest_Import_AddressParsingTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('first_name' => 'A' . substr(sha1(rand()), 0, 7), + array( + 'first_name' => 'A' . substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => substr(sha1(rand()), 0, 7) . 'and', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -215,7 +216,8 @@ class WebTest_Import_AddressParsingTest extends ImportCiviSeleniumTestCase { 'state' => 'NY', 'country' => 'United States', ), - array('first_name' => 'S' . substr(sha1(rand()), 0, 7), + array( + 'first_name' => 'S' . substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => substr(sha1(rand()), 0, 7) . 'sum', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', diff --git a/tests/phpunit/WebTest/Import/ContactCustomDataTest.php b/tests/phpunit/WebTest/Import/ContactCustomDataTest.php index ba58e02413..2a71a658bc 100644 --- a/tests/phpunit/WebTest/Import/ContactCustomDataTest.php +++ b/tests/phpunit/WebTest/Import/ContactCustomDataTest.php @@ -121,7 +121,8 @@ class WebTest_Import_ContactCustomDataTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('first_name' => $firstName1, + array( + 'first_name' => $firstName1, 'last_name' => 'Anderson', "custom_{$customDataParams[0]}" => 'This is a test field', ), diff --git a/tests/phpunit/WebTest/Import/ContactSubtypeTest.php b/tests/phpunit/WebTest/Import/ContactSubtypeTest.php index af48ac108d..52761f2c69 100644 --- a/tests/phpunit/WebTest/Import/ContactSubtypeTest.php +++ b/tests/phpunit/WebTest/Import/ContactSubtypeTest.php @@ -313,7 +313,8 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Anderson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -324,7 +325,8 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { 'state' => 'NY', 'country' => 'United States', ), - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Summerson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -359,7 +361,8 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('organization_name' => 'org_' . substr(sha1(rand()), 0, 7), + array( + 'organization_name' => 'org_' . substr(sha1(rand()), 0, 7), 'email' => substr(sha1(rand()), 0, 7) . '@example.org', 'phone' => '9949912154', 'address_1' => 'Add 1', @@ -368,7 +371,8 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { 'state' => 'NY', 'country' => 'United States', ), - array('organization_name' => 'org_' . substr(sha1(rand()), 0, 7), + array( + 'organization_name' => 'org_' . substr(sha1(rand()), 0, 7), 'email' => substr(sha1(rand()), 0, 7) . '@example.org', 'phone' => '6949412154', 'address_1' => 'Add 1', @@ -401,7 +405,8 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('household_name' => 'household_' . substr(sha1(rand()), 0, 7), + array( + 'household_name' => 'household_' . substr(sha1(rand()), 0, 7), 'email' => substr(sha1(rand()), 0, 7) . '@example.org', 'phone' => '3949912154', 'address_1' => 'Add 1', @@ -410,7 +415,8 @@ class WebTest_Import_ContactSubtypeTest extends ImportCiviSeleniumTestCase { 'state' => 'NY', 'country' => 'United States', ), - array('household_name' => 'household_' . substr(sha1(rand()), 0, 7), + array( + 'household_name' => 'household_' . substr(sha1(rand()), 0, 7), 'email' => substr(sha1(rand()), 0, 7) . '@example.org', 'phone' => '5949412154', 'address_1' => 'Add 1', diff --git a/tests/phpunit/WebTest/Import/ContactTest.php b/tests/phpunit/WebTest/Import/ContactTest.php index 86f56d78be..c2bf05c0d6 100644 --- a/tests/phpunit/WebTest/Import/ContactTest.php +++ b/tests/phpunit/WebTest/Import/ContactTest.php @@ -305,7 +305,8 @@ class WebTest_Import_ContactTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Anderson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -316,7 +317,8 @@ class WebTest_Import_ContactTest extends ImportCiviSeleniumTestCase { 'state' => 'NY', 'country' => 'United States', ), - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Summerson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -351,7 +353,8 @@ class WebTest_Import_ContactTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('organization_name' => 'org_' . substr(sha1(rand()), 0, 7), + array( + 'organization_name' => 'org_' . substr(sha1(rand()), 0, 7), 'email' => substr(sha1(rand()), 0, 7) . '@example.org', 'phone' => '9949912154', 'address_1' => 'Add 1', @@ -360,7 +363,8 @@ class WebTest_Import_ContactTest extends ImportCiviSeleniumTestCase { 'state' => 'NY', 'country' => 'United States', ), - array('organization_name' => 'org_' . substr(sha1(rand()), 0, 7), + array( + 'organization_name' => 'org_' . substr(sha1(rand()), 0, 7), 'email' => substr(sha1(rand()), 0, 7) . '@example.org', 'phone' => '6949412154', 'address_1' => 'Add 1', @@ -393,7 +397,8 @@ class WebTest_Import_ContactTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('household_name' => 'household_' . substr(sha1(rand()), 0, 7), + array( + 'household_name' => 'household_' . substr(sha1(rand()), 0, 7), 'email' => substr(sha1(rand()), 0, 7) . '@example.org', 'phone' => '3949912154', 'address_1' => 'Add 1', @@ -402,7 +407,8 @@ class WebTest_Import_ContactTest extends ImportCiviSeleniumTestCase { 'state' => 'NY', 'country' => 'United States', ), - array('household_name' => 'household_' . substr(sha1(rand()), 0, 7), + array( + 'household_name' => 'household_' . substr(sha1(rand()), 0, 7), 'email' => substr(sha1(rand()), 0, 7) . '@example.org', 'phone' => '5949412154', 'address_1' => 'Add 1', diff --git a/tests/phpunit/WebTest/Import/DateFormatTest.php b/tests/phpunit/WebTest/Import/DateFormatTest.php index a3924724e9..85ad21d2a0 100644 --- a/tests/phpunit/WebTest/Import/DateFormatTest.php +++ b/tests/phpunit/WebTest/Import/DateFormatTest.php @@ -172,7 +172,8 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Anderson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -184,7 +185,8 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { 'country' => 'United States', 'birth_date' => '1998-12-25', ), - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Summerson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -223,7 +225,8 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Anderson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -235,7 +238,8 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { 'country' => 'United States', 'birth_date' => '12/23/98', ), - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Summerson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -274,7 +278,8 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Anderson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -286,7 +291,8 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { 'country' => 'United States', 'birth_date' => '11/12/1995', ), - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Summerson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -325,7 +331,8 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Anderson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -337,7 +344,8 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { 'country' => 'United States', 'birth_date' => 'December 12, 1998', ), - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Summerson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -376,7 +384,8 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Anderson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -388,7 +397,8 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { 'country' => 'United States', 'birth_date' => '25/12/98', ), - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Summerson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -427,7 +437,8 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Anderson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -439,7 +450,8 @@ class WebTest_Import_DateFormatTest extends ImportCiviSeleniumTestCase { 'country' => 'United States', 'birth_date' => '25/12/1998', ), - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Summerson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', diff --git a/tests/phpunit/WebTest/Import/DuplicateMatchingTest.php b/tests/phpunit/WebTest/Import/DuplicateMatchingTest.php index c8830ed7de..0f62bb6b6d 100644 --- a/tests/phpunit/WebTest/Import/DuplicateMatchingTest.php +++ b/tests/phpunit/WebTest/Import/DuplicateMatchingTest.php @@ -370,7 +370,8 @@ class WebTest_Import_DuplicateMatchingTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('first_name' => isset($individualFields['first_name']) ? $individualFields['first_name'] : substr(sha1(rand()), 0, 7), + array( + 'first_name' => isset($individualFields['first_name']) ? $individualFields['first_name'] : substr(sha1(rand()), 0, 7), 'middle_name' => isset($individualFields['middle_name']) ? $individualFields['middle_name'] : substr(sha1(rand()), 0, 7), 'last_name' => isset($individualFields['last_name']) ? $individualFields['last_name'] : 'Anderson', 'email' => isset($individualFields['email']) ? $individualFields['email'] : substr(sha1(rand()), 0, 7) . '@example.com', @@ -381,7 +382,8 @@ class WebTest_Import_DuplicateMatchingTest extends ImportCiviSeleniumTestCase { 'state' => 'NY', 'country' => 'United States', ), - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Summerson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -418,7 +420,8 @@ class WebTest_Import_DuplicateMatchingTest extends ImportCiviSeleniumTestCase { 'country' => 'Country', ); $rows = array( - array('organization_name' => isset($organizationFields['organization_name']) ? $organizationFields['organization_name'] : 'org_' . substr(sha1(rand()), 0, 7), + array( + 'organization_name' => isset($organizationFields['organization_name']) ? $organizationFields['organization_name'] : 'org_' . substr(sha1(rand()), 0, 7), 'email' => isset($organizationFields['email']) ? $organizationFields['email'] : substr(sha1(rand()), 0, 7) . 'example.org', 'phone' => '9949912154', 'address_1' => 'Add 1', @@ -427,7 +430,8 @@ class WebTest_Import_DuplicateMatchingTest extends ImportCiviSeleniumTestCase { 'state' => 'NY', 'country' => 'United States', ), - array('organization_name' => 'org_' . substr(sha1(rand()), 0, 7), + array( + 'organization_name' => 'org_' . substr(sha1(rand()), 0, 7), 'email' => substr(sha1(rand()), 0, 7) . '@example.org', 'phone' => '6949412154', 'address_1' => 'Add 1', @@ -463,7 +467,8 @@ class WebTest_Import_DuplicateMatchingTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('household_name' => isset($householdFields['household_name']) ? $householdFields['household_name'] : 'household_' . substr(sha1(rand()), 0, 7), + array( + 'household_name' => isset($householdFields['household_name']) ? $householdFields['household_name'] : 'household_' . substr(sha1(rand()), 0, 7), 'email' => isset($householdFields['email']) ? $householdFields['email'] : substr(sha1(rand()), 0, 7) . '@example.com', 'phone' => '3949912154', 'address_1' => 'Add 1', @@ -472,7 +477,8 @@ class WebTest_Import_DuplicateMatchingTest extends ImportCiviSeleniumTestCase { 'state' => 'NY', 'country' => 'United States', ), - array('household_name' => 'household_' . substr(sha1(rand()), 0, 7), + array( + 'household_name' => 'household_' . substr(sha1(rand()), 0, 7), 'email' => substr(sha1(rand()), 0, 7) . '@example.org', 'phone' => '5949412154', 'address_1' => 'Add 1', diff --git a/tests/phpunit/WebTest/Import/GroupTest.php b/tests/phpunit/WebTest/Import/GroupTest.php index a1e26b4357..95978a8611 100644 --- a/tests/phpunit/WebTest/Import/GroupTest.php +++ b/tests/phpunit/WebTest/Import/GroupTest.php @@ -111,7 +111,8 @@ class WebTest_Import_GroupTest extends ImportCiviSeleniumTestCase { ); $rows = array( - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Anderson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -122,7 +123,8 @@ class WebTest_Import_GroupTest extends ImportCiviSeleniumTestCase { 'state' => 'NY', 'country' => 'United States', ), - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Summerson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', diff --git a/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php b/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php index 03dd1ad10b..182b668b84 100644 --- a/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php +++ b/tests/phpunit/WebTest/Import/ImportCiviSeleniumTestCase.php @@ -61,9 +61,9 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { $headers, $rows, $contactType = 'Individual', - $mode = 'Skip', + $mode = 'Skip', $fieldMapper = array(), - $other = array() + $other = array() ) { // Go to contact import page. @@ -197,7 +197,7 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { * * @param string $type * Import type (csv/sql). - * @todo:currently only supports csv, need to work on sql import + * @todo:currently only supports csv, need to work on sql import */ public function importContacts($headers, $rows, $contactType = 'Individual', $mode = 'Skip', $fieldMapper = array(), $other = array(), $type = 'csv') { @@ -364,7 +364,7 @@ class ImportCiviSeleniumTestCase extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // Check confirmation alert. - $this->assertTrue((bool)preg_match("/^Are you sure you want to Import now[\s\S]$/", $this->getConfirmation())); + $this->assertTrue((bool) preg_match("/^Are you sure you want to Import now[\s\S]$/", $this->getConfirmation())); $this->chooseOkOnNextConfirmation(); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Import/MatchExternalIdTest.php b/tests/phpunit/WebTest/Import/MatchExternalIdTest.php index 3b18b4bff1..2123b58444 100644 --- a/tests/phpunit/WebTest/Import/MatchExternalIdTest.php +++ b/tests/phpunit/WebTest/Import/MatchExternalIdTest.php @@ -318,7 +318,7 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase { $this->waitForElementPresent("_qf_Fee_upload-bottom"); $this->click("CIVICRM_QFID_1_is_monetary"); $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']"); - $this->select( "financial_type_id", "value=4" ); + $this->select( "financial_type_id", "value=4" ); $counter = 1; foreach ($params['fee_level'] as $label => $amount) { @@ -351,7 +351,7 @@ class WebTest_Import_MatchExternalIdTest extends ImportCiviSeleniumTestCase { // verify event input on info page // start at Manage Events listing $this->openCiviPage('event/manage', 'reset=1'); - $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input",$params['title']); + $this->type("xpath=//div[@class='crm-block crm-form-block crm-event-searchevent-form-block']/table/tbody/tr/td/input", $params['title']); $this->click("_qf_SearchEvent_refresh"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->clickLink("link=" . $params['title'], NULL); diff --git a/tests/phpunit/WebTest/Import/MultipleRelationshipTest.php b/tests/phpunit/WebTest/Import/MultipleRelationshipTest.php index 9f2b39df68..2e39076118 100644 --- a/tests/phpunit/WebTest/Import/MultipleRelationshipTest.php +++ b/tests/phpunit/WebTest/Import/MultipleRelationshipTest.php @@ -71,7 +71,8 @@ class WebTest_Import_MultipleRelationshipTest extends ImportCiviSeleniumTestCase 'country' => 'Country', 'contact_relationships' => array( - '4_a_b' => array('organization_name' => 'Organization Name', + '4_a_b' => array( + 'organization_name' => 'Organization Name', 'organization_email' => 'Organization Email', 'organization_add' => 'Organization Street Address', 'organization_city' => 'Organization City', @@ -99,7 +100,8 @@ class WebTest_Import_MultipleRelationshipTest extends ImportCiviSeleniumTestCase ); $rows = array( - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Anderson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -110,21 +112,25 @@ class WebTest_Import_MultipleRelationshipTest extends ImportCiviSeleniumTestCase 'state' => 'NY', 'country' => 'United States', 'contact_relationships' => - array('4_a_b' => array('organization_name' => 'Org ' . substr(sha1(rand()), 0, 7), + array( + '4_a_b' => array( + 'organization_name' => 'Org ' . substr(sha1(rand()), 0, 7), 'organization_email' => substr(sha1(rand()), 0, 7) . 'org@example.org', 'organization_add' => 'Org Street Address', 'organization_city' => 'Org City', 'organization_state' => 'NY', 'organization_country' => 'United States', ), - '7_a_b' => array('household_name' => 'House ' . substr(sha1(rand()), 0, 7), + '7_a_b' => array( + 'household_name' => 'House ' . substr(sha1(rand()), 0, 7), 'household_email' => substr(sha1(rand()), 0, 7) . 'house@example.org', 'household_add' => 'House Street Address', 'household_city' => 'House City', 'household_state' => 'NY', 'household_country' => 'United States', ), - '2_a_b' => array('spouse_f_name' => substr(sha1(rand()), 0, 7), + '2_a_b' => array( + 'spouse_f_name' => substr(sha1(rand()), 0, 7), 'spouse_l_name' => substr(sha1(rand()), 0, 7), 'spouse_email' => substr(sha1(rand()), 0, 7) . 'spouse@example.org', 'spouse_add' => 'Spouse Street Address', @@ -134,7 +140,8 @@ class WebTest_Import_MultipleRelationshipTest extends ImportCiviSeleniumTestCase ), ), ), - array('first_name' => substr(sha1(rand()), 0, 7), + array( + 'first_name' => substr(sha1(rand()), 0, 7), 'middle_name' => substr(sha1(rand()), 0, 7), 'last_name' => 'Summerson', 'email' => substr(sha1(rand()), 0, 7) . '@example.com', @@ -145,21 +152,25 @@ class WebTest_Import_MultipleRelationshipTest extends ImportCiviSeleniumTestCase 'state' => 'NY', 'country' => 'United States', 'contact_relationships' => - array('4_a_b' => array('organization_name' => 'Org ' . substr(sha1(rand()), 0, 7), + array( + '4_a_b' => array( + 'organization_name' => 'Org ' . substr(sha1(rand()), 0, 7), 'organization_email' => substr(sha1(rand()), 0, 7) . 'org@example.org', 'organization_add' => 'Org Street Address', 'organization_city' => 'Org City', 'organization_state' => 'NY', 'organization_country' => 'United States', ), - '7_a_b' => array('household_name' => 'House ' . substr(sha1(rand()), 0, 7), + '7_a_b' => array( + 'household_name' => 'House ' . substr(sha1(rand()), 0, 7), 'household_email' => substr(sha1(rand()), 0, 7) . 'house@example.org', 'household_add' => 'House Street Address', 'household_city' => 'House City', 'household_state' => 'NY', 'household_country' => 'United States', ), - '2_a_b' => array('spouse_f_name' => substr(sha1(rand()), 0, 7), + '2_a_b' => array( + 'spouse_f_name' => substr(sha1(rand()), 0, 7), 'spouse_l_name' => substr(sha1(rand()), 0, 7), 'spouse_email' => substr(sha1(rand()), 0, 7) . 'spouse@example.org', 'spouse_add' => 'Spouse Street Address', @@ -170,7 +181,7 @@ class WebTest_Import_MultipleRelationshipTest extends ImportCiviSeleniumTestCase ), ), ); - // for Employee of relationship + // for Employee of relationship $fieldMapper = array( 'mapper[10][0]' => '5_a_b', 'mapper[10][1]' => 'organization_name', diff --git a/tests/phpunit/WebTest/Mailing/AddNewMailingComponentTest.php b/tests/phpunit/WebTest/Mailing/AddNewMailingComponentTest.php index af07b05e07..1c1f72a533 100644 --- a/tests/phpunit/WebTest/Mailing/AddNewMailingComponentTest.php +++ b/tests/phpunit/WebTest/Mailing/AddNewMailingComponentTest.php @@ -103,7 +103,7 @@ class WebTest_Mailing_AddNewMailingComponentTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // Is status message correct. - $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved."); + $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved."); // Verify text. $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[text()='{$componentName}']/../td[2][text()='Footer']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details"); @@ -140,7 +140,7 @@ class WebTest_Mailing_AddNewMailingComponentTest extends CiviSeleniumTestCase { $this->waitForPageToLoad($this->getTimeoutMsec()); // Is status message correct. - $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved."); + $this->waitForText('crm-notification-container', "The mailing component '$componentName' has been saved."); // Verify text $this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[text()='{$componentName}']/../td[2][text()='Reply']/../td[3][text()='{$subject}']/../td[4][text()='{$txtMsg}']/../td[5][text()='{$htmlMsg}']"), "The row doesn't consists of proper component details"); diff --git a/tests/phpunit/WebTest/Mailing/MailingTest.php b/tests/phpunit/WebTest/Mailing/MailingTest.php index 684a996fcc..724ee0d96c 100644 --- a/tests/phpunit/WebTest/Mailing/MailingTest.php +++ b/tests/phpunit/WebTest/Mailing/MailingTest.php @@ -421,13 +421,13 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { // verify successful deliveries $this->verifyText("xpath=//table//tr[td/a[text()='Successful Deliveries']]/descendant::td[2]", preg_quote("1 (100.00%)")); - $summaryInfoLinks = array('Intended Recipients', 'Successful Deliveries', 'Tracked Opens', 'Click-throughs', 'Forwards', 'Replies', 'Bounces', 'Unsubscribe Requests','Opt-out Requests'); + $summaryInfoLinks = array('Intended Recipients', 'Successful Deliveries', 'Tracked Opens', 'Click-throughs', 'Forwards', 'Replies', 'Bounces', 'Unsubscribe Requests', 'Opt-out Requests'); //check for report and adv search links foreach($summaryInfoLinks as $value) { $this->assertTrue($this->isElementPresent("xpath=//fieldset/legend[text()='Delivery Summary']/../table//tr[td/a[text()='{$value}']]/descendant::td[3]/span/a[1][text()='Report']"), "Report link missing for {$value}"); $this->assertTrue($this->isElementPresent("xpath=//fieldset/legend[text()='Delivery Summary']/../table//tr[td/a[text()='{$value}']]/descendant::td[3]/span/a[2][text()='Advanced Search']"), "Advance Search link missing for {$value}"); -} + } // verify mailing name $this->verifyText("xpath=//table//tr[td[1]/text()='Mailing Name']/descendant::td[2]", preg_quote("Mailing $mailingName Webtest")); @@ -444,7 +444,9 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { ), 'Successful Deliveries' => array( - 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest", + 'report' => array( + 'report_name' => 'Mailing Details', + 'Mailing' => "Mailing $mailingName Webtest", "Delivery Status" => " Successful"), 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing Delivery -' => "Successful") ), @@ -460,13 +462,17 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { ), 'Forwards' => array( - 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest", + 'report' => array( + 'report_name' => 'Mailing Details', + 'Mailing' => "Mailing $mailingName Webtest", 'Forwarded' => 'Is equal to Yes'), 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: -' => "Forwards") ), 'Replies' => array( - 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest", + 'report' => array( + 'report_name' => 'Mailing Details', + 'Mailing' => "Mailing $mailingName Webtest", 'Replied' => 'Is equal to Yes'), 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: Trackable Replies -' => "Replied") ), @@ -477,13 +483,17 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { ), 'Unsubscribe Requests' => array( - 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest", + 'report' => array( + 'report_name' => 'Mailing Details', + 'Mailing' => "Mailing $mailingName Webtest", 'Unsubscribed' => 'Is equal to Yes'), 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: -' => "Unsubscribe Requests") ), 'Opt-out Requests' => array( - 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest", + 'report' => array( + 'report_name' => 'Mailing Details', + 'Mailing' => "Mailing $mailingName Webtest", 'Opted-out' => 'Is equal to Yes'), 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: -' => "Opt-out Requests") ), @@ -521,14 +531,14 @@ class WebTest_Mailing_MailingTest extends CiviSeleniumTestCase { $this->assertElementContainsText('page-title', "{$value}"); continue; } - $this->assertTrue($this->isElementPresent("xpath=//form//div[3]/table/tbody//tr/th[contains(text(),'{$key}')]/../td[contains(text(),'{$value}')]"),"Criteria check for {$key} failed for Report for {$summaryInfo}"); + $this->assertTrue($this->isElementPresent("xpath=//form//div[3]/table/tbody//tr/th[contains(text(),'{$key}')]/../td[contains(text(),'{$value}')]"), "Criteria check for {$key} failed for Report for {$summaryInfo}"); } else { $this->assertElementContainsText('page-title', "Advanced Search"); $assertedValue = $this->isElementPresent("xpath=//div[@class='crm-results-block']//div[@class='qill'][contains(text(),'{$key} {$value}')]"); if (!$assertedValue) { $assertedValue = $this->isTextPresent("{$key} {$value}"); } - $this->assertTrue($assertedValue,"Criteria check for {$key} failed for Advance Search for {$summaryInfo}"); + $this->assertTrue($assertedValue, "Criteria check for {$key} failed for Advance Search for {$summaryInfo}"); } } } diff --git a/tests/phpunit/WebTest/Mailing/SpoolTest.php b/tests/phpunit/WebTest/Mailing/SpoolTest.php index 977534311f..a226bb6cda 100644 --- a/tests/phpunit/WebTest/Mailing/SpoolTest.php +++ b/tests/phpunit/WebTest/Mailing/SpoolTest.php @@ -43,7 +43,7 @@ class WebTest_Mailing_SpoolTest extends CiviSeleniumTestCase { $this->webtestLogin(); // Start spooling mail - $mut = new CiviMailUtils($this, true); + $mut = new CiviMailUtils($this, TRUE); // Add a contact $fname = substr(sha1(rand()), 0, 6); diff --git a/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php b/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php index e27e4f8a63..4347d21770 100755 --- a/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php +++ b/tests/phpunit/WebTest/Member/DefaultMembershipPricesetTest.php @@ -245,7 +245,8 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase switch ($type) { case 'Radio': $options = array( - 1 => array('label' => "$memTypeTitle1", + 1 => array( + 'label' => "$memTypeTitle1", 'membership_type_id' => $memTypeId1, 'amount' => '100.00', ), @@ -265,7 +266,8 @@ class WebTest_Member_DefaultMembershipPricesetTest extends CiviSeleniumTestCase case 'CheckBox': $options = array( - 1 => array('label' => "$memTypeTitle1", + 1 => array( + 'label' => "$memTypeTitle1", 'membership_type_id' => $memTypeId1, 'amount' => '100.00', ), diff --git a/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php b/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php index 4b7c90687f..0aa4b8e6b2 100644 --- a/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php +++ b/tests/phpunit/WebTest/Member/FixedMembershipTypeTest.php @@ -59,7 +59,7 @@ class WebTest_Member_FixedMembershipTypeTest extends CiviSeleniumTestCase { $this->waitForElementPresent('_qf_MembershipType_cancel-bottom'); $this->type('name', "Membership Type $title"); - $this->select2('member_of_contact_id',$title); + $this->select2('member_of_contact_id', $title); $this->type('minimum_fee', '100'); $this->select( 'financial_type_id', 'value=2' ); @@ -78,7 +78,7 @@ class WebTest_Member_FixedMembershipTypeTest extends CiviSeleniumTestCase { $this->click('_qf_MembershipType_upload-bottom'); $this->waitForElementPresent('link=Add Membership Type'); - $this->waitForText('crm-notification-container',"The membership type 'Membership Type $title' has been saved."); + $this->waitForText('crm-notification-container', "The membership type 'Membership Type $title' has been saved."); $this->openCiviPage("contact/add", "reset=1&ct=Individual"); @@ -214,7 +214,7 @@ SELECT end_event_adjust_interval $this->waitForElementPresent('_qf_MembershipType_cancel-bottom'); $this->type('name', "Membership Type $title"); - $this->select2('member_of_contact_id',$title); + $this->select2('member_of_contact_id', $title); $this->type('minimum_fee', '100'); $this->select( 'financial_type_id', 'value=2' ); @@ -233,7 +233,7 @@ SELECT end_event_adjust_interval $this->click('_qf_MembershipType_upload-bottom'); $this->waitForElementPresent('link=Add Membership Type'); - $this->waitForText('crm-notification-container',"The membership type 'Membership Type $title' has been saved."); + $this->waitForText('crm-notification-container', "The membership type 'Membership Type $title' has been saved."); $this->openCiviPage("contact/add", "reset=1&ct=Individual"); @@ -371,7 +371,7 @@ SELECT end_event_adjust_interval $this->waitForElementPresent('_qf_MembershipType_cancel-bottom'); $this->type('name', "Membership Type $title"); - $this->select2('member_of_contact_id',$title); + $this->select2('member_of_contact_id', $title); $this->type('minimum_fee', '100'); $this->select( 'financial_type_id', 'value=2' ); @@ -389,7 +389,7 @@ SELECT end_event_adjust_interval $this->click('_qf_MembershipType_upload-bottom'); $this->waitForElementPresent('link=Add Membership Type'); - $this->waitForText('crm-notification-container',"The membership type 'Membership Type $title' has been saved."); + $this->waitForText('crm-notification-container', "The membership type 'Membership Type $title' has been saved."); $this->openCiviPage("contact/add", "reset=1&ct=Individual"); $firstName = "John_" . substr(sha1(rand()), 0, 7); @@ -520,7 +520,7 @@ SELECT end_event_adjust_interval $this->waitForElementPresent('_qf_MembershipType_cancel-bottom'); $this->type('name', "Membership Type $title"); - $this->select2('member_of_contact_id',$title); + $this->select2('member_of_contact_id', $title); $this->type('minimum_fee', '100'); $this->select( 'financial_type_id', 'value=2' ); @@ -538,7 +538,7 @@ SELECT end_event_adjust_interval $this->click('_qf_MembershipType_upload-bottom'); $this->waitForElementPresent('link=Add Membership Type'); - $this->waitForText('crm-notification-container',"The membership type 'Membership Type $title' has been saved."); + $this->waitForText('crm-notification-container', "The membership type 'Membership Type $title' has been saved."); $this->openCiviPage("contact/add", "reset=1&ct=Individual"); diff --git a/tests/phpunit/WebTest/Member/InheritedMembershipTest.php b/tests/phpunit/WebTest/Member/InheritedMembershipTest.php index 659ac9b49a..6b538de46b 100644 --- a/tests/phpunit/WebTest/Member/InheritedMembershipTest.php +++ b/tests/phpunit/WebTest/Member/InheritedMembershipTest.php @@ -145,7 +145,6 @@ class WebTest_Member_InheritedMembershipTest extends CiviSeleniumTestCase { $this->click('relationship_type_id'); $this->select('relationship_type_id', 'label=Employee of'); - $this->select2('related_contact_id', $title1, TRUE); $description = 'Well here is some description !!!!'; diff --git a/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php b/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php index a860a92ab2..dfe5aa6157 100644 --- a/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php +++ b/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php @@ -80,7 +80,7 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa $this->_testSignUpOrRenewMembership($sid, $contactParams, $memTypeTitle1, $memTypeTitle2, $renew = TRUE); } - public function testAddPriceSetWithMultipleTerms() { + public function testAddPriceSetWithMultipleTerms() { // Log in using webtestLogin() method $this->webtestLogin(); @@ -107,7 +107,8 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa $this->type('label', $fields[0]); $this->select('html_type', "value={$fields[1]}"); $options = array( - 1 => array('label' => $memTypeTitle1."_1", + 1 => array( + 'label' => $memTypeTitle1."_1", 'membership_type_id' => $memTypeId1, 'amount' => 50.00, 'membership_num_terms' => 1, @@ -132,9 +133,9 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa // Sleep should never be used for wait for anything to load from the server // Justification for this instance: FIXME sleep(1); - $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input",$values['membership_num_terms']); - $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input",$values['label']); - $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input",$values['amount']); + $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input", $values['membership_num_terms']); + $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input", $values['label']); + $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input", $values['amount']); if($i > 3){ $this->click('link=another choice'); } @@ -229,7 +230,8 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa switch ($type) { case 'Radio': $options = array( - 1 => array('label' => "$memTypeTitle1", + 1 => array( + 'label' => "$memTypeTitle1", 'membership_type_id' => $memTypeId1, 'amount' => 100.00, ), @@ -244,7 +246,8 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa case 'CheckBox': $options = array( - 1 => array('label' => "$memTypeTitle1", + 1 => array( + 'label' => "$memTypeTitle1", 'membership_type_id' => $memTypeId1, 'amount' => 100.00, ), diff --git a/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php index 35f688614f..d82c6cb003 100644 --- a/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php @@ -93,7 +93,6 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { // save the renewed membership $this->click('_qf_MembershipRenewal_upload-bottom'); - // page was loaded $this->waitForTextPresent($sourceText); @@ -118,7 +117,7 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { 'End date' => $endDate, ); $this->webtestVerifyTabularData($verifyMembershipRenewData); - } + } public function testOfflineMemberRenewOverride() { $this->webtestLogin(); @@ -196,7 +195,6 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { // save the renewed membership $this->click('_qf_MembershipRenewal_upload-bottom'); - // page was loaded $this->waitForTextPresent($sourceText); @@ -294,7 +292,6 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { // save the renewed membership $this->click('_qf_MembershipRenewal_upload-bottom'); - // page was loaded $this->waitForTextPresent($sourceText); @@ -381,7 +378,6 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "{$membershipTypes['membership_type']} membership for $firstName Memberson has been added."); $this->waitForText('crm-notification-container', "A membership confirmation and receipt has been sent to {$firstName}@memberson.com."); - $this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span[2][text()='more']/ul/li/a[text()='Renew']"); // click through to the Membership Renewal Link $this->click("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span[2][text()='more']/ul/li/a[text()='Renew']"); @@ -411,7 +407,6 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { // save the renewed membership $this->click('_qf_MembershipRenewal_upload-bottom'); - // page was loaded $this->waitForTextPresent($sourceText); diff --git a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php index 0577614f72..31c5024da0 100644 --- a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php +++ b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipGCTest.php @@ -122,7 +122,6 @@ class WebTest_Member_OnlineAutoRenewMembershipGCTest extends CiviSeleniumTestCas $this->type("duration_interval", "1"); $this->select("duration_unit", "label=year"); - $this->click("_qf_MembershipType_upload-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -134,7 +133,6 @@ class WebTest_Member_OnlineAutoRenewMembershipGCTest extends CiviSeleniumTestCas $this->type("duration_interval", "1"); $this->select("duration_unit", "label=year"); - $this->click("_qf_MembershipType_upload-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php index 6ba841b117..dde48702f9 100644 --- a/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php +++ b/tests/phpunit/WebTest/Member/OnlineAutoRenewMembershipTest.php @@ -132,7 +132,7 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase static $pageId = NULL; if (!$pageId) { - $this->webtestLogin(); + $this->webtestLogin(); //add payment processor. $hash = substr(sha1(rand()), 0, 7); @@ -148,7 +148,6 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase $this->type("duration_interval", "1"); $this->select("duration_unit", "label=year"); - $this->click("_qf_MembershipType_upload-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -159,7 +158,6 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase $this->type("duration_interval", "1"); $this->select("duration_unit", "label=year"); - $this->click("_qf_MembershipType_upload-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -202,7 +200,7 @@ class WebTest_Member_OnlineAutoRenewMembershipTest extends CiviSeleniumTestCase ); //make sure we do have required permissions. - $permissions = array("edit-1-make-online-contributions", "edit-1-profile-listings-and-forms"); + $permissions = array("edit-1-make-online-contributions", "edit-1-profile-listings-and-forms"); $this->changePermissions($permissions); // now logout and do membership test that way diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php index a54f1eca62..3d7015ed73 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php @@ -118,7 +118,8 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas $this->type('label', $fields[0]); $this->select('html_type', "value={$fields[1]}"); $options = array( - 1 => array('label' => $memTypeTitle1."_1", + 1 => array( + 'label' => $memTypeTitle1."_1", 'membership_type_id' => $memTypeId1, 'amount' => 50.00, 'membership_num_terms' => 1, @@ -142,9 +143,9 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas $this->select("membership_type_id_{$index}", "value={$values['membership_type_id']}"); $this->waitForElementPresent("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input"); - $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input",$values['membership_num_terms']); - $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input",$values['label']); - $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input",$values['amount']); + $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[4]/input", $values['membership_num_terms']); + $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[5]/input", $values['label']); + $this->type("xpath=//table[@id='optionField']/tbody/tr[$i]/td[6]/input", $values['amount']); if($i > 3){ $this->click('link=another choice'); } @@ -200,7 +201,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas } elseif ($usedFor == 'Membership') { $this->click('extends[3]'); - $this->waitForElementPresent( 'financial_type_id' ); + $this->waitForElementPresent( 'financial_type_id' ); $this->select("css=select.crm-form-select", "label={$contributionType}"); } @@ -244,7 +245,8 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas switch ($type) { case 'Radio': $options = array( - 1 => array('label' => "$memTypeTitle1", + 1 => array( + 'label' => "$memTypeTitle1", 'membership_type_id' => $memTypeId1, 'amount' => 100.00, ), @@ -259,7 +261,8 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas case 'CheckBox': $options = array( - 1 => array('label' => "$memTypeTitle1", + 1 => array( + 'label' => "$memTypeTitle1", 'membership_type_id' => $memTypeId1, 'amount' => 100.00, ), diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php index d0c175be1b..c086990e84 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php @@ -196,7 +196,7 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { // Select membership type 1 $this->waitForElementPresent("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label"); if ($memTypeId != 'No thank you') { - $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//div/span/label/span[1][contains(text(),'$memTypeId')]"); + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//div/span/label/span[1][contains(text(),'$memTypeId')]"); } else { @@ -317,7 +317,7 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { $this->webtestLogin(); //Find Contribution - $this->openCiviPage("contribute/search","reset=1", "contribution_date_low"); + $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); $this->type("sort_name", "$lastName $firstName"); $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']"); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php index eb53d453a1..cc01c2661e 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php @@ -69,9 +69,9 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->waitForElementPresent("new_title"); if ($this->isElementPresent("member_price_set_id")) { - $this->waitForElementPresent("member_price_set_id"); + $this->waitForElementPresent("member_price_set_id"); - $this->select("member_price_set_id", "label=- none -"); + $this->select("member_price_set_id", "label=- none -"); } $this->waitForElementPresent("membership_type-block"); @@ -243,9 +243,9 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->waitForElementPresent("new_title"); if ($this->isElementPresent("member_price_set_id")) { - $this->waitForElementPresent("member_price_set_id"); + $this->waitForElementPresent("member_price_set_id"); - $this->select("member_price_set_id", "label=- none -"); + $this->select("member_price_set_id", "label=- none -"); } $this->waitForElementPresent("membership_type-block"); diff --git a/tests/phpunit/WebTest/Member/StandaloneAddTest.php b/tests/phpunit/WebTest/Member/StandaloneAddTest.php index 618b60b2e2..d719d4287d 100644 --- a/tests/phpunit/WebTest/Member/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Member/StandaloneAddTest.php @@ -125,11 +125,11 @@ class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase { // add softcredit details $totalAmount = 100; $financialType = 'Donation'; - $this->clickLink('is_different_contribution_contact','total_amount',FALSE); + $this->clickLink('is_different_contribution_contact', 'total_amount', FALSE); $this->select('soft_credit_type_id', 'Gift'); $this->select2('soft_credit_contact_id', $giftMembercontactName); - $this->select('financial_type_id','Donation'); + $this->select('financial_type_id', 'Donation'); $this->type('total_amount', $totalAmount); $this->select('payment_instrument_id', 'Check'); $this->select('contribution_status_id', 'Completed'); @@ -198,7 +198,7 @@ class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase { // fill in Record Membership Payment? $this->click("record_contribution", "value=1"); $this->waitForElementPresent("contribution_status_id"); - // let financial type be default + // let financial type be default // let the amount be default @@ -250,7 +250,7 @@ class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase { $test = $this; $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl, function() use ($test) { - $test->select('membership_type_id_0', 'value=1'); + $test->select('membership_type_id_0', 'value=1'); } ); } diff --git a/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php b/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php index 2ad44888c0..be0068e19e 100644 --- a/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php +++ b/tests/phpunit/WebTest/Pledge/AddCancelPaymentTest.php @@ -90,8 +90,8 @@ class WebTest_Pledge_AddCancelPaymentTest extends CiviSeleniumTestCase { //Check whether the next two payments are done or not $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='View Payment']"); - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]","Completed"); - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[7]","Completed"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]", "Completed"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[7]", "Completed"); //Cancel the contribution made for amount of 300.00 $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='View Payment']"); @@ -110,15 +110,15 @@ class WebTest_Pledge_AddCancelPaymentTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]"); // verify that first paayment is cancelled and the rest two payments are revert back to the pending status - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[7]","Cancelled"); - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]","Pending"); - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[7]","Pending"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[7]", "Cancelled"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]", "Pending"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[7]", "Pending"); // Check whether a new payment with pending status is added at the last or not - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[14]/td[7]","Pending"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[14]/td[7]", "Pending"); // verify that Balance sum is correct - $this->verifyText("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[4]","1,200.00"); + $this->verifyText("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[4]", "1,200.00"); } } diff --git a/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php b/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php index 6e46a78c92..6368dc5e31 100644 --- a/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Pledge/ContactContextAddTest.php @@ -74,7 +74,6 @@ class WebTest_Pledge_ContactContextAddTest extends CiviSeleniumTestCase { $this->select("contribution_page_id", "value=3"); - //PaymentReminders $this->click("PaymentReminders"); $this->waitForElementPresent("additional_reminder_day"); diff --git a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php index 6ed6b3c55b..04c2047084 100644 --- a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php +++ b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php @@ -38,7 +38,7 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest public function testAddPledgePaymentWithAdjustPledgePaymentSchedule() { $this->webtestLogin(); $this->openCiviPage('admin/setting/localization', 'reset=1'); - $this->select("currencyLimit-f","value=FJD"); + $this->select("currencyLimit-f", "value=FJD"); $this->click("add"); $this->click("_qf_Localization_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -71,18 +71,17 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest // check contact name on pledge form $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName"); - $this->select("currency","value=FJD"); + $this->select("currency", "value=FJD"); $this->type("amount", "30"); $this->type("installments", "3"); $this->select("frequency_unit", "value=week"); $this->type("frequency_day", "2"); $this->webtestFillDate('acknowledge_date', 'now'); - $this->select( "financial_type_id", "label=Donation"); + $this->select( "financial_type_id", "label=Donation"); $this->select("contribution_page_id", "value=3"); - //PaymentReminders $this->click("PaymentReminders"); $this->waitForElementPresent("additional_reminder_day"); @@ -198,7 +197,7 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest ) ); $this->openCiviPage('admin/setting/localization', 'reset=1'); - $this->select("currencyLimit-t","value=FJD"); + $this->select("currencyLimit-t", "value=FJD"); $this->click("remove"); $this->click("_qf_Localization_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); @@ -245,8 +244,6 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest $this->select("contribution_page_id", "value=3"); - - //PaymentReminders $this->click("PaymentReminders"); $this->waitForElementPresent("additional_reminder_day"); @@ -392,7 +389,6 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest $this->select("contribution_page_id", "value=3"); - //PaymentReminders $this->click("PaymentReminders"); $this->waitForElementPresent("additional_reminder_day"); diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php index a6f79baa7e..5e1d40f333 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddDeleteTest.php @@ -125,14 +125,14 @@ class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]"); - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]","Pending"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]", "Pending"); $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td"); // verify that payment owed amount is correct (250.00) - $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td","250.00"); + $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td", "250.00"); // verify that Total Paid and Balance sums are correct - $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[3]","470.00"); - $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[4]","1,930.00"); + $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[3]", "470.00"); + $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[4]", "1,930.00"); } } diff --git a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php index 1af63905b4..517c0e9cc8 100644 --- a/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Pledge/StandaloneAddTest.php @@ -52,7 +52,6 @@ class WebTest_Pledge_StandaloneAddTest extends CiviSeleniumTestCase { $this->select('contribution_page_id', 'value=3'); - //PaymentReminders $this->click('PaymentReminders'); $this->waitForElementPresent('additional_reminder_day'); diff --git a/tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php b/tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php index d2ebb6b7fc..742014dc8d 100644 --- a/tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php +++ b/tests/phpunit/WebTest/Profile/MultiRecordProfileAddTest.php @@ -380,14 +380,14 @@ class WebTest_Profile_MultiRecordProfileAddTest extends CiviSeleniumTestCase { $this->type('first_name', $params['firstname']); $params['lastname'] = 'Anderson' . substr(sha1(rand()), 0, 3); $this->type('last_name', $params['lastname']); - $params['email'] = $params['firstname'].$params['lastname'].'@exa.com'; + $params['email'] = $params['firstname'].$params['lastname'].'@exa.com'; $this->type('email-Primary', $params['email']); $this->waitForElementPresent("//div[@id='crm-profile-block']//div/div[2]/select"); - $this->select("//div[@id='crm-profile-block']//div/div[2]/select",'value=1'); + $this->select("//div[@id='crm-profile-block']//div/div[2]/select", 'value=1'); } else { $this->waitForElementPresent("//div[@id='crm-profile-block']//div/div[2]/select"); - $this->select("//div[@id='crm-profile-block']//div/div[2]/select",'value=1'); + $this->select("//div[@id='crm-profile-block']//div/div[2]/select", 'value=1'); } if ($dialog) { diff --git a/tests/phpunit/WebTest/Profile/ProfileAddTest.php b/tests/phpunit/WebTest/Profile/ProfileAddTest.php index ef03f5be42..feff9842b5 100644 --- a/tests/phpunit/WebTest/Profile/ProfileAddTest.php +++ b/tests/phpunit/WebTest/Profile/ProfileAddTest.php @@ -103,7 +103,6 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { $gid = $this->urlArg('gid'); - //Add field to profile $this->waitForElementPresent("field_name[0]"); $this->click('field_name[0]'); @@ -130,7 +129,7 @@ class WebTest_Profile_ProfileAddTest extends CiviSeleniumTestCase { $groupName = 'group_' . substr(sha1(rand()), 0, 7); $this->WebtestAddGroup($groupName); - // Add new profile. + // Add new profile. $this->openCiviPage('admin/uf/group', 'reset=1'); $this->click('newCiviCRMProfile-top'); diff --git a/tests/phpunit/WebTest/Profile/ProfileCountryState.php b/tests/phpunit/WebTest/Profile/ProfileCountryState.php index 6f666c5a85..074bc5b07e 100644 --- a/tests/phpunit/WebTest/Profile/ProfileCountryState.php +++ b/tests/phpunit/WebTest/Profile/ProfileCountryState.php @@ -54,7 +54,6 @@ class WebTest_Profile_ProfileCountryState extends CiviSeleniumTestCase { $this->click('_qf_Group_next'); $this->waitForPageToLoad($this->getTimeoutMsec()); - //check for profile create $this->waitForText('crm-notification-container', "Profile '{$profileTitle}' has been added. You can add fields to this profile now."); $gid = $this->urlArg('gid'); @@ -102,7 +101,7 @@ class WebTest_Profile_ProfileCountryState extends CiviSeleniumTestCase { $this->click("//option[@value='$countryID']"); $this->click("xpath=//tr[@class='crm-localization-form-block-provinceLimit']/td[2]/table//tbody/tr/td[2]/input[@name='add']"); } - $added = true; + $added = TRUE; } if ($added) { $this->click("_qf_Localization_next-bottom"); @@ -130,16 +129,16 @@ class WebTest_Profile_ProfileCountryState extends CiviSeleniumTestCase { $this->openCiviPage("admin/setting/localization", "reset=1", "_qf_Localization_next-bottom"); $enabledCountries = $this->getSelectOptions("countryLimit-t"); $enabledStates = $this->getSelectOptions("provinceLimit-t"); - $removed = false; + $removed = FALSE; foreach($newCountry as $countryID => $countryName) { - $this->addSelection("countryLimit-t", "label=$countryName"); - $this->click("xpath=//select[@id='countryLimit-t']/option[@value='$countryID']"); - $this->click("xpath=//tr[@class='crm-localization-form-block-countryLimit']/td[2]/table//tbody/tr/td[2]/input[@name='remove']"); - - $this->addSelection("provinceLimit-t", "label=$countryName"); - $this->click("//option[@value='$countryID']"); - $this->click("xpath=//tr[@class='crm-localization-form-block-provinceLimit']/td[2]/table//tbody/tr/td[2]/input[@name='remove']"); - $removed = true; + $this->addSelection("countryLimit-t", "label=$countryName"); + $this->click("xpath=//select[@id='countryLimit-t']/option[@value='$countryID']"); + $this->click("xpath=//tr[@class='crm-localization-form-block-countryLimit']/td[2]/table//tbody/tr/td[2]/input[@name='remove']"); + + $this->addSelection("provinceLimit-t", "label=$countryName"); + $this->click("//option[@value='$countryID']"); + $this->click("xpath=//tr[@class='crm-localization-form-block-provinceLimit']/td[2]/table//tbody/tr/td[2]/input[@name='remove']"); + $removed = TRUE; } if ($removed) { $this->click("_qf_Localization_next-bottom"); diff --git a/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php b/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php index d553ea4e72..8ea217b0ca 100644 --- a/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php +++ b/tests/phpunit/WebTest/Profile/ProfileGroupSubscriptionTest.php @@ -120,7 +120,6 @@ class WebTest_Profile_ProfileGroupSubscriptionTest extends CiviSeleniumTestCase $this->click('_qf_Edit_next'); - // assert for subscription message $this->isTextPresent("Your subscription request has been submitted for"); diff --git a/tests/phpunit/WebTest/Release/ReleaseTestCase.php b/tests/phpunit/WebTest/Release/ReleaseTestCase.php index a2fa2f1273..8a16a97e40 100644 --- a/tests/phpunit/WebTest/Release/ReleaseTestCase.php +++ b/tests/phpunit/WebTest/Release/ReleaseTestCase.php @@ -50,8 +50,7 @@ class WebTest_Release_ReleaseTestCase extends CiviSeleniumTestCase { * @param string $dataName * @param array $browser */ - function __construct($name = NULL, array$data = array( - ), $dataName = '', array$browser = array()) { + function __construct($name = NULL, array$data = array(), $dataName = '', array$browser = array()) { parent::__construct($name, $data, $dataName, $browser); require_once 'CiviTest/ReleaseTestSettings.php'; diff --git a/tests/phpunit/WebTest/Report/AddTest.php b/tests/phpunit/WebTest/Report/AddTest.php index da7c75656e..78ed4ce900 100644 --- a/tests/phpunit/WebTest/Report/AddTest.php +++ b/tests/phpunit/WebTest/Report/AddTest.php @@ -139,7 +139,7 @@ class WebTest_Report_AddTest extends CiviSeleniumTestCase { $this->click("xpath=//div[@id='Contact']//table/tbody//tr/td/a/strong[text() = '$reportName']"); $this->waitForPageToLoad($this->getTimeoutMsec()); - // Is filter statistics present? + // Is filter statistics present? $this->assertElementContainsText("xpath=//tr/th[@class='statistics'][text()='Contact Name']/../td", "Contains $firstName", "Statistics did not found!"); // Is Contact Name present in result? diff --git a/tests/phpunit/WebTest/Report/LoggingReportTest.php b/tests/phpunit/WebTest/Report/LoggingReportTest.php index febed4d7a3..766013bdcb 100644 --- a/tests/phpunit/WebTest/Report/LoggingReportTest.php +++ b/tests/phpunit/WebTest/Report/LoggingReportTest.php @@ -150,7 +150,7 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td[8]/span/a[2]"); $this->click("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td[8]/span/a[2]"); $this->waitForElementPresent("_qf_Activity_cancel-bottom"); - $this->select("status_id","value=2"); + $this->select("status_id", "value=2"); $this->click('_qf_Activity_upload-bottom'); $this->waitForText("crm-notification-container", "Activity has been saved."); $this->waitForElementPresent("xpath=//table[@class='contact-activity-selector-activity dataTable no-footer']/tbody/tr/td[7][text()='Completed']"); @@ -161,15 +161,15 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//div[@class='view-content']//div[@class='action-link']/a"); $this->click("xpath=//div[@class='view-content']//div[@class='action-link']/a"); $this->waitForElementPresent("_qf_Case_cancel-bottom"); - $this->type('activity_subject',"subject".rand()); - $this->select('case_type_id','value=1'); + $this->type('activity_subject', "subject".rand()); + $this->select('case_type_id', 'value=1'); $this->click('_qf_Case_upload-bottom'); $this->waitForElementPresent("xpath=//form[@id='Search']/div[2]/div/table/tbody/tr[2]/td[9]/span[1]/a[1][text()='Manage']"); $this->click("xpath=//form[@id='Search']/div[2]/div/table/tbody/tr[2]/td[9]/span[1]/a[1][text()='Manage']"); $this->waitForElementPresent("xpath=//form[@id='CaseView']/div[2]/table/tbody/tr/td[4]/a"); $this->click("xpath=//form[@id='CaseView']/div[2]/table/tbody/tr/td[4]/a"); $this->waitForElementPresent("_qf_Activity_cancel-bottom"); - $this->select("case_status_id","value=2"); + $this->select("case_status_id", "value=2"); $this->click("_qf_Activity_upload-top"); $this->waitForElementPresent("_qf_CaseView_cancel-bottom"); $this->click("_qf_CaseView_cancel-bottom"); @@ -310,17 +310,17 @@ class WebTest_Report_LoggingReportTest extends CiviSeleniumTestCase { } } - //visit the logging contact summary report - $this->openCiviPage('report/logging/contact/summary', 'reset=1'); - foreach ($filters as $type => $filter) { - if ($type == 'text' ) { - foreach ($filter as $filterName => $filterValue) { - $this->type($filterName, $filterValue); + //visit the logging contact summary report + $this->openCiviPage('report/logging/contact/summary', 'reset=1'); + foreach ($filters as $type => $filter) { + if ($type == 'text' ) { + foreach ($filter as $filterName => $filterValue) { + $this->type($filterName, $filterValue); + } } } - } - $this->click("_qf_LoggingSummary_submit"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->click("_qf_LoggingSummary_submit"); + $this->waitForPageToLoad($this->getTimeoutMsec()); } } } diff --git a/tests/phpunit/api/v3/ACLCachingTest.php b/tests/phpunit/api/v3/ACLCachingTest.php index 3a68ce01b8..4dd7ef511e 100644 --- a/tests/phpunit/api/v3/ACLCachingTest.php +++ b/tests/phpunit/api/v3/ACLCachingTest.php @@ -31,8 +31,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * This class is intended to test ACL permission using the multisite module * - * @package CiviCRM_APIv3 - * @subpackage API_Contact + * @package CiviCRM_APIv3 + * @subpackage API_Contact */ class api_v3_ACLCachingTest extends CiviUnitTestCase { @@ -44,10 +44,10 @@ class api_v3_ACLCachingTest extends CiviUnitTestCase { public function setUp() { parent::setUp(); } -/** - * (non-PHPdoc) - * @see CiviUnitTestCase::tearDown() - */ + /** + * (non-PHPdoc) + * @see CiviUnitTestCase::tearDown() + */ public function tearDown() { $tablesToTruncate = array( 'civicrm_activity', @@ -56,7 +56,7 @@ class api_v3_ACLCachingTest extends CiviUnitTestCase { } public function testActivityCreateCustomBefore() { - $values = $this->callAPISuccess('custom_field', 'getoptions', array('field' => 'custom_group_id',)); + $values = $this->callAPISuccess('custom_field', 'getoptions', array('field' => 'custom_group_id')); $this->assertTrue($values['count'] == 0); $this->CustomGroupCreate(array('extends' => 'Activity')); $groupCount = $this->callAPISuccess('custom_group', 'getcount', array('extends' => 'activity')); diff --git a/tests/phpunit/api/v3/ACLPermissionTest.php b/tests/phpunit/api/v3/ACLPermissionTest.php index 3d22cc196a..d695ed106d 100644 --- a/tests/phpunit/api/v3/ACLPermissionTest.php +++ b/tests/phpunit/api/v3/ACLPermissionTest.php @@ -302,7 +302,7 @@ class api_v3_ACLPermissionTest extends CiviUnitTestCase { * @return array */ public static function entities() { - return array(array('contribution'), array('participant'),);// @todo array('pledge' => 'pledge') + return array(array('contribution'), array('participant'));// @todo array('pledge' => 'pledge') } /** diff --git a/tests/phpunit/api/v3/APIStandardsTest.php b/tests/phpunit/api/v3/APIStandardsTest.php index ef2cd3e9c6..ea364ba65b 100644 --- a/tests/phpunit/api/v3/APIStandardsTest.php +++ b/tests/phpunit/api/v3/APIStandardsTest.php @@ -6,11 +6,11 @@ * * (PHP 5) * - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: - * @package CiviCRM + * @version $Id: + * @package CiviCRM * * This file is part of CiviCRM * @@ -37,8 +37,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_activity_* functions * - * @package CiviCRM_APIv3 - * @todo determine where help functions should sit (here or 'up the tree'), & best way to define API dir + * @package CiviCRM_APIv3 + * @todo determine where help functions should sit (here or 'up the tree'), & best way to define API dir */ class api_v3_APIStandardsTest extends CiviUnitTestCase { diff --git a/tests/phpunit/api/v3/APITest.php b/tests/phpunit/api/v3/APITest.php index f043e92c7d..dc29ed34c7 100644 --- a/tests/phpunit/api/v3/APITest.php +++ b/tests/phpunit/api/v3/APITest.php @@ -31,12 +31,12 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for API functions * - * @package CiviCRM_APIv3 + * @package CiviCRM_APIv3 */ class api_v3_APITest extends CiviUnitTestCase { public $DBResetRequired = FALSE; - protected $_apiversion =3; + protected $_apiversion = 3; public function testAPIReplaceVariables() { $result = array(); @@ -73,7 +73,6 @@ class api_v3_APITest extends CiviUnitTestCase { */ public function testAPIWrapperIncludeNoFile() { - $result = $this->callAPIFailure('RandomFile', 'get', array(), 'API (RandomFile,get) does not exist (join the API team and implement it!)'); } @@ -132,9 +131,9 @@ class api_v3_APITest extends CiviUnitTestCase { $this->assertEquals($expected, $actual, sprintf('input=%s expected=%s actual=%s', $input, $expected, $actual)); } } -/** - * Test that calling via wrapper works - */ + /** + * Test that calling via wrapper works + */ public function testv3Wrapper() { try{ $result = civicrm_api3('contact', 'get', array()); diff --git a/tests/phpunit/api/v3/ActionScheduleTest.php b/tests/phpunit/api/v3/ActionScheduleTest.php index 080e988ea1..63536847e4 100644 --- a/tests/phpunit/api/v3/ActionScheduleTest.php +++ b/tests/phpunit/api/v3/ActionScheduleTest.php @@ -28,8 +28,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_action_schedule functions * - * @package CiviCRM_APIv3 - * @subpackage API_ActionSchedule + * @package CiviCRM_APIv3 + * @subpackage API_ActionSchedule */ class api_v3_ActionScheduleTest extends CiviUnitTestCase { @@ -76,7 +76,7 @@ class api_v3_ActionScheduleTest extends CiviUnitTestCase { $this->assertTrue(is_numeric($actionSchedule['id']), "In line " . __LINE__); $this->assertTrue($actionSchedule['id'] > 0, "In line " . __LINE__); $newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule'); - $this->assertEquals($oldCount+1, $newCount); + $this->assertEquals($oldCount + 1, $newCount); } /** @@ -113,7 +113,7 @@ class api_v3_ActionScheduleTest extends CiviUnitTestCase { 'start_action_condition' => 'before', 'start_action_date' => 'activity_date_time', 'is_repeat' => 1, - 'repetition_frequency_unit'=> 'day', + 'repetition_frequency_unit' => 'day', 'repetition_frequency_interval' => 3, 'end_frequency_unit' => 'hour', 'end_frequency_interval' => 0, @@ -127,7 +127,7 @@ class api_v3_ActionScheduleTest extends CiviUnitTestCase { $this->assertTrue($actionSchedule['id'] > 0, "In line " . __LINE__); $this->assertEquals($actionSchedule['values'][$actionSchedule['id']]['start_action_offset'][0], $params['start_action_offset']); $newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule'); - $this->assertEquals($oldCount+1, $newCount); + $this->assertEquals($oldCount + 1, $newCount); } diff --git a/tests/phpunit/api/v3/ActivityContactTest.php b/tests/phpunit/api/v3/ActivityContactTest.php index fffac72874..7ed66e4817 100644 --- a/tests/phpunit/api/v3/ActivityContactTest.php +++ b/tests/phpunit/api/v3/ActivityContactTest.php @@ -32,8 +32,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_activity_contact* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Activity + * @package CiviCRM_APIv3 + * @subpackage API_Activity */ class api_v3_ActivityContactTest extends CiviUnitTestCase { protected $_apiversion; @@ -71,7 +71,7 @@ class api_v3_ActivityContactTest extends CiviUnitTestCase { //create one $create = $this->callAPISuccess('activity_contact', 'create', $this->_params); - $result = $this->callAPIAndDocument('activity_contact', 'delete', array('id' => $create['id'],), __FUNCTION__, __FILE__); + $result = $this->callAPIAndDocument('activity_contact', 'delete', array('id' => $create['id']), __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count']); $get = $this->callAPISuccess('activity_contact', 'get', array( 'id' => $create['id'], diff --git a/tests/phpunit/api/v3/ActivityTest.php b/tests/phpunit/api/v3/ActivityTest.php index 692001ffc4..c09d83240f 100644 --- a/tests/phpunit/api/v3/ActivityTest.php +++ b/tests/phpunit/api/v3/ActivityTest.php @@ -4,12 +4,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: ActivityTest.php 31254 2010-12-15 10:09:29Z eileen $ - * @package CiviCRM + * @version $Id: ActivityTest.php 31254 2010-12-15 10:09:29Z eileen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -37,8 +37,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_activity_* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Activity + * @package CiviCRM_APIv3 + * @subpackage API_Activity */ class api_v3_ActivityTest extends CiviUnitTestCase { @@ -457,7 +457,6 @@ class api_v3_ActivityTest extends CiviUnitTestCase { */ public function testActivityCreateTextStatus() { - $params = array( 'source_contact_id' => $this->_contactID, 'subject' => 'Make-it-Happen Meeting', @@ -496,11 +495,12 @@ class api_v3_ActivityTest extends CiviUnitTestCase { $contact = $this->callAPISuccess('Contact', 'Create', array( 'first_name' => "The Rock", - 'last_name' =>'roccky', + 'last_name' => 'roccky', 'contact_type' => 'Individual', 'version' => 3, 'api.activity.create' => array( - 'id' => $activity['id'], 'assignee_contact_id' => '$value.id', + 'id' => $activity['id'], + 'assignee_contact_id' => '$value.id', ), )); @@ -580,11 +580,11 @@ class api_v3_ActivityTest extends CiviUnitTestCase { $params['target_contact_id'] = array($contact2 => $contact2); $activity = $this->callAPISuccess('Activity', 'Create', $params); - $activityget = $this->callAPISuccess('Activity', 'get', array('id' => $activity['id'], 'target_contact_id' => $contact2,'return.target_contact_id' => 1)); + $activityget = $this->callAPISuccess('Activity', 'get', array('id' => $activity['id'], 'target_contact_id' => $contact2, 'return.target_contact_id' => 1)); $this->assertEquals($activity['id'], $activityget['id'], 'In line ' . __LINE__); $this->assertEquals($contact2, $activityget['values'][$activityget['id']]['target_contact_id'][0], 'In line ' . __LINE__); - $activityget = $this->callAPISuccess('activity', 'get', array('target_contact_id' => $this->_contactID,'return.target_contact_id' => 1,'id' => $activity['id'])); + $activityget = $this->callAPISuccess('activity', 'get', array('target_contact_id' => $this->_contactID, 'return.target_contact_id' => 1, 'id' => $activity['id'])); if ($activityget['count'] > 0) { $this->assertNotEquals($contact2, $activityget['values'][$activityget['id']]['target_contact_id'][0], 'In line ' . __LINE__); } @@ -619,7 +619,6 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'status_id' => '2')); $this->assertEquals(0, $result['count'], 'No activities of status 1 should exist'); - } /* @@ -936,7 +935,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase { 'version' => $this->_apiversion, 'id' => $activityId, ); - $result = $this->callAPISuccess($this->_entity, 'get',$getParams ); + $result = $this->callAPISuccess($this->_entity, 'get', $getParams ); $assignee = $result['values'][$result['id']]['assignee_contact_id']; $target = $result['values'][$result['id']]['target_contact_id']; $this->assertEquals(2, count($assignee), ' in line ' . __LINE__); diff --git a/tests/phpunit/api/v3/ActivityTypeTest.php b/tests/phpunit/api/v3/ActivityTypeTest.php index 355967b78b..927ff42ea2 100644 --- a/tests/phpunit/api/v3/ActivityTypeTest.php +++ b/tests/phpunit/api/v3/ActivityTypeTest.php @@ -5,7 +5,7 @@ * * (PHP 5) * - * @package CiviCRM + * @package CiviCRM * * This file is part of CiviCRM * @@ -29,8 +29,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_activity_* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Activity + * @package CiviCRM_APIv3 + * @subpackage API_Activity */ class api_v3_ActivityTypeTest extends CiviUnitTestCase { diff --git a/tests/phpunit/api/v3/AddressTest.php b/tests/phpunit/api/v3/AddressTest.php index 1f00f7cd58..6abce24415 100644 --- a/tests/phpunit/api/v3/AddressTest.php +++ b/tests/phpunit/api/v3/AddressTest.php @@ -28,8 +28,8 @@ /** * Test APIv3 civicrm_activity_* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Contact + * @package CiviCRM_APIv3 + * @subpackage API_Contact */ require_once 'CiviTest/CiviUnitTestCase.php'; @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; * Class api_v3_AddressTest */ class api_v3_AddressTest extends CiviUnitTestCase { - protected $_apiversion =3; + protected $_apiversion = 3; protected $_contactID; protected $_locationType; protected $_params; @@ -131,8 +131,8 @@ class api_v3_AddressTest extends CiviUnitTestCase { } /** - * Create an address with a master ID and ensure that a relationship is created - */ + * Create an address with a master ID and ensure that a relationship is created + */ public function testCreateAddressWithMasterRelationshipOrganization() { $address = $this->callAPISuccess('address', 'create', $this->_params); $individualID = $this->individualCreate(); @@ -160,7 +160,7 @@ class api_v3_AddressTest extends CiviUnitTestCase { $individualParams['master_id'] = $address2['id']; $individualParams['id'] = $individualAddress['id']; $this->callAPISuccess('address', 'create', $individualParams); - $this->callAPISuccessGetCount('relationship', array('contact_id_a' => $individualID,), 2); + $this->callAPISuccessGetCount('relationship', array('contact_id_a' => $individualID), 2); $this->markTestIncomplete('Remainder of test checks that employer relationship is disabled when new one is created but turns out to be not happening - by design?'); $this->callAPISuccessGetCount('relationship', array('contact_id_a' => $individualID, 'is_active' => FALSE), 1); $this->callAPISuccessGetCount('relationship', array('contact_id_a' => $individualID, 'is_active' => TRUE, 'contact_id_b' => $organisation2ID), 1); @@ -198,7 +198,7 @@ class api_v3_AddressTest extends CiviUnitTestCase { //create one $create = $this->callAPISuccess('address', 'create', $this->_params); - $result = $this->callAPIAndDocument('address', 'delete', array('id' => $create['id'],), __FUNCTION__, __FILE__); + $result = $this->callAPIAndDocument('address', 'delete', array('id' => $create['id']), __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count'], 'In line ' . __LINE__); $get = $this->callAPISuccess('address', 'get', array( 'location_type_id' => $this->_locationType->id, @@ -264,7 +264,8 @@ class api_v3_AddressTest extends CiviUnitTestCase { $this->callAPISuccess('address', 'create', $this->_params); $subfile = "AddressLike"; $description = "Demonstrates Use of Like"; - $params = array('street_address' => array('LIKE' => '%mb%'), + $params = array( + 'street_address' => array('LIKE' => '%mb%'), 'sequential' => 1, ); $result = $this->callAPIAndDocument('Address', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile); diff --git a/tests/phpunit/api/v3/AllTests.php b/tests/phpunit/api/v3/AllTests.php index af92f1b55b..65da48f3ee 100644 --- a/tests/phpunit/api/v3/AllTests.php +++ b/tests/phpunit/api/v3/AllTests.php @@ -6,12 +6,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: AllTests.php 31254 2010-12-15 10:09:29Z eileen $ - * @package CiviCRM + * @version $Id: AllTests.php 31254 2010-12-15 10:09:29Z eileen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -38,7 +38,7 @@ require_once 'CiviTest/CiviTestSuite.php'; /** * Class containing all API v3 test suites * - * @package CiviCRM + * @package CiviCRM */ class api_v3_AllTests extends CiviTestSuite { private static $instance = NULL; diff --git a/tests/phpunit/api/v3/BatchTest.php b/tests/phpunit/api/v3/BatchTest.php index fd65aa1b3e..80b204e4e3 100644 --- a/tests/phpunit/api/v3/BatchTest.php +++ b/tests/phpunit/api/v3/BatchTest.php @@ -30,7 +30,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for Batch API - civicrm_batch_* * - * @package CiviCRM_APIv3 + * @package CiviCRM_APIv3 */ class api_v3_BatchTest extends CiviUnitTestCase { diff --git a/tests/phpunit/api/v3/CRM11793Test.php b/tests/phpunit/api/v3/CRM11793Test.php index fc94e96845..2fecf4f014 100644 --- a/tests/phpunit/api/v3/CRM11793Test.php +++ b/tests/phpunit/api/v3/CRM11793Test.php @@ -9,7 +9,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_activity_* functions * - * @package CiviCRM + * @package CiviCRM */ class api_v3_CRM11793Test extends CiviUnitTestCase { diff --git a/tests/phpunit/api/v3/CaseTest.php b/tests/phpunit/api/v3/CaseTest.php index b52f1fce7e..9a85228a57 100644 --- a/tests/phpunit/api/v3/CaseTest.php +++ b/tests/phpunit/api/v3/CaseTest.php @@ -4,12 +4,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: ActivityTest.php 31254 2010-12-15 10:09:29Z eileen $ - * @package CiviCRM + * @version $Id: ActivityTest.php 31254 2010-12-15 10:09:29Z eileen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -36,12 +36,12 @@ require_once 'CiviTest/CiviCaseTestCase.php'; /** * Test APIv3 civicrm_case_* functions * - * @package CiviCRM_APIv3 + * @package CiviCRM_APIv3 */ class api_v3_CaseTest extends CiviCaseTestCase { protected $_params; protected $_entity; - protected $_apiversion =3; + protected $_apiversion = 3; protected $followup_activity_type_value; /** diff --git a/tests/phpunit/api/v3/CaseTypeTest.php b/tests/phpunit/api/v3/CaseTypeTest.php index 73d50b6e70..764dacff12 100644 --- a/tests/phpunit/api/v3/CaseTypeTest.php +++ b/tests/phpunit/api/v3/CaseTypeTest.php @@ -138,7 +138,7 @@ class api_v3_CaseTypeTest extends CiviCaseTestCase { */ public function testCaseTypeUpdate() { // Create Case Type - $params = array( + $params = array( 'title' => 'Application', 'name' => 'Application', 'is_active' => 1, @@ -164,7 +164,7 @@ class api_v3_CaseTypeTest extends CiviCaseTestCase { */ public function testCaseTypeDelete_New() { // Create Case Type - $params = array( + $params = array( 'title' => 'Application', 'name' => 'Application', 'is_active' => 1, diff --git a/tests/phpunit/api/v3/ConstantTest.php b/tests/phpunit/api/v3/ConstantTest.php index 07b23983ee..baa5501acb 100644 --- a/tests/phpunit/api/v3/ConstantTest.php +++ b/tests/phpunit/api/v3/ConstantTest.php @@ -4,13 +4,13 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: ConstantTest.php 31254 2010-12-15 10:09:29Z eileen $ - * @package CiviCRM_APIv3 - * @subpackage API_Constant + * @version $Id: ConstantTest.php 31254 2010-12-15 10:09:29Z eileen $ + * @package CiviCRM_APIv3 + * @subpackage API_Constant * * This file is part of CiviCRM * @@ -37,8 +37,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_activity_* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Constant + * @package CiviCRM_APIv3 + * @subpackage API_Constant */ class api_v3_ConstantTest extends CiviUnitTestCase { protected $_apiversion = 3; diff --git a/tests/phpunit/api/v3/ContactTest.php b/tests/phpunit/api/v3/ContactTest.php index 67b54d7a49..713b33e5c0 100644 --- a/tests/phpunit/api/v3/ContactTest.php +++ b/tests/phpunit/api/v3/ContactTest.php @@ -4,12 +4,12 @@ * * (PHP 5) * - * @author Walt Haas (801) 534-1262 - * @copyright Copyright CiviCRM LLC (C) 2009 - * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * @author Walt Haas (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * GNU Affero General Public License version 3 - * @version $Id: ContactTest.php 31254 2010-12-15 10:09:29Z eileen $ - * @package CiviCRM + * @version $Id: ContactTest.php 31254 2010-12-15 10:09:29Z eileen $ + * @package CiviCRM * * This file is part of CiviCRM * @@ -37,8 +37,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_contact* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Contact + * @package CiviCRM_APIv3 + * @subpackage API_Contact */ class api_v3_ContactTest extends CiviUnitTestCase { @@ -48,7 +48,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { protected $_params; protected $_contactID; - protected $_financialTypeId =1; + protected $_financialTypeId = 1; /** * Test setup for every test @@ -102,7 +102,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { $this->assertTrue(is_numeric($contact['id']), "In line " . __LINE__); $this->assertTrue($contact['id'] > 0, "In line " . __LINE__); $newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_contact'); - $this->assertEquals($oldCount+1, $newCount); + $this->assertEquals($oldCount + 1, $newCount); $this->assertDBState('CRM_Contact_DAO_Contact', $contact['id'], @@ -152,7 +152,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { 'email' => 'man1@yahoo.com', 'contact_type' => 'Does not Exist', ); - $this->callAPIFailure('contact', 'create', $params,"'Does not Exist' is not a valid option for field contact_type"); + $this->callAPIFailure('contact', 'create', $params, "'Does not Exist' is not a valid option for field contact_type"); } /** @@ -361,7 +361,8 @@ class api_v3_ContactTest extends CiviUnitTestCase { )); // do it again as an update to check it doesn't cause an error $employerResult = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array( - 'current_employer' => 'new employer org', 'id' => $employerResult['id']) + 'current_employer' => 'new employer org', + 'id' => $employerResult['id']) )); $expectedCount = 1; $this->callAPISuccess('contact', 'getcount', array( @@ -386,25 +387,26 @@ class api_v3_ContactTest extends CiviUnitTestCase { $employerResult = $this->callAPISuccess('contact', 'create', array_merge($this->_params, array( 'current_employer' => 'new employer org',) )); - $relationship = $this->callAPISuccess('relationship','get', array( + $relationship = $this->callAPISuccess('relationship', 'get', array( 'contact_id_a' => $employerResult['id'], - )); + )); //disable & check it is disabled $this->callAPISuccess('relationship', 'create', array('id' => $relationship['id'], 'is_active' => 0)); - $this->callAPISuccess('relationship','getvalue', array( + $this->callAPISuccess('relationship', 'getvalue', array( 'id' => $relationship['id'], 'return' => 'is_active' ), 0); //re-set the current employer - thus enabling the relationshp $this->callAPISuccess('contact', 'create', array_merge($this->_params, array( - 'current_employer' => 'new employer org', 'id' => $employerResult['id']) + 'current_employer' => 'new employer org', + 'id' => $employerResult['id']) )); //check is_active is now 1 - $relationship = $this->callAPISuccess('relationship','getsingle', array( + $relationship = $this->callAPISuccess('relationship', 'getsingle', array( 'return' => 'is_active',)); - $this->assertEquals(1, $relationship['is_active']); + $this->assertEquals(1, $relationship['is_active']); } /** @@ -625,18 +627,21 @@ class api_v3_ContactTest extends CiviUnitTestCase { $this->callAPISuccess('contact', 'get', $params); // testing as string - $params = array('filter.group_id' => array($groupId, 26), + $params = array( + 'filter.group_id' => array($groupId, 26), 'contact_type' => 'Individual', ); $result = $this->callAPIAndDocument('contact', 'get', $params, __FUNCTION__, __FILE__, $description, $subFile); $this->assertEquals(1, $result['count']); //test in conjunction with other criteria - $params = array('filter.group_id' => array($groupId, 26), + $params = array( + 'filter.group_id' => array($groupId, 26), 'contact_type' => 'Organization', ); - $this->callAPISuccess('contact', 'get', $params); - $params = array('filter.group_id' => array(26, 27), + $this->callAPISuccess('contact', 'get', $params); + $params = array( + 'filter.group_id' => array(26, 27), 'contact_type' => 'Individual', ); $result = $this->callAPISuccess('contact', 'get', $params); @@ -810,7 +815,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { 'is_active' => 1, 'relationship_type_id' => $relTypeId, )); - } + } // Add second employer $params['employer_id'] = $employer2; @@ -983,8 +988,6 @@ class api_v3_ContactTest extends CiviUnitTestCase { ) ); - - $params = array( 'id' => 23, 'first_name' => 'abcd', @@ -1278,7 +1281,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { $extraParams = array('nick_name' => 'Bob', 'phone' => '456', 'email' => 'e@mail.com'); $contactID = $this->individualCreate($extraParams); //actually it turns out the above doesn't create a phone - $this->callAPISuccess('phone', 'create', array('contact_id' => $contactID, 'phone' => '456',)); + $this->callAPISuccess('phone', 'create', array('contact_id' => $contactID, 'phone' => '456')); $result = $this->callAPISuccess('contact', 'getsingle', array('id' => $contactID)); foreach ($extraParams as $key => $value) { $this->assertEquals($result[$key], $value); @@ -1364,7 +1367,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { 'api.contribution.create.1' => array( 'receive_date' => '2011-01-01', 'total_amount' => 120.00, - 'financial_type_id' => $this->_financialTypeId =1, + 'financial_type_id' => $this->_financialTypeId = 1, 'payment_instrument_id' => 1, 'non_deductible_amount' => 10.00, 'fee_amount' => 50.00, @@ -1442,7 +1445,6 @@ class api_v3_ContactTest extends CiviUnitTestCase { ), ); - $result = $this->callAPISuccess('Contact', 'create', $params); $params = array( 'id' => $result['id'], @@ -1512,10 +1514,12 @@ class api_v3_ContactTest extends CiviUnitTestCase { 'custom_' . $andmoreids['custom_field_id'][1] => "vegemite", ); - $result = $this->callAPISuccess('Contact', 'create', $params); $result = $this->callAPISuccess('Contact', 'create', array( - 'contact_type' => 'Individual', 'id' => $result['id'], 'custom_' . $moreids['custom_field_id'][0] => "value 3", 'custom_' . $ids['custom_field_id'] => "value 4", + 'contact_type' => 'Individual', + 'id' => $result['id'], 'custom_' . + $moreids['custom_field_id'][0] => "value 3", 'custom_' . + $ids['custom_field_id'] => "value 4", )); $params = array( @@ -1541,7 +1545,8 @@ class api_v3_ContactTest extends CiviUnitTestCase { 2 child functions - one receives values from the parent (Contact) and the other child (Tag). "; $subfile = "APIChainedArrayValuesFromSiblingFunction"; $params = array( - 'display_name' => 'batman', 'contact_type' => 'Individual', + 'display_name' => 'batman', + 'contact_type' => 'Individual', 'api.tag.create' => array('name' => '$value.id', 'description' => '$value.display_name', 'format.only_id' => 1), 'api.entity_tag.create' => array('tag_id' => '$value.api.tag.create'), ); @@ -1635,7 +1640,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { /* it will be ignored if there is not exactly 1 result"; $subFile = "FormatSingleValue"; $params = array('id' => 17, 'return' => 'display_name'); - $result = $this->callAPIAndDocument('Contact', 'getvalue', $params, __FUNCTION__, __FILE__, $description, $subFile,'getvalue'); + $result = $this->callAPIAndDocument('Contact', 'getvalue', $params, __FUNCTION__, __FILE__, $description, $subFile, 'getvalue'); $this->assertEquals('Test Contact', $result); $this->callAPISuccess('Contact', 'Delete', $params); } @@ -1645,7 +1650,8 @@ class api_v3_ContactTest extends CiviUnitTestCase { */ public function testContactCreationPermissions() { $params = array( - 'contact_type' => 'Individual', 'first_name' => 'Foo', + 'contact_type' => 'Individual', + 'first_name' => 'Foo', 'last_name' => 'Bear', 'check_permissions' => TRUE, ); @@ -1659,10 +1665,10 @@ class api_v3_ContactTest extends CiviUnitTestCase { } public function testContactUpdatePermissions() { - $params = array('contact_type' => 'Individual', 'first_name' => 'Foo', 'last_name' => 'Bear', 'check_permissions' => TRUE,); + $params = array('contact_type' => 'Individual', 'first_name' => 'Foo', 'last_name' => 'Bear', 'check_permissions' => TRUE); $result = $this->callAPISuccess('contact', 'create', $params); $config = CRM_Core_Config::singleton(); - $params = array('id' => $result['id'], 'contact_type' => 'Individual', 'last_name' => 'Bar', 'check_permissions' => TRUE,); + $params = array('id' => $result['id'], 'contact_type' => 'Individual', 'last_name' => 'Bar', 'check_permissions' => TRUE); $config->userPermissionClass->permissions = array('access CiviCRM'); $result = $this->callAPIFailure('contact', 'update', $params); @@ -1840,7 +1846,7 @@ class api_v3_ContactTest extends CiviUnitTestCase { public function testReturnCityProfile () { $contactID = $this->individualCreate(); CRM_Core_Config::singleton()->defaultSearchProfileID = 1; - $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1,)); + $this->callAPISuccess('address', 'create', array('contact_id' => $contactID, 'city' => 'Cool City', 'location_type_id' => 1)); $result = $this->callAPISuccess('contact', 'get', array('city' => 'Cool City', 'return' => 'contact_type')); $this->assertEquals(1, $result['count']); } diff --git a/tests/phpunit/api/v3/ContactTypeTest.php b/tests/phpunit/api/v3/ContactTypeTest.php index 4bbf744033..fc068c3b39 100644 --- a/tests/phpunit/api/v3/ContactTypeTest.php +++ b/tests/phpunit/api/v3/ContactTypeTest.php @@ -302,7 +302,6 @@ class api_v3_ContactTypeTest extends CiviUnitTestCase { $this->assertEquals(end($result['contact_sub_type']), $updateParams['contact_sub_type'], "In line " . __LINE__); $this->callAPISuccess('contact', 'delete', $params); - $params = array( 'label' => 'sub2_organization', 'name' => 'sub2_organization', diff --git a/tests/phpunit/api/v3/ContributionPageTest.php b/tests/phpunit/api/v3/ContributionPageTest.php index a73de2517f..12c05dbf85 100644 --- a/tests/phpunit/api/v3/ContributionPageTest.php +++ b/tests/phpunit/api/v3/ContributionPageTest.php @@ -31,8 +31,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_contribute_recur* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Contribution + * @package CiviCRM_APIv3 + * @subpackage API_Contribution */ class api_v3_ContributionPageTest extends CiviUnitTestCase { @@ -42,7 +42,7 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase { protected $id = 0; protected $contactIds = array(); protected $_entity = 'contribution_page'; - protected $contribution_result = null; + protected $contribution_result = NULL; protected $_priceSetParams = array(); /** * Payment processor details @@ -211,7 +211,7 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase { ); $this->callAPIAndDocument('contribution_page', 'submit', $submitParams, __FUNCTION__, __FILE__, 'submit contribution page', NULL, 'Submit'); - $contributions = $this->callAPISuccess('contribution', 'get', array('contribution_page_id' => $this->_ids['contribution_page'],)); + $contributions = $this->callAPISuccess('contribution', 'get', array('contribution_page_id' => $this->_ids['contribution_page'])); $this->assertCount(2, $contributions['values']); $ids = array_keys($contributions['values']); $this->assertEquals('10.00', $contributions['values'][$ids[0]]['total_amount']); @@ -264,7 +264,7 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase { $this->params['recur_frequency_unit'] = 'month'; $this->setUpMembershipContributionPage(); $dummyPP = CRM_Core_Payment::singleton('live', $this->_paymentProcessor); - $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 1, 'trxn_id' => 'create_first_success',)); + $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 1, 'trxn_id' => 'create_first_success')); $submitParams = array( 'price_' . $this->_ids['price_field'][0] => reset($this->_ids['price_field_value']), @@ -297,7 +297,7 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase { //$this->callAPISuccess('line_item', 'getsingle', array('contribution_id' => $contribution['id'], 'entity_id' => $membership['id'])); //renew it with processor setting completed - should extend membership $submitParams['contact_id'] = $contribution['contact_id']; - $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 1, 'trxn_id' => 'create_second_success',)); + $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 1, 'trxn_id' => 'create_second_success')); $this->callAPISuccess('contribution_page', 'submit', $submitParams); $this->callAPISuccess('contribution', 'getsingle', array('id' => array('NOT IN' => array($contribution['id'])), 'contribution_page_id' => $this->_ids['contribution_page'], 'contribution_status_id' => 1)); $renewedMembership = $this->callAPISuccessGetSingle('membership', array('id' => $membershipPayment['membership_id'])); @@ -319,7 +319,7 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase { $this->params['recur_frequency_unit'] = 'month'; $this->setUpMembershipContributionPage(); $dummyPP = CRM_Core_Payment::singleton('live', $this->_paymentProcessor); - $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 2,)); + $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 2)); $submitParams = array( 'price_' . $this->_ids['price_field'][0] => reset($this->_ids['price_field_value']), @@ -358,10 +358,12 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase { 'frequency_interval' => 1, 'frequency_unit' => 'month',) ); - $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 2,)); + $dummyPP->setDoDirectPaymentResult(array('contribution_status_id' => 2)); $this->callAPISuccess('contribution_page', 'submit', $submitParams); - $newContribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => array( - 'NOT IN' => array($contribution['id'])), 'contribution_page_id' => $this->_ids['contribution_page'], 'contribution_status_id' => 2) + $newContribution = $this->callAPISuccess('contribution', 'getsingle', array( + 'id' => array( + 'NOT IN' => array($contribution['id'])), 'contribution_page_id' => $this->_ids['contribution_page'], + 'contribution_status_id' => 2) ); $renewedMembership = $this->callAPISuccessGetSingle('membership', array('id' => $membershipPayment['membership_id'])); @@ -467,7 +469,7 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase { } public static function setUpBeforeClass() { - // put stuff here that should happen before all tests in this unit + // put stuff here that should happen before all tests in this unit } public static function tearDownAfterClass(){ diff --git a/tests/phpunit/api/v3/ContributionRecurTest.php b/tests/phpunit/api/v3/ContributionRecurTest.php index 3fcd39b358..8676533e19 100644 --- a/tests/phpunit/api/v3/ContributionRecurTest.php +++ b/tests/phpunit/api/v3/ContributionRecurTest.php @@ -31,8 +31,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_contribute_recur* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Contribution + * @package CiviCRM_APIv3 + * @subpackage API_Contribution */ @@ -80,8 +80,7 @@ class api_v3_ContributionRecurTest extends CiviUnitTestCase { $result = $this->callAPISuccess($this->_entity, 'create', $this->params); $deleteParams = array('id' => $result['id']); $result = $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__); - $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array( - )); + $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array()); $this->assertEquals(0, $checkDeleted['count']); } diff --git a/tests/phpunit/api/v3/ContributionSoftTest.php b/tests/phpunit/api/v3/ContributionSoftTest.php index 92af8cdb01..bb208a7633 100644 --- a/tests/phpunit/api/v3/ContributionSoftTest.php +++ b/tests/phpunit/api/v3/ContributionSoftTest.php @@ -30,8 +30,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_contribute_* functions * - * @package CiviCRM_APIv3 - * @subpackage API_ContributionSoft + * @package CiviCRM_APIv3 + * @subpackage API_ContributionSoft */ class api_v3_ContributionSoftTest extends CiviUnitTestCase { @@ -112,29 +112,29 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase { //create a second soft contribution on the same hard contribution - we are testing that 'id' gets the right soft contribution id (not the contribution id) $p['contact_id'] = $this->_softIndividual2Id; - $this->_softcontribution2 = $this->callAPISuccess('contribution_soft', 'create', $p); + $this->_softcontribution2 = $this->callAPISuccess('contribution_soft', 'create', $p); // now we have 2 - test getcount - $softcontribution = $this->callAPISuccess('contribution_soft', 'getcount', array()); + $softcontribution = $this->callAPISuccess('contribution_soft', 'getcount', array()); $this->assertEquals(2, $softcontribution); //check first contribution - $result = $this->callAPISuccess('contribution_soft', 'get', array( + $result = $this->callAPISuccess('contribution_soft', 'get', array( 'id' => $this->_softcontribution['id'], )); $this->assertEquals(1, $result['count'], 'In line ' . __LINE__); $this->assertEquals($this->_softcontribution['id'], $result['id']); - $this->assertEquals($this->_softcontribution['id'], $result['id'], print_r($softcontribution,true)); + $this->assertEquals($this->_softcontribution['id'], $result['id'], print_r($softcontribution, TRUE)); //test id only format - second soft credit - $resultID2 = $this->callAPISuccess('contribution_soft', 'get', array( + $resultID2 = $this->callAPISuccess('contribution_soft', 'get', array( 'id' => $this->_softcontribution2['id'], 'format.only_id' => 1, )); $this->assertEquals($this->_softcontribution2['id'], $resultID2); //test get by contact id works - $result = $this->callAPISuccess('contribution_soft', 'get', array( + $result = $this->callAPISuccess('contribution_soft', 'get', array( 'contact_id' => $this->_softIndividual2Id) ); $this->assertEquals(1, $result['count'], 'In line ' . __LINE__); @@ -248,7 +248,7 @@ class api_v3_ContributionSoftTest extends CiviUnitTestCase { $this->assertEquals($old_contact_id, $this->_softIndividual1Id, 'In line ' . __LINE__); $this->assertEquals($old_amount, 10.00, 'In line ' . __LINE__); $this->assertEquals($old_currency, 'USD', 'In line ' . __LINE__); - $this->assertEquals($old_soft_credit_type_id, 6 , 'In line ' . __LINE__); + $this->assertEquals($old_soft_credit_type_id, 6, 'In line ' . __LINE__); $params = array( 'id' => $softcontributionID, 'contribution_id' => $this->_contributionId, diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index 1c5cf79567..9adb5138cf 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -32,8 +32,8 @@ require_once 'CiviTest/CiviMailUtils.php'; /** * Test APIv3 civicrm_contribute_* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Contribution + * @package CiviCRM_APIv3 + * @subpackage API_Contribution */ class api_v3_ContributionTest extends CiviUnitTestCase { @@ -118,7 +118,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $contribution = $this->callAPIAndDocument('contribution', 'get', $params, __FUNCTION__, __FILE__); $financialParams['id'] = $this->_financialTypeId; - $default = null; + $default = NULL; CRM_Financial_BAO_FinancialType::retrieve($financialParams, $default); $this->assertEquals(1, $contribution['count']); @@ -148,7 +148,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { 'id' => $this->_contribution['id'], 'format.only_id' => 1, )); - $this->assertEquals($this->_contribution['id'], $contribution, print_r($contribution,true) . " in line " . __LINE__); + $this->assertEquals($this->_contribution['id'], $contribution, print_r($contribution, TRUE) . " in line " . __LINE__); //test id only format $contribution = $this->callAPISuccess('contribution', 'get', array( 'id' => $contribution2['id'], @@ -173,9 +173,9 @@ class api_v3_ContributionTest extends CiviUnitTestCase { )); } -/** - * We need to ensure previous tested behaviour still works as part of the api contract - */ + /** + * We need to ensure previous tested behaviour still works as part of the api contract + */ public function testGetContributionLegacyBehaviour() { $p = array( 'contact_id' => $this->_individualId, @@ -197,10 +197,10 @@ class api_v3_ContributionTest extends CiviUnitTestCase { ); $contribution = $this->callAPIAndDocument('contribution', 'get', $params, __FUNCTION__, __FILE__); $financialParams['id'] = $this->_financialTypeId; - $default = null; + $default = NULL; CRM_Financial_BAO_FinancialType::retrieve($financialParams, $default); - $this->assertEquals(1,$contribution['count']); + $this->assertEquals(1, $contribution['count']); $this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId); $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->_financialTypeId); $this->assertEquals($contribution['values'][$contribution['id']]['contribution_type_id'], $this->_financialTypeId); @@ -226,7 +226,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { 'id' => $this->_contribution['id'], 'format.only_id' => 1, )); - $this->assertEquals($this->_contribution['id'], $contribution, print_r($contribution,true) . " in line " . __LINE__); + $this->assertEquals($this->_contribution['id'], $contribution, print_r($contribution, TRUE) . " in line " . __LINE__); //test id only format $contribution = $this->callAPISuccess('contribution', 'get', array( 'id' => $contribution2['id'], @@ -256,11 +256,11 @@ class api_v3_ContributionTest extends CiviUnitTestCase { 'contribution_id' => FALSE, 'contact_id' => 1, 'total_amount' => 1, - 'check_permissions' => false, + 'check_permissions' => FALSE, 'financial_type_id' => 'Donation', ); $this->callAPISuccess('contribution', 'create', $params); - } + } /* * ensure we continue to support contribution_type_id as part of the api commitment to * stability @@ -271,7 +271,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { 'contribution_id' => FALSE, 'contact_id' => 1, 'total_amount' => 1, - 'check_permissions' => false, + 'check_permissions' => FALSE, 'contribution_type_id' => 3, ); $contribution = $this->callAPISuccess('contribution', 'create', $params); @@ -291,7 +291,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $params = $this->_params; $params['custom_' . $ids['custom_field_id']] = "custom string"; - $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__); + $result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__); $this->assertEquals($result['id'], $result['values'][$result['id']]['id']); $check = $this->callAPISuccess($this->_entity, 'get', array( 'return.custom_' . $ids['custom_field_id'] => 1, @@ -339,7 +339,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { ); $contribution = $this->callAPISuccess('contribution', 'create', $params); - $lineItems = $this->callAPISuccess('line_item','get',array( + $lineItems = $this->callAPISuccess('line_item', 'get', array( 'entity_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution', 'sequential' => 1, @@ -383,9 +383,9 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $description = "Create Contribution with Nested Line Items"; $subfile = "CreateWithNestedLineItems"; - $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__,__FILE__, $description, $subfile); + $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile); - $lineItems = $this->callAPISuccess('line_item','get',array( + $lineItems = $this->callAPISuccess('line_item', 'get', array( 'entity_id' => $contribution['id'], 'contribution_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution', @@ -409,12 +409,12 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__); $this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId); $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00); - $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],1 ); + $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], 1 ); $this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345); $this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890); $this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF'); $this->assertEquals($contribution['values'][$contribution['id']]['contribution_status_id'], 1); - $lineItems = $this->callAPISuccess('line_item','get',array( + $lineItems = $this->callAPISuccess('line_item', 'get', array( 'entity_id' => $contribution['id'], 'contribution_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution', @@ -432,7 +432,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { public function testCreateContributionWithPaymentInstrument() { $params = $this->_params + array('payment_instrument' => 'EFT'); $contribution = $this->callAPISuccess('contribution', 'create', $params); - $contribution = $this->callAPISuccess('contribution','get', array( + $contribution = $this->callAPISuccess('contribution', 'get', array( 'sequential' => 1, 'id' => $contribution['id'] )); @@ -440,7 +440,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->assertEquals('EFT', $contribution['values'][0]['payment_instrument']); $this->callAPISuccess('contribution', 'create', array('id' => $contribution['id'], 'payment_instrument' => 'Credit Card')); - $contribution = $this->callAPISuccess('contribution','get', array( + $contribution = $this->callAPISuccess('contribution', 'get', array( 'sequential' => 1, 'id' => $contribution['id'] )); @@ -451,29 +451,29 @@ class api_v3_ContributionTest extends CiviUnitTestCase { public function testGetContributionByPaymentInstrument() { $params = $this->_params + array('payment_instrument' => 'EFT'); $params2 = $this->_params + array('payment_instrument' => 'Cash'); - $this->callAPISuccess('contribution','create',$params); - $this->callAPISuccess('contribution','create',$params2); - $contribution = $this->callAPISuccess('contribution','get',array( 'sequential' => 1, 'contribution_payment_instrument_id' => 'Cash')); + $this->callAPISuccess('contribution', 'create', $params); + $this->callAPISuccess('contribution', 'create', $params2); + $contribution = $this->callAPISuccess('contribution', 'get', array( 'sequential' => 1, 'contribution_payment_instrument_id' => 'Cash')); $this->assertArrayHasKey('payment_instrument', $contribution['values'][0]); - $this->assertEquals('Cash',$contribution['values'][0]['payment_instrument']); - $this->assertEquals(1,$contribution['count']); - $contribution = $this->callAPISuccess('contribution','get',array('sequential' => 1, 'payment_instrument_id' => 'EFT')); + $this->assertEquals('Cash', $contribution['values'][0]['payment_instrument']); + $this->assertEquals(1, $contribution['count']); + $contribution = $this->callAPISuccess('contribution', 'get', array('sequential' => 1, 'payment_instrument_id' => 'EFT')); $this->assertArrayHasKey('payment_instrument', $contribution['values'][0]); - $this->assertEquals('EFT',$contribution['values'][0]['payment_instrument']); + $this->assertEquals('EFT', $contribution['values'][0]['payment_instrument']); $this->assertEquals(1, $contribution['count']); - $contribution = $this->callAPISuccess('contribution','get',array( 'sequential' => 1, 'payment_instrument_id' => 5)); + $contribution = $this->callAPISuccess('contribution', 'get', array( 'sequential' => 1, 'payment_instrument_id' => 5)); $this->assertArrayHasKey('payment_instrument', $contribution['values'][0]); - $this->assertEquals('EFT',$contribution['values'][0]['payment_instrument']); - $this->assertEquals(1,$contribution['count']); - $contribution = $this->callAPISuccess('contribution','get',array( 'sequential' => 1, 'payment_instrument' => 'EFT')); + $this->assertEquals('EFT', $contribution['values'][0]['payment_instrument']); + $this->assertEquals(1, $contribution['count']); + $contribution = $this->callAPISuccess('contribution', 'get', array( 'sequential' => 1, 'payment_instrument' => 'EFT')); $this->assertArrayHasKey('payment_instrument', $contribution['values'][0]); $this->assertEquals('EFT', $contribution['values'][0]['payment_instrument']); $this->assertEquals(1, $contribution['count']); $contribution = $this->callAPISuccess('contribution', 'create', array('id' => $contribution['id'], 'payment_instrument' => 'Credit Card')); - $contribution = $this->callAPISuccess('contribution','get',array( 'sequential' => 1, 'id' => $contribution['id'], )); + $contribution = $this->callAPISuccess('contribution', 'get', array( 'sequential' => 1, 'id' => $contribution['id'] )); $this->assertArrayHasKey('payment_instrument', $contribution['values'][0]); - $this->assertEquals('Credit Card',$contribution['values'][0]['payment_instrument']); - $this->assertEquals(1,$contribution['count']); + $this->assertEquals('Credit Card', $contribution['values'][0]['payment_instrument']); + $this->assertEquals(1, $contribution['count']); } /** @@ -616,7 +616,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $description = "Demonstrates creating contribution with SoftCredit"; $subfile = "ContributionCreateWithSoftCredit"; $contact2 = $this->callAPISuccess('Contact', 'create', array('display_name' => 'superman', 'contact_type' => 'Individual')); - $softparams = array( + $softparams = array( 'contact_id' => $contact2['id'], 'amount' => 50, 'soft_credit_type_id' => 3 @@ -624,7 +624,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $params = $this->_params + array('soft_credit' => array(1 => $softparams)); $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile); - $result = $this->callAPISuccess('contribution','get', array('return'=> 'soft_credit', 'sequential' => 1)); + $result = $this->callAPISuccess('contribution', 'get', array('return' => 'soft_credit', 'sequential' => 1)); $this->assertEquals($softparams['contact_id'], $result['values'][0]['soft_credit'][1]['contact_id']); $this->assertEquals($softparams['amount'], $result['values'][0]['soft_credit'][1]['amount']); @@ -642,7 +642,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { 'soft_credit_to' => $contact2['id'], ); $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile); - $result = $this->callAPISuccess('contribution','get', array('return'=> 'soft_credit', 'sequential' => 1)); + $result = $this->callAPISuccess('contribution', 'get', array('return' => 'soft_credit', 'sequential' => 1)); $this->assertEquals($contact2['id'], $result['values'][0]['soft_credit'][1]['contact_id']); // Default soft credit amount = contribution.total_amount @@ -661,7 +661,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { 'honor_contact_id' => $contact2['id'], ); $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile); - $result = $this->callAPISuccess('contribution','get', array('return'=> 'soft_credit', 'sequential' => 1)); + $result = $this->callAPISuccess('contribution', 'get', array('return' => 'soft_credit', 'sequential' => 1)); $this->assertEquals($contact2['id'], $result['values'][0]['soft_credit'][1]['contact_id']); // Default soft credit amount = contribution.total_amount @@ -710,13 +710,13 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00); $this->assertEquals($contribution['values'][$contribution['id']]['fee_amount'], 50.00); $this->assertEquals($contribution['values'][$contribution['id']]['net_amount'], 50.00); - $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],1 ); + $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], 1 ); $this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345); $this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890); $this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF'); $this->assertEquals($contribution['values'][$contribution['id']]['contribution_status_id'], 1); - $lineItems = $this->callAPISuccess('line_item','get',array( + $lineItems = $this->callAPISuccess('line_item', 'get', array( 'entity_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution', @@ -725,7 +725,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->assertEquals(1, $lineItems['count']); $this->assertEquals($contribution['id'], $lineItems['values'][0]['entity_id']); $this->assertEquals($contribution['id'], $lineItems['values'][0]['contribution_id']); - $lineItems = $this->callAPISuccess('line_item','get',array( + $lineItems = $this->callAPISuccess('line_item', 'get', array( 'entity_id' => $contribution['id'], 'contribution_id' => $contribution['id'], @@ -742,7 +742,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { */ public function testCreateContributionOnline() { CRM_Financial_BAO_PaymentProcessor::create($this->_processorParams); - $contributionPage = $this->callAPISuccess( 'contribution_page','create', $this->_pageParams ); + $contributionPage = $this->callAPISuccess( 'contribution_page', 'create', $this->_pageParams ); $this->assertAPISuccess($contributionPage); $params = array( 'contact_id' => $this->_individualId, @@ -761,7 +761,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__); $this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId); $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00); - $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],1 ); + $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], 1 ); $this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345); $this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890); $this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF'); @@ -796,7 +796,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { public function testCreateContributionPayLaterOnline() { CRM_Financial_BAO_PaymentProcessor::create($this->_processorParams); $this->_pageParams['is_pay_later'] = 1; - $contributionPage = $this->callAPISuccess( 'contribution_page','create',$this->_pageParams ); + $contributionPage = $this->callAPISuccess( 'contribution_page', 'create', $this->_pageParams ); $this->assertAPISuccess($contributionPage); $params = array( 'contact_id' => $this->_individualId, @@ -815,7 +815,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__); $this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId); $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00); - $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],1 ); + $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], 1 ); $this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345); $this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890); $this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF'); @@ -846,7 +846,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__); $this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId); $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00); - $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],1 ); + $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], 1 ); $this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345); $this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890); $this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF'); @@ -870,7 +870,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { */ public function testCreateUpdateContributionChangeTotal() { $contribution = $this->callAPISuccess('contribution', 'create', $this->_params); - $lineItems = $this->callAPISuccess('line_item','getvalue', array( + $lineItems = $this->callAPISuccess('line_item', 'getvalue', array( 'entity_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution', @@ -887,7 +887,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { 'total_amount' => '125'); $contribution = $this->callAPISuccess('contribution', 'create', $newParams); - $lineItems = $this->callAPISuccess('line_item','getvalue',array( + $lineItems = $this->callAPISuccess('line_item', 'getvalue', array( 'entity_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution', @@ -925,7 +925,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { ); $contribution = $this->callAPISuccess('contribution', 'create', $newParams); $contribution = $contribution['values'][$contribution['id']]; - $this->assertEquals($contribution['contribution_status_id'],'1'); + $this->assertEquals($contribution['contribution_status_id'], '1'); $this->_checkFinancialItem($contribution['id'], 'paylater'); $this->_checkFinancialTrxn($contribution, 'payLater'); } @@ -997,7 +997,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { 'contribution_status_id' => 2, ) ); - $this->callAPIFailure('contribution', 'create', $newParams,ts('Cannot change contribution status from Completed to Pending.')); + $this->callAPIFailure('contribution', 'create', $newParams, ts('Cannot change contribution status from Completed to Pending.')); } @@ -1111,7 +1111,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->assertEquals($contribution['values'][$contributionID]['contact_id'], $this->_individualId); $this->assertEquals($contribution['values'][$contributionID]['total_amount'], 110.00); - $this->assertEquals($contribution['values'][$contributionID]['financial_type_id'],$this->_financialTypeId ); + $this->assertEquals($contribution['values'][$contributionID]['financial_type_id'], $this->_financialTypeId ); $this->assertEquals($contribution['values'][$contributionID]['instrument_id'], $old_payment_instrument); $this->assertEquals($contribution['values'][$contributionID]['non_deductible_amount'], 10.00); $this->assertEquals($contribution['values'][$contributionID]['fee_amount'], $old_fee_amount); @@ -1258,14 +1258,14 @@ class api_v3_ContributionTest extends CiviUnitTestCase { * that person */ public function testCompleteTransaction() { - $mut = new CiviMailUtils( $this, true ); + $mut = new CiviMailUtils( $this, TRUE ); $this->createLoggedInUser(); - $params = array_merge($this->_params, array('contribution_status_id' => 2,)); - $contribution = $this->callAPISuccess('contribution','create', $params); + $params = array_merge($this->_params, array('contribution_status_id' => 2)); + $contribution = $this->callAPISuccess('contribution', 'create', $params); $this->callAPISuccess('contribution', 'completetransaction', array( 'id' => $contribution['id'], )); - $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id'], 'sequential' => 1,)); + $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id'], 'sequential' => 1)); $this->assertEquals('Completed', $contribution['values'][0]['contribution_status']); $mut->checkMailLog(array( 'Receipt - Contribution', @@ -1281,12 +1281,12 @@ class api_v3_ContributionTest extends CiviUnitTestCase { * tests. */ public function testCompleteTransactionWithReceiptDateSet() { - $mut = new CiviMailUtils( $this, true ); + $mut = new CiviMailUtils( $this, TRUE ); $this->createLoggedInUser(); - $params = array_merge($this->_params, array('contribution_status_id' => 2,'receipt_date' => 'now')); - $contribution = $this->callAPISuccess('contribution','create', $params); - $this->callAPISuccess('contribution', 'completetransaction', array('id' => $contribution['id'],)); - $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id'], 'sequential' => 1,)); + $params = array_merge($this->_params, array('contribution_status_id' => 2, 'receipt_date' => 'now')); + $contribution = $this->callAPISuccess('contribution', 'create', $params); + $this->callAPISuccess('contribution', 'completetransaction', array('id' => $contribution['id'])); + $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id'], 'sequential' => 1)); $this->assertEquals('Completed', $contribution['values'][0]['contribution_status']); $mut->checkMailLog(array( 'Receipt - Contribution', @@ -1302,7 +1302,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { * that person */ public function testCompleteTransactionWithParticipantRecord() { - $mut = new CiviMailUtils( $this, true ); + $mut = new CiviMailUtils( $this, TRUE ); $mut->clearMessages(); $this->createLoggedInUser(); $contributionID = $this->createPendingParticipantContribution(); @@ -1325,7 +1325,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { public function testCompleteTransactionMembershipPriceSet() { $this->createPriceSetWithPage('membership'); $this->setUpPendingContribution($this->_ids['price_field_value'][0]); - $this->callAPISuccess('contribution', 'completetransaction', array('id' => $this->_ids['contribution'])); + $this->callAPISuccess('contribution', 'completetransaction', array('id' => $this->_ids['contribution'])); $membership = $this->callAPISuccess('membership', 'getsingle', array('id' => $this->_ids['membership'])); $this->assertEquals(date('Y-m-d', strtotime('yesterday + 1 year')), $membership['end_date']); $this->cleanUpAfterPriceSets(); @@ -1337,7 +1337,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { public function testCompleteTransactionMembershipPriceSetTwoTerms() { $this->createPriceSetWithPage('membership'); $this->setUpPendingContribution($this->_ids['price_field_value'][1]); - $this->callAPISuccess('contribution', 'completetransaction', array('id' => $this->_ids['contribution'])); + $this->callAPISuccess('contribution', 'completetransaction', array('id' => $this->_ids['contribution'])); $membership = $this->callAPISuccess('membership', 'getsingle', array('id' => $this->_ids['membership'])); $this->assertEquals(date('Y-m-d', strtotime('yesterday + 2 years')), $membership['end_date']); $this->cleanUpAfterPriceSets(); @@ -1456,8 +1456,8 @@ class api_v3_ContributionTest extends CiviUnitTestCase { * Test sending a mail via the API */ public function testSendMail() { - $mut = new CiviMailUtils( $this, true ); - $contribution = $this->callAPISuccess('contribution','create',$this->_params); + $mut = new CiviMailUtils( $this, TRUE ); + $contribution = $this->callAPISuccess('contribution', 'create', $this->_params); $this->callAPISuccess('contribution', 'sendconfirmation', array( 'id' => $contribution['id'], 'receipt_from_email' => 'api@civicrm.org', @@ -1478,8 +1478,8 @@ class api_v3_ContributionTest extends CiviUnitTestCase { * Test sending a mail via the API */ public function testSendMailEvent() { - $mut = new CiviMailUtils( $this, true ); - $contribution = $this->callAPISuccess('contribution','create',$this->_params); + $mut = new CiviMailUtils( $this, TRUE ); + $contribution = $this->callAPISuccess('contribution', 'create', $this->_params); $event = $this->eventCreate(array( 'is_email_confirm' => 1, 'confirm_from_email' => 'test@civicrm.org', @@ -1510,17 +1510,15 @@ class api_v3_ContributionTest extends CiviUnitTestCase { 'Annual CiviCRM meet', 'Event', 'To: "Mr. Anthony Anderson II" ', - ), array( - - ) + ), array() ); $mut->stop(); } /** - * This function does a GET & compares the result against the $params - * Use as a double check on Creates - */ + * This function does a GET & compares the result against the $params + * Use as a double check on Creates + */ public function contributionGetnCheck($params, $id, $delete = 1) { $contribution = $this->callAPISuccess('Contribution', 'Get', array( @@ -1548,11 +1546,11 @@ class api_v3_ContributionTest extends CiviUnitTestCase { * (along with an event) */ public function createPendingParticipantContribution(){ - $event = $this->eventCreate(array('is_email_confirm' => 1, 'confirm_from_email' => 'test@civicrm.org',)); + $event = $this->eventCreate(array('is_email_confirm' => 1, 'confirm_from_email' => 'test@civicrm.org')); $participantID = $this->participantCreate(array('event_id' => $event['id'], 'status_id' => 6)); $this->_ids['participant'] = $participantID; $params = array_merge($this->_params, array('contribution_status_id' => 2, 'financial_type_id' => 'Event Fee')); - $contribution = $this->callAPISuccess('contribution','create', $params); + $contribution = $this->callAPISuccess('contribution', 'create', $params); $this->callAPISuccess('participant_payment', 'create', array('contribution_id' => $contribution['id'], 'participant_id' => $participantID)); $this->callAPISuccess('line_item', 'get', array( 'entity_id' => $contribution['id'], @@ -1571,16 +1569,16 @@ class api_v3_ContributionTest extends CiviUnitTestCase { * @return null|string */ function _getFinancialTrxnAmount($contId) { - $query = "SELECT + $query = "SELECT SUM( ft.total_amount ) AS total FROM civicrm_financial_trxn AS ft LEFT JOIN civicrm_entity_financial_trxn AS ceft ON ft.id = ceft.financial_trxn_id WHERE ceft.entity_table = 'civicrm_contribution' AND ceft.entity_id = {$contId}"; - $result = CRM_Core_DAO::singleValueQuery($query); - return $result; - } + $result = CRM_Core_DAO::singleValueQuery($query); + return $result; + } /** * @param int $contId @@ -1588,83 +1586,83 @@ class api_v3_ContributionTest extends CiviUnitTestCase { * @return null|string */ function _getFinancialItemAmount($contId) { - $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); - $query = "SELECT + $lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); + $query = "SELECT SUM(amount) FROM civicrm_financial_item WHERE entity_table = 'civicrm_line_item' AND entity_id = {$lineItem}"; - $result = CRM_Core_DAO::singleValueQuery($query); - return $result; - } + $result = CRM_Core_DAO::singleValueQuery($query); + return $result; + } /** * @param int $contId * @param $context */ public function _checkFinancialItem($contId, $context) { - if ($context != 'paylater') { - $params = array ( - 'entity_id' => $contId, + if ($context != 'paylater') { + $params = array( + 'entity_id' => $contId, 'entity_table' => 'civicrm_contribution', - ); - $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($params, TRUE)); - $entityParams = array( + ); + $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($params, TRUE)); + $entityParams = array( 'financial_trxn_id' => $trxn['financial_trxn_id'], 'entity_table' => 'civicrm_financial_item', - ); - $entityTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams)); - $params = array( + ); + $entityTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams)); + $params = array( 'id' => $entityTrxn['entity_id'], - ); - } - if ($context == 'paylater') { - $lineItems = CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'); - foreach ($lineItems as $key=>$item) { - $params = array( + ); + } + if ($context == 'paylater') { + $lineItems = CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'); + foreach ($lineItems as $key => $item) { + $params = array( 'entity_id' => $key, 'entity_table' => 'civicrm_line_item', - ); - $compareParams = array ('status_id' => 1); - $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $params, $compareParams); - } - } - elseif ($context == 'refund') { - $compareParams = array( + ); + $compareParams = array('status_id' => 1); + $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $params, $compareParams); + } + } + elseif ($context == 'refund') { + $compareParams = array( 'status_id' => 1, 'financial_account_id' => 1, 'amount' => -100, - ); - } - elseif ($context == 'cancelPending') { - $compareParams = array( + ); + } + elseif ($context == 'cancelPending') { + $compareParams = array( 'status_id' => 3, 'financial_account_id' => 1, 'amount' => -100, - ); - } - elseif ($context == 'changeFinancial') { - $lineKey = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); - $params = array( + ); + } + elseif ($context == 'changeFinancial') { + $lineKey = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution')); + $params = array( 'entity_id' => $lineKey, 'amount' => -100, - ); - $compareParams = array( + ); + $compareParams = array( 'financial_account_id' => 1, - ); - $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $params, $compareParams); - $params = array( + ); + $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $params, $compareParams); + $params = array( 'financial_account_id' => 3, 'entity_id' => $lineKey, - ); - $compareParams = array( + ); + $compareParams = array( 'amount' => 100, - ); - } - if ($context != 'paylater') { - $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $params, $compareParams); - } - } + ); + } + if ($context != 'paylater') { + $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $params, $compareParams); + } + } /** * @param $contribution @@ -1672,191 +1670,191 @@ class api_v3_ContributionTest extends CiviUnitTestCase { * @param int $instrumentId */ public function _checkFinancialTrxn($contribution, $context, $instrumentId = NULL) { - $trxnParams = array( - 'entity_id' => $contribution['id'], + $trxnParams = array( + 'entity_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution', - ); - $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($trxnParams, TRUE)); - $params = array( + ); + $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($trxnParams, TRUE)); + $params = array( 'id' => $trxn['financial_trxn_id'], - ); - if ($context == 'payLater') { - $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' ")); - $compareParams = array( + ); + if ($context == 'payLater') { + $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' ")); + $compareParams = array( 'status_id' => 1, 'from_financial_account_id' => CRM_Contribute_PseudoConstant::financialAccountType($contribution['financial_type_id'], $relationTypeId), - ); - } - elseif ($context == 'refund') { - $compareParams = array( + ); + } + elseif ($context == 'refund') { + $compareParams = array( 'to_financial_account_id' => 6, 'total_amount' => -100, 'status_id' => 7, - ); - } - elseif ($context == 'cancelPending') { - $compareParams = array( + ); + } + elseif ($context == 'cancelPending') { + $compareParams = array( 'from_financial_account_id' => 7, 'total_amount' => -100, 'status_id' => 3, - ); - } - elseif ($context == 'changeFinancial' || $context == 'paymentInstrument') { - $entityParams = array( - 'entity_id' => $contribution['id'], + ); + } + elseif ($context == 'changeFinancial' || $context == 'paymentInstrument') { + $entityParams = array( + 'entity_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution', 'amount' => -100, - ); - $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams)); - $trxnParams1 = array( + ); + $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams)); + $trxnParams1 = array( 'id' => $trxn['financial_trxn_id'], - ); - $compareParams = array( + ); + $compareParams = array( 'total_amount' => -100, 'status_id' => 1, - ); - if ($context == 'paymentInstrument') { - $compareParams += array( + ); + if ($context == 'paymentInstrument') { + $compareParams += array( 'to_financial_account_id' => CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount(4), 'payment_instrument_id' => 4, - ); - } - else { - $compareParams['to_financial_account_id'] = 12; - } - $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams1, $compareParams); - $compareParams['total_amount'] = 100; - if ($context == 'paymentInstrument') { - $compareParams['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($instrumentId); - $compareParams['payment_instrument_id'] = $instrumentId; - } - else { - $compareParams['to_financial_account_id'] = 12; - } - } - - $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $params, $compareParams); - } + ); + } + else { + $compareParams['to_financial_account_id'] = 12; + } + $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams1, $compareParams); + $compareParams['total_amount'] = 100; + if ($context == 'paymentInstrument') { + $compareParams['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($instrumentId); + $compareParams['payment_instrument_id'] = $instrumentId; + } + else { + $compareParams['to_financial_account_id'] = 12; + } + } + + $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $params, $compareParams); + } /** * @return mixed */ public function _addPaymentInstrument () { - $gId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'payment_instrument', 'id', 'name'); - $optionParams = array( + $gId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'payment_instrument', 'id', 'name'); + $optionParams = array( 'option_group_id' => $gId, 'label' => 'Test Card', 'name' => 'Test Card', 'value' => '6', 'weight' => '6', 'is_active' => 1, -); - $optionValue = $this->callAPISuccess('option_value', 'create', $optionParams); - $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' ")); - $financialParams = array( + ); + $optionValue = $this->callAPISuccess('option_value', 'create', $optionParams); + $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' ")); + $financialParams = array( 'entity_table' => 'civicrm_option_value', 'entity_id' => $optionValue['id'], 'account_relationship' => $relationTypeId, 'financial_account_id' => 7, - ); - CRM_Financial_BAO_FinancialTypeAccount::add($financialParams, CRM_Core_DAO::$_nullArray); - $this->assertNotEmpty($optionValue['values'][$optionValue['id']]['value']); - return $optionValue['values'][$optionValue['id']]['value']; - } + ); + CRM_Financial_BAO_FinancialTypeAccount::add($financialParams, CRM_Core_DAO::$_nullArray); + $this->assertNotEmpty($optionValue['values'][$optionValue['id']]['value']); + return $optionValue['values'][$optionValue['id']]['value']; + } /** * @param array $params * @param $context */ - public function _checkFinancialRecords($params,$context) { - $entityParams = array( + public function _checkFinancialRecords($params, $context) { + $entityParams = array( 'entity_id' => $params['id'], 'entity_table' => 'civicrm_contribution', - ); + ); $contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $params['id'])); $this->assertEquals($contribution['total_amount'] - $contribution['fee_amount'], $contribution['net_amount']); - if ($context == 'pending') { - $trxn = CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams); - $this->assertNull($trxn, 'No Trxn to be created until IPN callback'); - return; - } - $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams)); - $trxnParams = array( + if ($context == 'pending') { + $trxn = CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams); + $this->assertNull($trxn, 'No Trxn to be created until IPN callback'); + return; + } + $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams)); + $trxnParams = array( 'id' => $trxn['financial_trxn_id'], - ); - if ($context != 'online' && $context != 'payLater') { - $compareParams = array( + ); + if ($context != 'online' && $context != 'payLater') { + $compareParams = array( 'to_financial_account_id' => 6, 'total_amount' => 100, 'status_id' => 1, - ); - } - if ($context == 'feeAmount') { - $compareParams['fee_amount'] = 50; - } - elseif ($context == 'online') { - $compareParams = array( + ); + } + if ($context == 'feeAmount') { + $compareParams['fee_amount'] = 50; + } + elseif ($context == 'online') { + $compareParams = array( 'to_financial_account_id' => 12, 'total_amount' => 100, 'status_id' => 1, - ); - } - elseif ($context == 'payLater') { - $compareParams = array( + ); + } + elseif ($context == 'payLater') { + $compareParams = array( 'to_financial_account_id' => 7, 'total_amount' => 100, 'status_id' => 2, - ); - } - $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn',$trxnParams, $compareParams); - $entityParams = array( + ); + } + $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams, $compareParams); + $entityParams = array( 'financial_trxn_id' => $trxn['financial_trxn_id'], 'entity_table' => 'civicrm_financial_item', - ); - $entityTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams)); - $fitemParams = array( + ); + $entityTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams)); + $fitemParams = array( 'id' => $entityTrxn['entity_id'], - ); - $compareParams = array( + ); + $compareParams = array( 'amount' => 100, 'status_id' => 1, 'financial_account_id' => 1, - ); - if ($context == 'payLater') { - $compareParams = array( + ); + if ($context == 'payLater') { + $compareParams = array( 'amount' => 100, 'status_id' => 3, 'financial_account_id' => 1, - ); - } - $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams); - if ($context == 'feeAmount') { - $maxParams = array( + ); + } + $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams); + if ($context == 'feeAmount') { + $maxParams = array( 'entity_id' => $params['id'], 'entity_table' => 'civicrm_contribution', - ); - $maxTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($maxParams, TRUE)); - $trxnParams = array( + ); + $maxTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($maxParams, TRUE)); + $trxnParams = array( 'id' => $maxTrxn['financial_trxn_id'], - ); - $compareParams = array( + ); + $compareParams = array( 'to_financial_account_id' => 5, 'from_financial_account_id' => 6, 'total_amount' => 50, 'status_id' => 1, - ); - $trxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['id'], 'DESC'); - $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams, $compareParams); - $fitemParams = array( + ); + $trxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['id'], 'DESC'); + $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams, $compareParams); + $fitemParams = array( 'entity_id' => $trxnId['financialTrxnId'], 'entity_table' => 'civicrm_financial_trxn', - ); - $compareParams = array( + ); + $compareParams = array( 'amount' => 50, 'status_id' => 1, 'financial_account_id' => 5, - ); - $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams); - } - } + ); + $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams); + } + } } diff --git a/tests/phpunit/api/v3/CountryTest.php b/tests/phpunit/api/v3/CountryTest.php index 8746e9eb4e..8fe01544d9 100644 --- a/tests/phpunit/api/v3/CountryTest.php +++ b/tests/phpunit/api/v3/CountryTest.php @@ -32,8 +32,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_country* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Contact + * @package CiviCRM_APIv3 + * @subpackage API_Contact */ class api_v3_CountryTest extends CiviUnitTestCase { protected $_apiversion; @@ -64,7 +64,7 @@ class api_v3_CountryTest extends CiviUnitTestCase { //create one $create = $this->callAPISuccess('country', 'create', $this->_params); - $result = $this->callAPIAndDocument('country', 'delete', array('id' => $create['id'],), __FUNCTION__, __FILE__); + $result = $this->callAPIAndDocument('country', 'delete', array('id' => $create['id']), __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count']); $get = $this->callAPISuccess('country', 'get', array( 'id' => $create['id'], @@ -92,7 +92,7 @@ class api_v3_CountryTest extends CiviUnitTestCase { public function testGet() { $country = $this->callAPISuccess('Country', 'create', $this->_params); $params = array( - 'iso_code' => $this->_params['iso_code'], + 'iso_code' => $this->_params['iso_code'], ); $result = $this->callAPIAndDocument('Country', 'Get', $params, __FUNCTION__, __FILE__); $this->assertEquals($country['values'][$country['id']]['name'], $result['values'][$country['id']]['name']); diff --git a/tests/phpunit/api/v3/CustomFieldTest.php b/tests/phpunit/api/v3/CustomFieldTest.php index cd6c664d27..2d79dd974a 100644 --- a/tests/phpunit/api/v3/CustomFieldTest.php +++ b/tests/phpunit/api/v3/CustomFieldTest.php @@ -34,7 +34,7 @@ require_once 'tests/phpunit/CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_create_custom_group * - * @package CiviCRM + * @package CiviCRM */ class api_v3_CustomFieldTest extends CiviUnitTestCase { protected $_apiversion; @@ -147,9 +147,9 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase { $n++; } } -/* - * Can't figure out the point of this? - */ + /* + * Can't figure out the point of this? + */ /** * @param array $params */ @@ -176,9 +176,7 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase { 'option_weight' => array( 1, 2), 'option_status' => array( 1, 1), )); -*/ - - + */ return $params; } @@ -244,7 +242,7 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase { $this->assertTrue(is_numeric($optionGroupID) && ($optionGroupID > 0)); $optionGroup = $this->callAPISuccess('option_group', 'getsingle', array( 'id' => $optionGroupID)); - $this->assertEquals($optionGroup['title'],'Country'); + $this->assertEquals($optionGroup['title'], 'Country'); $optionValueCount = $this->callAPISuccess('option_value', 'getcount', array( 'option_group_id' => $optionGroupID)); $this->assertEquals(0, $optionValueCount); @@ -276,7 +274,7 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase { 'return' => 'option_group_id', )); - $this->assertEquals($optionGroupID,3); + $this->assertEquals($optionGroupID, 3); } @@ -330,7 +328,8 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase { $customGroup = $this->customGroupCreate(array('extends' => 'Contact', 'title' => 'select_test_group')); $option_values = array( - array('weight' => 1, + array( + 'weight' => 1, 'label' => 'Label1', 'value' => 1, 'is_active' => 1, @@ -366,7 +365,7 @@ class api_v3_CustomFieldTest extends CiviUnitTestCase { ); $description = "Demonstrate retrieving metadata with custom field options"; $subfile = "GetFieldsOptions"; - $fields = $this->callAPIAndDocument('contact', 'getfields', $getFieldsParams, __FUNCTION__, 'ContactTest.php', $description,$subfile,'GetFields'); + $fields = $this->callAPIAndDocument('contact', 'getfields', $getFieldsParams, __FUNCTION__, 'ContactTest.php', $description, $subfile, 'GetFields'); $this->assertArrayHasKey('options', $fields['values']['custom_' . $customField['id']]); $this->assertEquals('Label1', $fields['values']['custom_' . $customField['id']]['options'][1]); $getOptionsArray = array( diff --git a/tests/phpunit/api/v3/CustomGroupTest.php b/tests/phpunit/api/v3/CustomGroupTest.php index d387c1964c..64c9c38e7d 100644 --- a/tests/phpunit/api/v3/CustomGroupTest.php +++ b/tests/phpunit/api/v3/CustomGroupTest.php @@ -31,8 +31,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_custom_group* functions * - * @package CiviCRM_APIv3 - * @subpackage API_CustomGroup + * @package CiviCRM_APIv3 + * @subpackage API_CustomGroup */ class api_v3_CustomGroupTest extends CiviUnitTestCase { @@ -231,7 +231,8 @@ class api_v3_CustomGroupTest extends CiviUnitTestCase { * Check without title */ public function testCustomGroupCreateNoTitle() { - $params = array('extends' => array('Contact'), + $params = array( + 'extends' => array('Contact'), 'weight' => 5, 'collapse_display' => 1, 'style' => 'Tab', diff --git a/tests/phpunit/api/v3/CustomValueContactTypeTest.php b/tests/phpunit/api/v3/CustomValueContactTypeTest.php index 219bee6fbb..4043b9b854 100644 --- a/tests/phpunit/api/v3/CustomValueContactTypeTest.php +++ b/tests/phpunit/api/v3/CustomValueContactTypeTest.php @@ -30,13 +30,13 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_activity_* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Contact + * @package CiviCRM_APIv3 + * @subpackage API_Contact */ class api_v3_CustomValueContactTypeTest extends CiviUnitTestCase { protected $_contactID; - protected $_apiversion =3; + protected $_apiversion = 3; protected $CustomGroupIndividual; protected $individualStudent; @@ -104,8 +104,8 @@ class api_v3_CustomValueContactTypeTest extends CiviUnitTestCase { $this->organizationSponsor = $this->organizationCreate($params); //refresh php cached variables CRM_Core_PseudoConstant::flush(); - CRM_Core_BAO_CustomField::getTableColumnGroup($this->IndividualField['id'], True); - CRM_Core_BAO_CustomField::getTableColumnGroup($this->IndiStudentField['id'], True); + CRM_Core_BAO_CustomField::getTableColumnGroup($this->IndividualField['id'], TRUE); + CRM_Core_BAO_CustomField::getTableColumnGroup($this->IndiStudentField['id'], TRUE); } public function tearDown() { @@ -134,7 +134,8 @@ class api_v3_CustomValueContactTypeTest extends CiviUnitTestCase { $params = array( 'id' => $this->organization, 'contact_type' => 'Organization', - "custom_{$this->IndividualField['id']}" => 'Test String', 'debug' => 1,// so that undefined_fields is returned + "custom_{$this->IndividualField['id']}" => 'Test String', + 'debug' => 1, // so that undefined_fields is returned ); $contact = $this->callAPISuccess('contact', 'create', $params); @@ -149,7 +150,7 @@ class api_v3_CustomValueContactTypeTest extends CiviUnitTestCase { public function testAddCustomDataEmptyToIndividual() { $contact = $this->callAPIFailure('contact', 'create', array(), 'Mandatory key(s) missing from params array: contact_type' - ); + ); } /** @@ -181,7 +182,7 @@ class api_v3_CustomValueContactTypeTest extends CiviUnitTestCase { 'contact_id' => $this->organizationSponsor, 'contact_type' => 'Organization', "custom_{$this->IndiStudentField['id']}" => 'Test String', - 'debug' => 1,// so that undefined_fields is returned + 'debug' => 1, // so that undefined_fields is returned ); $contact = $this->callAPISuccess('contact', 'create', $params); @@ -197,7 +198,7 @@ class api_v3_CustomValueContactTypeTest extends CiviUnitTestCase { $params = array( 'contact_id' => $this->individualStudent, 'contact_type' => 'Individual', - "custom_{$this->IndiStudentField['id']}" => 'Test String', ); + "custom_{$this->IndiStudentField['id']}" => 'Test String', ); $result = $this->callAPISuccess('contact', 'create', $params); @@ -217,7 +218,8 @@ class api_v3_CustomValueContactTypeTest extends CiviUnitTestCase { $params = array( 'contact_id' => $this->individualParent, 'contact_type' => 'Individual', - "custom_{$this->IndiStudentField['id']}" => 'Test String', 'debug' => 1,// so that undefined_fields is returned + "custom_{$this->IndiStudentField['id']}" => 'Test String', + 'debug' => 1, // so that undefined_fields is returned ); $contact = $this->callAPISuccess('contact', 'create', $params); $this->assertTrue(is_array($contact['undefined_fields']), __LINE__); @@ -236,7 +238,7 @@ class api_v3_CustomValueContactTypeTest extends CiviUnitTestCase { $params = array( 'contact_id' => $this->individual, 'contact_type' => 'Individual', - "custom_" . $this->IndividualField['id'] => 'Test String', ); + "custom_" . $this->IndividualField['id'] => 'Test String', ); $contact = $this->callAPISuccess('contact', 'create', $params); @@ -261,19 +263,19 @@ class api_v3_CustomValueContactTypeTest extends CiviUnitTestCase { 'contact_id' => $this->individualStudent, 'contact_type' => 'Individual', 'contact_sub_type' => 'Student', - "custom_{$this->IndiStudentField['id']}" => 'Test String', ); + "custom_{$this->IndiStudentField['id']}" => 'Test String', ); $contact = $this->callAPISuccess('contact', 'create', $params); $this->assertAPISuccess($contact); $params = array( 'contact_id' => $this->individualStudent, 'contact_type' => 'Individual', - 'contact_sub_type' => 'Student', "return.custom_{$this->IndiStudentField['id']}" => 1, + 'contact_sub_type' => 'Student', + "return.custom_{$this->IndiStudentField['id']}" => 1, ); $getContact = $this->callAPISuccess('contact', 'get', $params); - $this->assertEquals($getContact['values'][$this->individualStudent]["custom_{$this->IndiStudentField['id']}"], 'Test String', 'In line ' . __LINE__); } } diff --git a/tests/phpunit/api/v3/CustomValueTest.php b/tests/phpunit/api/v3/CustomValueTest.php index e7be0f8175..df3a088cd6 100644 --- a/tests/phpunit/api/v3/CustomValueTest.php +++ b/tests/phpunit/api/v3/CustomValueTest.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ require_once 'CiviTest/CiviUnitTestCase.php'; @@ -31,7 +31,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; * Class api_v3_CustomValueTest */ class api_v3_CustomValueTest extends CiviUnitTestCase { - protected $_apiversion =3; + protected $_apiversion = 3; protected $individual; protected $params; protected $ids; @@ -86,7 +86,6 @@ class api_v3_CustomValueTest extends CiviUnitTestCase { 'custom_' . $this->ids['multi2']['custom_field_id'][2] => "vegemite", ); - $result = $this->callAPISuccess('Contact', 'create', $params); $contact_id = $result['id']; $firstCustomField = $this->ids['multi']['custom_field_id'][0]; @@ -122,7 +121,7 @@ class api_v3_CustomValueTest extends CiviUnitTestCase { $this->assertEquals('', $result['values'][$thirdCustomField]['1']); $this->assertEquals('value 4', $result['values'][$thirdCustomField]['2']); } - + public function testMultipleCustomValues() { $params = array( 'first_name' => 'abc3', @@ -140,7 +139,7 @@ class api_v3_CustomValueTest extends CiviUnitTestCase { $firstCustomField = $this->ids['multi']['custom_field_id'][1]; $secondCustomField = $this->ids['single']['custom_field_id']; $thirdCustomField = $this->ids['multi']['custom_field_id'][0]; - + $createParams = array( 'contact_type' => 'Individual', 'id' => $contact_id, @@ -157,7 +156,7 @@ class api_v3_CustomValueTest extends CiviUnitTestCase { $result = $this->callAPISuccess('CustomValue', 'Get', $params); // delete the contact $this->callAPISuccess('contact', 'delete', array('id' => $contact_id)); - + $this->assertEquals($contact_id, $result['values'][$secondCustomField]['entity_id']); $this->assertEquals('value 1', $result['values'][$secondCustomField]['latest']); $this->assertEquals('value 1', $result['values'][$secondCustomField][0]); @@ -165,7 +164,7 @@ class api_v3_CustomValueTest extends CiviUnitTestCase { $this->assertEquals($contact_id, $result['values'][$thirdCustomField]['entity_id']); $this->assertEquals('multi value 1', $result['values'][$thirdCustomField][1]); $this->assertEquals('multi value 2', $result['values'][$thirdCustomField][2]); - + $this->assertEquals($contact_id, $result['values'][$firstCustomField]['entity_id']); $this->assertEquals('second multi value 1', $result['values'][$firstCustomField][1]); $this->assertEquals('', $result['values'][$firstCustomField][2]); diff --git a/tests/phpunit/api/v3/DomainTest.php b/tests/phpunit/api/v3/DomainTest.php index a1d5f67570..a311f868a8 100644 --- a/tests/phpunit/api/v3/DomainTest.php +++ b/tests/phpunit/api/v3/DomainTest.php @@ -30,8 +30,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for Domain API - civicrm_domain_* * - * @package CiviCRM_APIv3 - * @subpackage API_Domain + * @package CiviCRM_APIv3 + * @subpackage API_Domain */ class api_v3_DomainTest extends CiviUnitTestCase { @@ -79,7 +79,7 @@ class api_v3_DomainTest extends CiviUnitTestCase { ) ); - $this->callAPISuccess('domain','create',array( + $this->callAPISuccess('domain', 'create', array( 'id' => 1, 'contact_id' => $domContact['id'], ) @@ -100,7 +100,7 @@ class api_v3_DomainTest extends CiviUnitTestCase { */ public function testGet() { - $params = array('sequential' => 1,); + $params = array('sequential' => 1); $result = $this->callAPIAndDocument('domain', 'get', $params, __FUNCTION__, __FILE__); $this->assertType('array', $result); @@ -138,9 +138,9 @@ class api_v3_DomainTest extends CiviUnitTestCase { $this->assertArrayHasKey('domain_email', $domain); $this->assertArrayHasKey('domain_phone', $domain); $this->assertArrayHasKey('domain_address', $domain); - $this->assertEquals("my@email.com",$domain['domain_email']); - $this->assertEquals("456-456",$domain['domain_phone']['phone']); - $this->assertEquals("45 Penny Lane",$domain['domain_address']['street_address']); + $this->assertEquals("my@email.com", $domain['domain_email']); + $this->assertEquals("456-456", $domain['domain_phone']['phone']); + $this->assertEquals("45 Penny Lane", $domain['domain_address']['street_address']); } } diff --git a/tests/phpunit/api/v3/EmailTest.php b/tests/phpunit/api/v3/EmailTest.php index 6a935d7771..a5895ddb6c 100644 --- a/tests/phpunit/api/v3/EmailTest.php +++ b/tests/phpunit/api/v3/EmailTest.php @@ -141,7 +141,7 @@ class api_v3_EmailTest extends CiviUnitTestCase { //create one $create = $this->callAPISuccess('email', 'create', $params); - $result = $this->callAPIAndDocument('email', 'delete', array('id' => $create['id'],), __FUNCTION__, __FILE__); + $result = $this->callAPIAndDocument('email', 'delete', array('id' => $create['id']), __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count'], 'In line ' . __LINE__); $get = $this->callAPISuccess('email', 'get', array( 'location_type_id' => $this->_locationType->id, diff --git a/tests/phpunit/api/v3/EventTest.php b/tests/phpunit/api/v3/EventTest.php index 30f875f1e9..113c2ddf04 100644 --- a/tests/phpunit/api/v3/EventTest.php +++ b/tests/phpunit/api/v3/EventTest.php @@ -82,11 +82,11 @@ class api_v3_EventTest extends CiviUnitTestCase { array( 'title' => 'Annual CiviCRM meet', 'event_type_id' => 1, - 'start_date' => 20081021, ), + 'start_date' => 20081021, ), array( 'title' => 'Annual CiviCRM meet 2', 'event_type_id' => 1, - 'start_date' => 20101021, ), + 'start_date' => 20101021, ), ); $this->events = array(); @@ -139,14 +139,14 @@ class api_v3_EventTest extends CiviUnitTestCase { public function testGetEventByIdSort() { $params = array( 'return.sort' => 'id ASC', - 'return.max_results' => 1, ); + 'return.max_results' => 1, ); $result = $this->callAPISuccess('Event', 'Get', $params); $this->assertEquals(1, $result['id'], ' in line ' . __LINE__); $params = array( 'options' => array( 'sort' => 'id DESC', 'limit' => 1, - ), ); + ), ); $result = $this->callAPISuccess('Event', 'Get', $params); $this->assertAPISuccess($result, ' in line ' . __LINE__); @@ -155,11 +155,10 @@ class api_v3_EventTest extends CiviUnitTestCase { 'options' => array( 'sort' => 'id ASC', 'limit' => 1, - ), ); + ), ); $result = $this->callAPISuccess('Event', 'Get', $params); $this->assertEquals(1, $result['id'], ' in line ' . __LINE__); - } /* * Getting the id back of an event. @@ -184,7 +183,8 @@ class api_v3_EventTest extends CiviUnitTestCase { $params = array( 'isCurrent' => 1, ); - $currentEventParams = array('start_date' => date('Y-m-d', strtotime('+ 1 day')), + $currentEventParams = array( + 'start_date' => date('Y-m-d', strtotime('+ 1 day')), 'end_date' => date('Y-m-d', strtotime('+ 1 week')), ); $currentEventParams = array_merge($this->_params[1], $currentEventParams); @@ -205,17 +205,17 @@ class api_v3_EventTest extends CiviUnitTestCase { public function testGetPaymentProcessorId() { $params = $this->_params[0]; $params['payment_processor_id'] = 1; - $params['sequential'] =1; + $params['sequential'] = 1; $result = $this->callAPISuccess('event', 'create', $params); - $this->assertEquals( 1,$result['values'][0]['payment_processor'][0], "handing of payment processor compatibility"); + $this->assertEquals( 1, $result['values'][0]['payment_processor'][0], "handing of payment processor compatibility"); $result = $this->callAPISuccess('event', 'get', $params); - $this->assertEquals($result['values'][0]['payment_processor_id'], 1,"handing get payment processor compatibility"); + $this->assertEquals($result['values'][0]['payment_processor_id'], 1, "handing get payment processor compatibility"); } public function testInvalidData() { $params = $this->_params[0]; - $params['sequential'] =1; - $params['loc_block_id'] =100; + $params['sequential'] = 1; + $params['loc_block_id'] = 100; $result = $this->callAPIFailure('event', 'create', $params); } @@ -226,12 +226,14 @@ class api_v3_EventTest extends CiviUnitTestCase { public function testGetSingleReturnIsFull() { $contactID = $this->individualCreate(); $params = array( - 'id' => $this->_eventIds[0], 'max_participants' => 1, + 'id' => $this->_eventIds[0], + 'max_participants' => 1, ); $result = $this->callAPISuccess('Event', 'Create', $params); $getEventParams = array( - 'id' => $this->_eventIds[0], 'return.is_full' => 1, + 'id' => $this->_eventIds[0], + 'return.is_full' => 1, ); $currentEvent = $this->callAPISuccess('Event', 'getsingle', $getEventParams); @@ -359,7 +361,8 @@ class api_v3_EventTest extends CiviUnitTestCase { $result = $this->callAPISuccess('event', 'create', $this->_params[1]); $params = array( - 'id' => $result['id'], 'max_participants' => 150, + 'id' => $result['id'], + 'max_participants' => 150, ); $this->callAPISuccess('Event', 'Create', $params); $updated = $this->callAPISuccess('Event', 'Get', $params, __FUNCTION__, __FILE__); @@ -385,7 +388,7 @@ class api_v3_EventTest extends CiviUnitTestCase { */ public function testDeleteWithEventId() { $params = array( - 'event_id' => $this->_eventIds[0], ); + 'event_id' => $this->_eventIds[0], ); $result = $this->callAPISuccess('Event', 'Delete', $params); $this->assertAPISuccess($result, 'in line ' . __LINE__); } @@ -445,7 +448,7 @@ class api_v3_EventTest extends CiviUnitTestCase { 'event_type_id' => 1, 'return.title' => 1, 'return.id' => 1, - 'return.start_date' => 1, ); + 'return.start_date' => 1, ); $result = $this->callAPISuccess('event', 'get', $params); $this->assertEquals($result['values'][$this->_eventIds[0]]['id'], $this->_eventIds[0], 'In line ' . __LINE__); @@ -460,7 +463,8 @@ class api_v3_EventTest extends CiviUnitTestCase { $maxEvents = 5; $events = array(); while ($maxEvents > 0) { - $params = array( 'title' => 'Test Event' . $maxEvents, + $params = array( + 'title' => 'Test Event' . $maxEvents, 'event_type_id' => 2, 'start_date' => 20081021, ); @@ -468,7 +472,8 @@ class api_v3_EventTest extends CiviUnitTestCase { $events[$maxEvents] = $this->callAPISuccess('event', 'create', $params); $maxEvents--; } - $params = array( 'event_type_id' => 2, + $params = array( + 'event_type_id' => 2, 'return.id' => 1, 'return.title' => 1, 'return.offset' => 2, @@ -481,7 +486,10 @@ class api_v3_EventTest extends CiviUnitTestCase { public function testEventCreationPermissions() { $params = array( - 'event_type_id' => 1, 'start_date' => '2010-10-03', 'title' => 'le cake is a tie', 'check_permissions' => TRUE, ); + 'event_type_id' => 1, + 'start_date' => '2010-10-03', + 'title' => 'le cake is a tie', + 'check_permissions' => TRUE, ); $config = &CRM_Core_Config::singleton(); $config->userPermissionClass->permissions = array('access CiviCRM'); $result = $this->callAPIFailure('event', 'create', $params); diff --git a/tests/phpunit/api/v3/GrantTest.php b/tests/phpunit/api/v3/GrantTest.php index 339b185263..f3faefa5b3 100644 --- a/tests/phpunit/api/v3/GrantTest.php +++ b/tests/phpunit/api/v3/GrantTest.php @@ -31,8 +31,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_grant* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Grant + * @package CiviCRM_APIv3 + * @subpackage API_Grant */ class api_v3_GrantTest extends CiviUnitTestCase { @@ -153,17 +153,16 @@ class api_v3_GrantTest extends CiviUnitTestCase { $result = $this->callAPISuccess($this->_entity, 'create', $this->params); $result = $this->callAPIAndDocument($this->_entity, 'delete', array('id' => $result['id']), __FUNCTION__, __FILE__); $this->assertAPISuccess($result, 'In line ' . __LINE__); - $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array( - )); + $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array()); $this->assertEquals(0, $checkDeleted['count'], 'In line ' . __LINE__); } /* - * This is a test to check if setting fields one at a time alters other fields - * Issues Hit so far = - * 1) Currency keeps getting reset to USD - BUT this may be the only enabled currency - * - in which case it is valid - * 2) - */ + * This is a test to check if setting fields one at a time alters other fields + * Issues Hit so far = + * 1) Currency keeps getting reset to USD - BUT this may be the only enabled currency + * - in which case it is valid + * 2) + */ public function testCreateAutoGrant() { $entityName = $this->_entity; diff --git a/tests/phpunit/api/v3/GroupContactTest.php b/tests/phpunit/api/v3/GroupContactTest.php index 1f44808517..2eff3c50df 100644 --- a/tests/phpunit/api/v3/GroupContactTest.php +++ b/tests/phpunit/api/v3/GroupContactTest.php @@ -70,7 +70,8 @@ class api_v3_GroupContactTest extends CiviUnitTestCase { $this->_groupId2 = $this->groupCreate($group); $this->_group = array( - $this->_groupId1 => array('title' => 'New Test Group Created', + $this->_groupId1 => array( + 'title' => 'New Test Group Created', 'visibility' => 'Public Pages', 'in_method' => 'API', ), @@ -121,7 +122,7 @@ class api_v3_GroupContactTest extends CiviUnitTestCase { public function testCreateWithoutGroupIdParams() { $params = array( - 'contact_id' => $this->_contactId, ); + 'contact_id' => $this->_contactId, ); $groups = $this->callAPIFailure('group_contact', 'create', $params); $this->assertEquals($groups['error_message'], 'Mandatory key(s) missing from params array: group_id'); @@ -129,7 +130,7 @@ class api_v3_GroupContactTest extends CiviUnitTestCase { public function testCreateWithoutContactIdParams() { $params = array( - 'group_id' => $this->_groupId1, ); + 'group_id' => $this->_groupId1, ); $groups = $this->callAPIFailure('group_contact', 'create', $params); $this->assertEquals($groups['error_message'], 'Mandatory key(s) missing from params array: contact_id'); } @@ -142,7 +143,7 @@ class api_v3_GroupContactTest extends CiviUnitTestCase { 'prefix_id' => 3, 'suffix_id' => 3, 'email' => 'amiteshwar.prasad@civicrm.org', - 'contact_type' => 'Individual', ); + 'contact_type' => 'Individual', ); $this->_contactId1 = $this->individualCreate($cont); $params = array( diff --git a/tests/phpunit/api/v3/GroupNestingTest.php b/tests/phpunit/api/v3/GroupNestingTest.php index 8c8ebfb301..543fc0ce63 100644 --- a/tests/phpunit/api/v3/GroupNestingTest.php +++ b/tests/phpunit/api/v3/GroupNestingTest.php @@ -31,7 +31,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for GroupNesting API - civicrm_group_nesting_* * - * @package CiviCRM + * @package CiviCRM */ class api_v3_GroupNestingTest extends CiviUnitTestCase { protected $_apiversion; @@ -106,7 +106,8 @@ class api_v3_GroupNestingTest extends CiviUnitTestCase { $result = $this->callAPIAndDocument('group_nesting', 'get', $params, __FUNCTION__, __FILE__); // expected data loaded in setUp $expected = array( - 1 => array('id' => 1, + 1 => array( + 'id' => 1, 'child_group_id' => 2, 'parent_group_id' => 1, )); @@ -120,13 +121,14 @@ class api_v3_GroupNestingTest extends CiviUnitTestCase { */ public function testGetWithChildGroupId() { $params = array( - 'child_group_id' => 4, ); + 'child_group_id' => 4, ); $result = $this->callAPISuccess('group_nesting', 'get', $params); // expected data loaded in setUp $expected = array( - 3 => array('id' => 3, + 3 => array( + 'id' => 3, 'child_group_id' => 4, 'parent_group_id' => 1, ), @@ -146,13 +148,14 @@ class api_v3_GroupNestingTest extends CiviUnitTestCase { */ public function testGetWithParentGroupId() { $params = array( - 'parent_group_id' => 1, ); + 'parent_group_id' => 1, ); $result = $this->callAPISuccess('group_nesting', 'get', $params); // expected data loaded in setUp $expected = array( - 1 => array('id' => 1, + 1 => array( + 'id' => 1, 'child_group_id' => 2, 'parent_group_id' => 1, ), @@ -221,7 +224,7 @@ class api_v3_GroupNestingTest extends CiviUnitTestCase { // groups id=1 and id=2 loaded in setUp $getparams = array( 'parent_group_id' => 1, - 'child_group_id' => 2, ); + 'child_group_id' => 2, ); $result = $this->callAPISuccess('group_nesting', 'get', $getparams); $params = array('id' => $result['id']); diff --git a/tests/phpunit/api/v3/GroupOrganizationTest.php b/tests/phpunit/api/v3/GroupOrganizationTest.php index eb34b1a9f0..4f3128abf1 100644 --- a/tests/phpunit/api/v3/GroupOrganizationTest.php +++ b/tests/phpunit/api/v3/GroupOrganizationTest.php @@ -31,7 +31,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for GroupOrganization API - civicrm_group_organization_* * - * @package CiviCRM + * @package CiviCRM */ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { protected $_apiversion; @@ -59,7 +59,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { $params = array( 'organization_id' => $this->_orgID, - 'group_id' => $this->_groupID, ); + 'group_id' => $this->_groupID, ); $result = $this->callAPISuccess('group_organization', 'create', $params); $paramsGet = array( 'organization_id' => $result['id'], @@ -89,7 +89,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { * Test civicrm_group_organization_get with empty params. */ public function testGroupOrganizationGetWithEmptyParams() { - $params = array( ); + $params = array(); $result = $this->callAPISuccess('group_organization', 'get', $params); $this->assertAPISuccess($result); @@ -109,7 +109,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { */ public function testGroupOrganizationGetWithInvalidKeys() { $params = array( - 'invalid_key' => 1, ); + 'invalid_key' => 1, ); $result = $this->callAPISuccess('group_organization', 'get', $params); $this->assertAPISuccess($result); @@ -123,7 +123,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { public function testGroupOrganizationCreate() { $params = array( 'organization_id' => $this->_orgID, - 'group_id' => $this->_groupID, ); + 'group_id' => $this->_groupID, ); $result = $this->callAPIAndDocument('group_organization', 'create', $params, __FUNCTION__, __FILE__); } @@ -133,7 +133,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { public function testGroupOrganizationCreateTwice() { $params = array( 'organization_id' => $this->_orgID, - 'group_id' => $this->_groupID, ); + 'group_id' => $this->_groupID, ); $result = $this->callAPISuccess('group_organization', 'create', $params); $result2 = $this->callAPISuccess('group_organization', 'create', $params); $this->assertEquals($result['values'], $result2['values']); @@ -142,7 +142,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { * Check with empty params array */ public function testGroupOrganizationCreateWithEmptyParams() { - $params = array( ); + $params = array(); $result = $this->callAPIFailure('group_organization', 'create', $params); $this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: group_id, organization_id'); } @@ -161,7 +161,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { */ public function testGroupOrganizationCreateWithInvalidKeys() { $params = array( - 'invalid_key' => 1, ); + 'invalid_key' => 1, ); $result = $this->callAPIFailure('group_organization', 'create', $params); $this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: group_id, organization_id'); } @@ -181,7 +181,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { * Test civicrm_group_organization_remove with empty params. */ public function testGroupOrganizationDeleteWithEmptyParams() { - $params = array( ); + $params = array(); $result = $this->callAPIFailure('group_organization', 'delete', $params); $this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: id'); } @@ -192,7 +192,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { public function testGroupOrganizationDelete() { $paramsC = array( 'organization_id' => $this->_orgID, - 'group_id' => $this->_groupID, ); + 'group_id' => $this->_groupID, ); $result = $this->callAPISuccess('group_organization', 'create', $paramsC); $params = array( @@ -206,7 +206,7 @@ class api_v3_GroupOrganizationTest extends CiviUnitTestCase { */ public function testGroupOrganizationDeleteWithInvalidKey() { $paramsDelete = array( - 'invalid_key' => 1, ); + 'invalid_key' => 1, ); $result = $this->callAPIFailure('group_organization', 'delete', $paramsDelete); $this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: id'); } diff --git a/tests/phpunit/api/v3/GroupTest.php b/tests/phpunit/api/v3/GroupTest.php index b103823caf..5e5188fc09 100644 --- a/tests/phpunit/api/v3/GroupTest.php +++ b/tests/phpunit/api/v3/GroupTest.php @@ -30,7 +30,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for Group API - civicrm_group_* * - * @package CiviCRM_APIv3 + * @package CiviCRM_APIv3 */ class api_v3_GroupTest extends CiviUnitTestCase { diff --git a/tests/phpunit/api/v3/ImTest.php b/tests/phpunit/api/v3/ImTest.php index 95baf4780a..0e8152650a 100644 --- a/tests/phpunit/api/v3/ImTest.php +++ b/tests/phpunit/api/v3/ImTest.php @@ -31,8 +31,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_im_* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Contact + * @package CiviCRM_APIv3 + * @subpackage API_Contact */ class api_v3_ImTest extends CiviUnitTestCase { diff --git a/tests/phpunit/api/v3/JobProcessMailingTest.php b/tests/phpunit/api/v3/JobProcessMailingTest.php index e3b2244146..bfaecf64a0 100644 --- a/tests/phpunit/api/v3/JobProcessMailingTest.php +++ b/tests/phpunit/api/v3/JobProcessMailingTest.php @@ -68,7 +68,7 @@ class api_v3_JobProcessMailingTest extends CiviUnitTestCase { 'created_id' => 1, 'groups' => array('include' => array($this->_groupID)), ); - $this->_mut = new CiviMailUtils( $this, true ); + $this->_mut = new CiviMailUtils( $this, TRUE ); $this->callAPISuccess('mail_settings', 'get', array('api.mail_settings.create' => array('domain' => 'chaos.org'))); } @@ -77,7 +77,7 @@ class api_v3_JobProcessMailingTest extends CiviUnitTestCase { */ public function tearDown() { $this->_mut->stop(); -// $this->quickCleanup(array('civicrm_mailing', 'civicrm_mailing_job', 'civicrm_contact')); + // $this->quickCleanup(array('civicrm_mailing', 'civicrm_mailing_job', 'civicrm_contact')); CRM_Utils_Hook::singleton()->reset(); CRM_Mailing_BAO_MailingJob::$mailsProcessed = 0; // DGW parent::tearDown(); diff --git a/tests/phpunit/api/v3/JobTest.php b/tests/phpunit/api/v3/JobTest.php index 309a595d0b..69518bf13a 100644 --- a/tests/phpunit/api/v3/JobTest.php +++ b/tests/phpunit/api/v3/JobTest.php @@ -67,7 +67,7 @@ class api_v3_JobTest extends CiviUnitTestCase { */ public function testCreateWithoutName() { $params = array( - 'is_active' => 1, ); + 'is_active' => 1, ); $result = $this->callAPIFailure('job', 'create', $params, 'Mandatory key(s) missing from params array: run_frequency, name, api_entity, api_action' ); @@ -137,7 +137,7 @@ class api_v3_JobTest extends CiviUnitTestCase { */ public function testDeleteWithIncorrectData() { $params = array( - 'id' => 'abcd', ); + 'id' => 'abcd', ); $result = $this->callAPIFailure('job', 'delete', $params); } @@ -146,7 +146,7 @@ class api_v3_JobTest extends CiviUnitTestCase { */ public function testDelete() { $createResult = $this->callAPISuccess('job', 'create', $this->_params); - $params = array('id' => $createResult['id'],); + $params = array('id' => $createResult['id']); $result = $this->callAPIAndDocument('job', 'delete', $params, __FUNCTION__, __FILE__); $this->assertAPIDeleted($this->_entity, $createResult['id']); } @@ -154,20 +154,20 @@ class api_v3_JobTest extends CiviUnitTestCase { /** public function testCallUpdateGreetingMissingParams() { - $result = $this->callAPISuccess($this->_entity, 'update_greeting', array('gt' => 1)); - $this->assertEquals('Mandatory key(s) missing from params array: ct', $result['error_message']); + $result = $this->callAPISuccess($this->_entity, 'update_greeting', array('gt' => 1)); + $this->assertEquals('Mandatory key(s) missing from params array: ct', $result['error_message']); } public function testCallUpdateGreetingIncorrectParams() { - $result = $this->callAPISuccess($this->_entity, 'update_greeting', array('gt' => 1, 'ct' => 'djkfhdskjfhds')); - $this->assertEquals('ct `djkfhdskjfhds` is not valid.', $result['error_message']); + $result = $this->callAPISuccess($this->_entity, 'update_greeting', array('gt' => 1, 'ct' => 'djkfhdskjfhds')); + $this->assertEquals('ct `djkfhdskjfhds` is not valid.', $result['error_message']); } -/* - * Note that this test is about tesing the metadata / calling of the function & doesn't test the success of the called function - */ + /* + * Note that this test is about tesing the metadata / calling of the function & doesn't test the success of the called function + */ public function testCallUpdateGreetingSuccess() { $result = $this->callAPISuccess($this->_entity, 'update_greeting', array('gt' => 'postal_greeting', 'ct' => 'Individual')); - } + } public function testCallUpdateGreetingCommaSeparatedParamsSuccess() { $gt = 'postal_greeting,email_greeting,addressee'; @@ -283,7 +283,7 @@ class api_v3_JobTest extends CiviUnitTestCase { * @param int $id * @param array $params */ - public function hookPreRelationship($op, $objectName, $id, &$params ) { + public function hookPreRelationship($op, $objectName, $id, &$params) { if($op == 'delete') { return; } diff --git a/tests/phpunit/api/v3/LineItemTest.php b/tests/phpunit/api/v3/LineItemTest.php index 520659316e..4359297119 100644 --- a/tests/phpunit/api/v3/LineItemTest.php +++ b/tests/phpunit/api/v3/LineItemTest.php @@ -37,7 +37,7 @@ class api_v3_LineItemTest extends CiviUnitTestCase { protected $id = 0; protected $contactIds = array(); protected $_entity = 'line_item'; - protected $contribution_result = null; + protected $contribution_result = NULL; public $DBResetRequired = TRUE; protected $_financialTypeId = 1; @@ -57,7 +57,7 @@ class api_v3_LineItemTest extends CiviUnitTestCase { 'source' => 'SSF', 'contribution_status_id' => 1, ); - $contribution = $this->callAPISuccess('contribution','create', $contributionParams); + $contribution = $this->callAPISuccess('contribution', 'create', $contributionParams); $this->params = array( 'price_field_value_id' => 1, 'price_field_id' => 1, @@ -95,7 +95,7 @@ class api_v3_LineItemTest extends CiviUnitTestCase { } public function testGetFieldsLineItem() { - $result = $this->callAPISuccess($this->_entity, 'getfields', array('action' => 'create',)); + $result = $this->callAPISuccess($this->_entity, 'getfields', array('action' => 'create')); $this->assertEquals(1, $result['values']['entity_id']['api.required']); } diff --git a/tests/phpunit/api/v3/LocBlockTest.php b/tests/phpunit/api/v3/LocBlockTest.php index 51d0b3ea9f..c3e66bb0e1 100644 --- a/tests/phpunit/api/v3/LocBlockTest.php +++ b/tests/phpunit/api/v3/LocBlockTest.php @@ -104,9 +104,9 @@ class api_v3_LocBlockTest extends CiviUnitTestCase { $this->assertNotNull($result['phone_id'], 'In line ' . __LINE__); $this->assertNotNull($result['phone_2_id'], 'In line ' . __LINE__); $this->assertNotNull($result['address_id'], 'In line ' . __LINE__); - $this->assertEquals($params['email']['email'], $result['email']['email'], 'In line ' . __LINE__); - $this->assertEquals($params['phone_2']['phone'], $result['phone_2']['phone'], 'In line ' . __LINE__); - $this->assertEquals($params['address']['street_address'], $result['address']['street_address'], 'In line ' . __LINE__); + $this->assertEquals($params['email']['email'], $result['email']['email'], 'In line ' . __LINE__); + $this->assertEquals($params['phone_2']['phone'], $result['phone_2']['phone'], 'In line ' . __LINE__); + $this->assertEquals($params['address']['street_address'], $result['address']['street_address'], 'In line ' . __LINE__); // Delete block $result = $this->callAPISuccess($this->_entity, 'delete', array('id' => $id)); } diff --git a/tests/phpunit/api/v3/MailingContactTest.php b/tests/phpunit/api/v3/MailingContactTest.php index ba22a060d9..1d0e07cd77 100644 --- a/tests/phpunit/api/v3/MailingContactTest.php +++ b/tests/phpunit/api/v3/MailingContactTest.php @@ -67,7 +67,7 @@ class api_v3_MailingContactTest extends CiviUnitTestCase { * but don't copy it only any other classes */ public function testMailingNullParams() { - $result = $this->callAPIFailure('MailingContact', 'get', null); + $result = $this->callAPIFailure('MailingContact', 'get', NULL); } public function testMailingContactGetFields() { @@ -97,7 +97,7 @@ class api_v3_MailingContactTest extends CiviUnitTestCase { * belongs in the SyntaxConformance class */ public function testMailingContactInvalidContactID() { - $params = array('contact_id' => 'This is not a number',); + $params = array('contact_id' => 'This is not a number'); $result = $this->callAPIFailure('MailingContact', 'get', $params); } @@ -163,7 +163,7 @@ class api_v3_MailingContactTest extends CiviUnitTestCase { /** * Test that the API returns only the "Bounced" mailings when instructed to do so */ - public function testMailingContactBounced( ) { + public function testMailingContactBounced() { $op = new PHPUnit_Extensions_Database_Operation_Insert(); //Create the User $op->execute($this->_dbconn, diff --git a/tests/phpunit/api/v3/MailingGroupTest.php b/tests/phpunit/api/v3/MailingGroupTest.php index 95f1bc8076..79ad0e46ec 100644 --- a/tests/phpunit/api/v3/MailingGroupTest.php +++ b/tests/phpunit/api/v3/MailingGroupTest.php @@ -30,7 +30,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_mailing_group_* functions * - * @package CiviCRM + * @package CiviCRM */ class api_v3_MailingGroupTest extends CiviUnitTestCase { protected $_groupID; diff --git a/tests/phpunit/api/v3/MailingTest.php b/tests/phpunit/api/v3/MailingTest.php index 1b86e3eddd..a07977a6d5 100755 --- a/tests/phpunit/api/v3/MailingTest.php +++ b/tests/phpunit/api/v3/MailingTest.php @@ -29,7 +29,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_mailing_* functions * - * @package CiviCRM + * @package CiviCRM */ class api_v3_MailingTest extends CiviUnitTestCase { protected $_groupID; @@ -128,7 +128,7 @@ class api_v3_MailingTest extends CiviUnitTestCase { public function testMailerPreview() { // BEGIN SAMPLE DATA - $contactID = $this->individualCreate(); + $contactID = $this->individualCreate(); $displayName = $this->callAPISuccess('contact', 'get', array('id' => $contactID)); $displayName = $displayName['values'][$contactID]['display_name']; $this->assertTrue(!empty($displayName)); @@ -141,7 +141,7 @@ class api_v3_MailingTest extends CiviUnitTestCase { $params['options']['force_rollback'] = 1; // END SAMPLE DATA - $maxIDs = array( + $maxIDs = array( 'mailing' => CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_mailing'), 'job' => CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_mailing_job'), 'group' => CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_mailing_group'), @@ -186,7 +186,7 @@ class api_v3_MailingTest extends CiviUnitTestCase { ); // END SAMPLE DATA - $maxIDs = array( + $maxIDs = array( 'mailing' => CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_mailing'), 'job' => CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_mailing_job'), 'group' => CRM_Core_DAO::singleValueQuery('SELECT MAX(id) FROM civicrm_mailing_group'), @@ -198,11 +198,11 @@ class api_v3_MailingTest extends CiviUnitTestCase { $preview = $create['values'][$create['id']]['api.MailingRecipients.get']; $previewIds = array_values(CRM_Utils_Array::collect('contact_id', $preview['values'])); - $this->assertEquals(array((string)$contactIDs['includeme']), $previewIds); + $this->assertEquals(array((string) $contactIDs['includeme']), $previewIds); $previewEmails = array_values(CRM_Utils_Array::collect('api.email.getvalue', $preview['values'])); $this->assertEquals(array('include.me@example.org'), $previewEmails); $previewNames = array_values(CRM_Utils_Array::collect('api.contact.getvalue', $preview['values'])); - $this->assertTrue((bool)preg_match('/Includer Person/', $previewNames[0]), "Name 'Includer Person' should appear in '" . $previewNames[0] . '"'); + $this->assertTrue((bool) preg_match('/Includer Person/', $previewNames[0]), "Name 'Includer Person' should appear in '" . $previewNames[0] . '"'); } public function testMailerSendTest_email() { @@ -466,6 +466,6 @@ SELECT event_queue_id, time_stamp FROM mail_{$type}_temp"; return $createResult['id']; } -//----------- civicrm_mailing_create ---------- + //----------- civicrm_mailing_create ---------- } diff --git a/tests/phpunit/api/v3/MembershipPaymentTest.php b/tests/phpunit/api/v3/MembershipPaymentTest.php index 994ea8533c..de24189e5b 100644 --- a/tests/phpunit/api/v3/MembershipPaymentTest.php +++ b/tests/phpunit/api/v3/MembershipPaymentTest.php @@ -31,8 +31,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_membership_payment* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Member + * @package CiviCRM_APIv3 + * @subpackage API_Member */ class api_v3_MembershipPaymentTest extends CiviUnitTestCase { @@ -66,7 +66,7 @@ class api_v3_MembershipPaymentTest extends CiviUnitTestCase { 'thankyou_date' => '20080522', ); - $this->_contribution = $this->callAPISuccess('contribution','create', $params); + $this->_contribution = $this->callAPISuccess('contribution', 'create', $params); } ///////////////// civicrm_membership_payment_create methods diff --git a/tests/phpunit/api/v3/MembershipStatusTest.php b/tests/phpunit/api/v3/MembershipStatusTest.php index 560dda978f..dd90b287ec 100644 --- a/tests/phpunit/api/v3/MembershipStatusTest.php +++ b/tests/phpunit/api/v3/MembershipStatusTest.php @@ -37,7 +37,7 @@ class api_v3_MembershipStatusTest extends CiviUnitTestCase { protected $_membershipTypeID; protected $_membershipStatusID; - protected $_apiversion =3; + protected $_apiversion = 3; public function setUp() { parent::setUp(); @@ -115,14 +115,14 @@ class api_v3_MembershipStatusTest extends CiviUnitTestCase { public function testUpdate() { $params = array( - 'name' => 'test membership status', ); + 'name' => 'test membership status', ); $result = $this->callAPISuccess('membership_status', 'create', $params); $id = $result['id']; $result = $this->callAPISuccess('membership_status', 'get', $params); $this->assertEquals('test membership status', $result['values'][$id]['name']); $newParams = array( 'id' => $id, - 'name' => 'renamed', ); + 'name' => 'renamed', ); $result = $this->callAPISuccess('membership_status', 'create', $newParams); $result = $this->callAPISuccess('membership_status', 'get', array('id' => $id)); $this->assertEquals('renamed', $result['values'][$id]['name']); diff --git a/tests/phpunit/api/v3/MembershipTest.php b/tests/phpunit/api/v3/MembershipTest.php index c04df37f0d..6818ef3aec 100644 --- a/tests/phpunit/api/v3/MembershipTest.php +++ b/tests/phpunit/api/v3/MembershipTest.php @@ -28,8 +28,8 @@ /** * Test APIv3 civicrm_membership functions * - * @package CiviCRM_APIv3 - * @subpackage API_Member + * @package CiviCRM_APIv3 + * @subpackage API_Member */ @@ -57,7 +57,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase { $this->_apiversion = 3; $this->_contactID = $this->individualCreate(); $this->_membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID)); - $this->_membershipTypeID2 = $this->membershipTypeCreate(array('period_type' => 'fixed','fixed_period_start_day' => '301', 'fixed_period_rollover_day' => '1111')); + $this->_membershipTypeID2 = $this->membershipTypeCreate(array('period_type' => 'fixed', 'fixed_period_start_day' => '301', 'fixed_period_rollover_day' => '1111')); $this->_membershipStatusID = $this->membershipStatusCreate('test status'); CRM_Member_PseudoConstant::membershipType(NULL, TRUE); @@ -131,7 +131,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase { $this->_membershipID = $this->contactMembershipCreate($this->_params); $params = array(); $this->callAPISuccess('membership', 'get', $params); - $this->callAPISuccess('Membership', 'Delete', array('id' => $this->_membershipID,)); + $this->callAPISuccess('Membership', 'Delete', array('id' => $this->_membershipID)); } /** @@ -353,8 +353,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase { $this->assertEquals($membership['values'][$this->_membershipID]['status_id'], $this->_membershipStatusID); $this->assertEquals($membership['values'][$this->_membershipID]['contact_id'], $this->_contactID); - - $this->callAPISuccess('Membership', 'Delete', array('id' => $this->_membershipID,)); + $this->callAPISuccess('Membership', 'Delete', array('id' => $this->_membershipID)); } /** @@ -564,7 +563,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase { public function testMembershipGetWithReturn() { $this->contactMembershipCreate($this->_params); $result = $this->callAPISuccess('membership', 'get', array('return' => 'end_date')); - foreach ($result['values'] as $membership) { + foreach ($result['values'] as $membership) { $this->assertEquals(array('id', 'end_date'), array_keys($membership)); } } @@ -781,7 +780,8 @@ class api_v3_MembershipTest extends CiviUnitTestCase { 'id' => $membershipID, 'source' => 'changed', 'contact_id' => $this->_contactID, - 'status_id' => $this->_membershipStatusID, 'membership_type_id' => $this->_membershipTypeID, + 'status_id' => $this->_membershipStatusID, + 'membership_type_id' => $this->_membershipTypeID, 'skipStatusCal' => 1, ); $result = $this->callAPISuccess('membership', 'create', $params); @@ -829,7 +829,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase { if ($objectName == 'Membership' && $op == 'edit') { $existingMembership = $this->callAPISuccessGetSingle('membership', array('id' => $params['id'])); unset($params['id'], $params['membership_id']); - $params['join_date'] = $params['membership_start_date'] = $params['start_date']= date('Ymd000000', strtotime($existingMembership['start_date'])); + $params['join_date'] = $params['membership_start_date'] = $params['start_date'] = date('Ymd000000', strtotime($existingMembership['start_date'])); $params = array_merge($existingMembership, $params); $params['id'] = NULL; } @@ -849,7 +849,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase { 'end_date' => '2008-12-21', 'source' => 'Payment', 'is_override' => 1, - 'status_id' => $this->_membershipStatusID, ); + 'status_id' => $this->_membershipStatusID, ); $this->callAPIFailure('membership', 'create', $params); @@ -998,7 +998,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase { /** * Test that if datesdate are not set they not over-ridden if id is passed in */ - public function testMembershipDatesNotOverridden() { + public function testMembershipDatesNotOverridden() { $result = $this->callAPISuccess($this->_entity, 'create', $this->_params); unset($this->_params['end_date'], $this->_params['start_date']); $this->_params['id'] = $result['id']; @@ -1008,5 +1008,5 @@ class api_v3_MembershipTest extends CiviUnitTestCase { $this->assertEquals('2009-01-21', $result['start_date']); $this->assertEquals('2009-12-21', $result['end_date']); - } + } } diff --git a/tests/phpunit/api/v3/MembershipTypeTest.php b/tests/phpunit/api/v3/MembershipTypeTest.php index d963dafb8c..103a673b86 100644 --- a/tests/phpunit/api/v3/MembershipTypeTest.php +++ b/tests/phpunit/api/v3/MembershipTypeTest.php @@ -111,7 +111,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { 'duration_unit' => 'month', 'duration_interval' => '10', 'period_type' => 'rolling', - 'visibility' => 'public', ); + 'visibility' => 'public', ); $membershiptype = $this->callAPIFailure('membership_type', 'create', $params); $this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: financial_type_id' @@ -127,7 +127,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { 'domain_id' => '1', 'minimum_fee' => '200', 'duration_interval' => '10', - 'visibility' => 'public', ); + 'visibility' => 'public', ); $membershiptype = $this->callAPIFailure('membership_type', 'create', $params); $this->assertEquals($membershiptype['error_message'], @@ -144,7 +144,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { 'minimum_fee' => '200', 'duration_unit' => 'month', 'period_type' => 'rolling', - 'visibility' => 'public', ); + 'visibility' => 'public', ); $membershiptype = $this->callAPIFailure('membership_type', 'create', $params); $this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: financial_type_id, duration_interval' @@ -159,7 +159,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { 'minimum_fee' => '200', 'duration_interval' => '10', 'period_type' => 'rolling', - 'visibility' => 'public', ); + 'visibility' => 'public', ); $membershiptype = $this->callAPIFailure('membership_type', 'create', $params); $this->assertEquals($membershiptype['error_message'], @@ -177,7 +177,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { 'duration_unit' => 'month', 'duration_interval' => '10', 'period_type' => 'rolling', - 'visibility' => 'public', ); + 'visibility' => 'public', ); $membershiptype = $this->callAPIFailure('membership_type', 'create', $params); $this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: name'); @@ -221,7 +221,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { 'duration_unit' => 'month', 'duration_interval' => '10', 'period_type' => 'rolling', - 'visibility' => 'public', ); + 'visibility' => 'public', ); $membershiptype = $this->callAPIFailure('membership_type', 'create', $params); $this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: domain_id'); @@ -232,7 +232,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { $newMembOrgParams = array( 'organization_name' => 'New membership organisation', 'contact_type' => 'Organization', - 'visibility' => 1, ); + 'visibility' => 1, ); // create a new contact to update this membership type to $newMembOrgID = $this->organizationCreate($newMembOrgParams); @@ -244,7 +244,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase { 'duration_unit' => 'month', 'duration_interval' => '10', 'period_type' => 'fixed', - 'domain_id' => 1, ); + 'domain_id' => 1, ); $this->callAPISuccess('membership_type', 'update', $params); diff --git a/tests/phpunit/api/v3/MessageTemplateTest.php b/tests/phpunit/api/v3/MessageTemplateTest.php index 007575a6f1..0371baee23 100644 --- a/tests/phpunit/api/v3/MessageTemplateTest.php +++ b/tests/phpunit/api/v3/MessageTemplateTest.php @@ -30,7 +30,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for Template API - civicrm_msg_template* * - * @package CiviCRM_APIv3 + * @package CiviCRM_APIv3 */ class api_v3_MessageTemplateTest extends CiviUnitTestCase { /** @@ -56,7 +56,7 @@ class api_v3_MessageTemplateTest extends CiviUnitTestCase { ); } - /** + /** * Test create function succeeds */ public function testCreate() { @@ -76,9 +76,9 @@ class api_v3_MessageTemplateTest extends CiviUnitTestCase { $this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__); } -/** - * Check the delete function succeeds - */ + /** + * Check the delete function succeeds + */ public function testDelete() { $entity = $this->createTestEntity(); $result = $this->callAPIAndDocument('MessageTemplate', 'delete', array('id' => $entity['id']), __FUNCTION__, __FILE__); diff --git a/tests/phpunit/api/v3/NoteTest.php b/tests/phpunit/api/v3/NoteTest.php index 1845c46459..54943ac3f7 100644 --- a/tests/phpunit/api/v3/NoteTest.php +++ b/tests/phpunit/api/v3/NoteTest.php @@ -54,7 +54,7 @@ class api_v3_NoteTest extends CiviUnitTestCase { 'note' => 'Hello!!! m testing Note', 'contact_id' => $this->_contactID, 'modified_date' => '2011-01-31', - 'subject' => 'Test Note', ); + 'subject' => 'Test Note', ); $this->_note = $this->noteCreate($this->_contactID); $this->_noteID = $this->_note['id']; } @@ -136,7 +136,7 @@ class api_v3_NoteTest extends CiviUnitTestCase { $this->assertArrayHasKey('id', $result); $note = array( - 'id' => $result['id'], ); + 'id' => $result['id'], ); $this->noteDelete($note); } @@ -148,7 +148,7 @@ class api_v3_NoteTest extends CiviUnitTestCase { 'contact_id' => $this->_contactID, 'modified_date' => '2011-01-31', 'subject' => "With a '", - 'sequential' => 1, ); + 'sequential' => 1, ); $result = $this->callAPISuccess('Note', 'Create', $params); $this->assertAPISuccess($result, 'in line ' . __LINE__); $this->assertEquals($result['values'][0]['note'], "Hello!!! ' testing Note", 'in line ' . __LINE__); @@ -157,7 +157,7 @@ class api_v3_NoteTest extends CiviUnitTestCase { //CleanUP $note = array( - 'id' => $result['id'], ); + 'id' => $result['id'], ); $this->noteDelete($note); } @@ -170,7 +170,7 @@ class api_v3_NoteTest extends CiviUnitTestCase { $this->assertAPISuccess($apiResult); $this->assertEquals(date('Y-m-d'), date('Y-m-d', strtotime($apiResult['values'][$apiResult['id']]['modified_date']))); $this->noteDelete(array( - 'id' => $apiResult['id'], )); + 'id' => $apiResult['id'], )); } @@ -192,7 +192,7 @@ class api_v3_NoteTest extends CiviUnitTestCase { public function testUpdateWithoutContactId() { $params = array( 'entity_id' => $this->_contactID, - 'entity_table' => 'civicrm_contact', ); + 'entity_table' => 'civicrm_contact', ); $note = $this->callAPIFailure('note', 'create', $params, 'Mandatory key(s) missing from params array: note' ); @@ -206,7 +206,7 @@ class api_v3_NoteTest extends CiviUnitTestCase { 'id' => $this->_noteID, 'contact_id' => $this->_contactID, 'note' => 'Note1', - 'subject' => 'Hello World', ); + 'subject' => 'Hello World', ); //Update Note $this->callAPISuccess('note', 'create', $params); @@ -237,8 +237,7 @@ class api_v3_NoteTest extends CiviUnitTestCase { $params = array( 'id' => 0, ); - $deleteNote = $this->callAPIFailure('note', 'delete', $params - , 'Mandatory key(s) missing from params array: id'); + $deleteNote = $this->callAPIFailure('note', 'delete', $params, 'Mandatory key(s) missing from params array: id'); } /** diff --git a/tests/phpunit/api/v3/OptionGroupTest.php b/tests/phpunit/api/v3/OptionGroupTest.php index f3c06ead33..743815ff09 100644 --- a/tests/phpunit/api/v3/OptionGroupTest.php +++ b/tests/phpunit/api/v3/OptionGroupTest.php @@ -94,7 +94,8 @@ class api_v3_OptionGroupTest extends CiviUnitTestCase { */ public function testGetOptionCreateFailOnDuplicate() { - $params = array( 'sequential' => 1, + $params = array( + 'sequential' => 1, 'name' => 'civicrm_dup entry', 'is_reserved' => 1, 'is_active' => 1, @@ -114,7 +115,8 @@ class api_v3_OptionGroupTest extends CiviUnitTestCase { 'options' => array('limit' => 5000), ) ); - $params = array( 'sequential' => 1, + $params = array( + 'sequential' => 1, 'name' => 'civicrm_rolback_test', 'is_reserved' => 1, 'is_active' => 1, diff --git a/tests/phpunit/api/v3/OptionValueTest.php b/tests/phpunit/api/v3/OptionValueTest.php index 0a3c6e41d9..78e968504f 100644 --- a/tests/phpunit/api/v3/OptionValueTest.php +++ b/tests/phpunit/api/v3/OptionValueTest.php @@ -74,7 +74,7 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { $result = $this->callAPISuccess('option_value', 'get', array( 'option_group_id' => 1, - 'value' => '1', )); + 'value' => '1', )); $result2 = $this->callAPISuccess('option_value', 'get', array( 'option_group_id' => 1, 'value' => '1', @@ -90,13 +90,15 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { $description = "demonstrates use of Sort param (available in many api functions). Also, getsingle"; $subfile = 'SortOption'; $result = $this->callAPISuccess('option_value', 'getsingle', array( - 'option_group_id' => 1, 'options' => array( + 'option_group_id' => 1, + 'options' => array( 'sort' => 'label ASC', 'limit' => 1, ), )); $params = array( - 'option_group_id' => 1, 'options' => array( + 'option_group_id' => 1, + 'options' => array( 'sort' => 'label DESC', 'limit' => 1, ), @@ -110,12 +112,13 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { */ public function testGetValueOptionPagination() { $pageSize = 10; - $page1 = $this->callAPISuccess('option_value', 'get', array('options' => array('limit' => $pageSize), )); + $page1 = $this->callAPISuccess('option_value', 'get', array('options' => array('limit' => $pageSize) )); $page2 = $this->callAPISuccess('option_value', 'get', array( - 'options' => array('limit' => $pageSize, + 'options' => array( + 'limit' => $pageSize, // if you use it for pagination, option.offset=pageSize*pageNumber 'offset' => $pageSize - 1, - ), )); + ), )); $this->assertEquals($pageSize, $page1['count'], "Check only 10 retrieved in the 1st page " . __LINE__); $this->assertEquals($pageSize, $page2['count'], "Check only 10 retrieved in the 2nd page " . __LINE__); @@ -172,12 +175,14 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { public function testCreateOptionSpecifyComponentID() { $result = $this->callAPISuccess('option_group', 'get', array( 'name' => 'from_email_address', - 'sequential' => 1, 'api.option_value.create' => array('component_id' => 2, 'name' => 'my@y.com'), + 'sequential' => 1, + 'api.option_value.create' => array('component_id' => 2, 'name' => 'my@y.com'), )); $this->assertAPISuccess($result); $optionValueId = $result['values'][0]['api.option_value.create']['id']; $component_id = $this->callAPISuccess('option_value', 'getvalue', array( - 'id' => $optionValueId, 'return' => 'component_id', + 'id' => $optionValueId, + 'return' => 'component_id', )); $this->assertEquals(2, $component_id); } @@ -188,7 +193,8 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { public function testCreateOptionSpecifyComponent() { $result = $this->callAPISuccess('option_group', 'get', array( 'name' => 'from_email_address', - 'sequential' => 1, 'api.option_value.create' => array( + 'sequential' => 1, + 'api.option_value.create' => array( 'component_id' => 'CiviContribute', 'name' => 'my@y.com' ), @@ -197,7 +203,8 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { $this->assertAPISuccess($result); $optionValueId = $result['values'][0]['api.option_value.create']['id']; $component_id = $this->callAPISuccess('option_value', 'getvalue', array( - 'id' => $optionValueId, 'return' => 'component_id', + 'id' => $optionValueId, + 'return' => 'component_id', )); $this->assertEquals(2, $component_id); } @@ -208,7 +215,8 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { public function testCreateOptionSpecifyComponentString() { $result = $this->callAPISuccess('option_group', 'get', array( 'name' => 'from_email_address', - 'sequential' => 1, 'api.option_value.create' => array( + 'sequential' => 1, + 'api.option_value.create' => array( 'component_id' => 'CiviContribute', 'name' => 'my@y.com'), @@ -216,7 +224,8 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { $this->assertAPISuccess($result); $optionValueId = $result['values'][0]['api.option_value.create']['id']; $component_id = $this->callAPISuccess('option_value', 'getvalue', array( - 'id' => $optionValueId, 'return' => 'component_id', + 'id' => $optionValueId, + 'return' => 'component_id', )); $this->assertEquals(2, $component_id); } @@ -228,21 +237,22 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { $optionGroup = $this->callAPISuccess( 'option_group', 'get', array( 'name' => 'gender', - 'sequential' => 1, )); + 'sequential' => 1, )); $this->assertAPISuccess($optionGroup); $params = array( 'option_group_id' => $optionGroup['id'], - 'label' => 'my@y.com', 'weight' => 3, + 'label' => 'my@y.com', + 'weight' => 3, ); - $optionValue = $this->callAPISuccess('option_value', 'create', $params); + $optionValue = $this->callAPISuccess('option_value', 'create', $params); $this->assertAPISuccess($optionValue); $params['weight'] = 4; - $optionValue2 = $this->callAPISuccess('option_value', 'create', $params ); + $optionValue2 = $this->callAPISuccess('option_value', 'create', $params ); $this->assertAPISuccess($optionValue2); $options = $this->callAPISuccess('option_value', 'get', array('option_group_id' => $optionGroup['id'])); $this->assertNotEquals($options['values'][$optionValue['id']]['value'], $options['values'][$optionValue2['id']]['value']); - //cleanup + //cleanup $this->callAPISuccess('option_value', 'delete', array('id' => $optionValue['id'])); $this->callAPISuccess('option_value', 'delete', array('id' => $optionValue2['id'])); } @@ -253,10 +263,10 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { public function testCreateOptionNoName() { $optionGroup = $this->callAPISuccess('option_group', 'get', array( 'name' => 'gender', - 'sequential' => 1, )); + 'sequential' => 1, )); $params = array('option_group_id' => $optionGroup['id'], 'label' => 'my@y.com'); - $optionValue = $this->callAPISuccess('option_value', 'create', $params); + $optionValue = $this->callAPISuccess('option_value', 'create', $params); $this->assertAPISuccess($optionValue); $this->getAndCheck($params, $optionValue['id'], 'option_value'); } @@ -266,7 +276,8 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { * and deleted */ public function testCRM11876CreateOptionPseudoConstantUpdated() { - $optionGroupID = $this->callAPISuccess('option_group', 'getvalue', array( 'name' => 'payment_instrument', + $optionGroupID = $this->callAPISuccess('option_group', 'getvalue', array( + 'name' => 'payment_instrument', 'return' => 'id', )); $newOption = (string) time(); @@ -297,9 +308,10 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { array('option_group_id' => $og['id'], 'label' => 'test option value') ); // update option value without 'option_group_id' - $res = $this->callAPISuccess('option_value', 'create', array('id' => $ov['id'], 'is_active' => 0)); + $res = $this->callAPISuccess('option_value', 'create', array('id' => $ov['id'], 'is_active' => 0)); $val = $this->callAPISuccess('option_value', 'getvalue', array( - 'id' => $ov['id'], 'return' => 'is_active', + 'id' => $ov['id'], + 'return' => 'is_active', )); $this->assertEquals($val, 0, "update with no group id is not proper" . __LINE__); } @@ -318,7 +330,8 @@ class api_v3_OptionValueTest extends CiviUnitTestCase { // update option value without 'option_group_id' $this->callAPISuccess('option_value', 'create', array('id' => $ov['id'], 'option_group_id' => $og['id'], 'is_active' => 0)); $val = $this->callAPISuccess('option_value', 'getvalue', array( - 'id' => $ov['id'], 'return' => 'is_active', + 'id' => $ov['id'], + 'return' => 'is_active', )); $this->assertEquals($val, 0, "update with group id is not proper " . __LINE__); } diff --git a/tests/phpunit/api/v3/ParticipantPaymentTest.php b/tests/phpunit/api/v3/ParticipantPaymentTest.php index af860c0ffd..b81b3511f4 100644 --- a/tests/phpunit/api/v3/ParticipantPaymentTest.php +++ b/tests/phpunit/api/v3/ParticipantPaymentTest.php @@ -31,8 +31,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_participant_* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Event + * @package CiviCRM_APIv3 + * @subpackage API_Event */ class api_v3_ParticipantPaymentTest extends CiviUnitTestCase { @@ -87,7 +87,7 @@ class api_v3_ParticipantPaymentTest extends CiviUnitTestCase { public function testPaymentCreateMissingContributionId() { //Without Payment EntityID $params = array( - 'participant_id' => $this->_participantID, ); + 'participant_id' => $this->_participantID, ); $participantPayment = $this->callAPIFailure('participant_payment', 'create', $params); } @@ -138,7 +138,7 @@ class api_v3_ParticipantPaymentTest extends CiviUnitTestCase { public function testPaymentUpdateMissingParticipantId() { //WithoutParticipantId $params = array( - 'contribution_id' => '3', ); + 'contribution_id' => '3', ); $participantPayment = $this->callAPIFailure('participant_payment', 'create', $params); } @@ -148,7 +148,7 @@ class api_v3_ParticipantPaymentTest extends CiviUnitTestCase { */ public function testPaymentUpdateMissingContributionId() { $params = array( - 'participant_id' => $this->_participantID, ); + 'participant_id' => $this->_participantID, ); $participantPayment = $this->callAPIFailure('participant_payment', 'create', $params); } @@ -164,7 +164,7 @@ class api_v3_ParticipantPaymentTest extends CiviUnitTestCase { $params = array( 'id' => $this->_participantPaymentID, 'participant_id' => $this->_participantID, - 'contribution_id' => $contributionID, ); + 'contribution_id' => $contributionID, ); // Update Payment $participantPayment = $this->callAPISuccess('participant_payment', 'create', $params); @@ -197,7 +197,7 @@ class api_v3_ParticipantPaymentTest extends CiviUnitTestCase { $params = array( 'id' => $this->_participantPaymentID, 'participant_id' => $this->_participantID, - 'contribution_id' => $contributionID, ); + 'contribution_id' => $contributionID, ); // Update Payment $participantPayment = $this->callAPISuccess('participant_payment', 'create', $params); @@ -232,7 +232,7 @@ class api_v3_ParticipantPaymentTest extends CiviUnitTestCase { $params = array( 'id' => $this->_participantPaymentID, 'participant_id' => $this->_participantID, - 'contribution_id' => $contributionID, ); + 'contribution_id' => $contributionID, ); // Update Payment $participantPayment = $this->callAPISuccess('participant_payment', 'create', $params); @@ -270,7 +270,7 @@ class api_v3_ParticipantPaymentTest extends CiviUnitTestCase { */ public function testPaymentDeleteWithWrongID() { $params = array( - 'id' => 0, ); + 'id' => 0, ); $deletePayment = $this->callAPIFailure('participant_payment', 'delete', $params); $this->assertEquals($deletePayment['error_message'], 'Error while deleting participantPayment'); } @@ -342,6 +342,7 @@ class api_v3_ParticipantPaymentTest extends CiviUnitTestCase { 'status_id' => 1, ); break; + case 'payLater': $compareParams = array( 'to_financial_account_id' => 7, diff --git a/tests/phpunit/api/v3/ParticipantStatusTypeTest.php b/tests/phpunit/api/v3/ParticipantStatusTypeTest.php index 0299011f21..a756e3646a 100644 --- a/tests/phpunit/api/v3/ParticipantStatusTypeTest.php +++ b/tests/phpunit/api/v3/ParticipantStatusTypeTest.php @@ -76,8 +76,7 @@ class api_v3_ParticipantStatusTypeTest extends CiviUnitTestCase { $entity = $this->callAPISuccess('participant_status_type', 'get', array()); $result = $this->callAPIAndDocument('participant_status_type', 'delete', array('id' => $ParticipantStatusType['id']), __FUNCTION__, __FILE__); $getCheck = $this->callAPISuccess('ParticipantStatusType', 'GET', array('id' => $ParticipantStatusType['id'])); - $checkDeleted = $this->callAPISuccess('ParticipantStatusType', 'Get', array( - )); + $checkDeleted = $this->callAPISuccess('ParticipantStatusType', 'Get', array()); $this->assertEquals($entity['count'] - 1, $checkDeleted['count'], 'In line ' . __LINE__); } } diff --git a/tests/phpunit/api/v3/ParticipantTest.php b/tests/phpunit/api/v3/ParticipantTest.php index eb68967238..60d1bad52a 100644 --- a/tests/phpunit/api/v3/ParticipantTest.php +++ b/tests/phpunit/api/v3/ParticipantTest.php @@ -145,7 +145,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase { $this->assertEquals($result['values'][$this->_participantID]['event_id'], $this->_eventID, "in line " . __LINE__); $this->assertEquals($result['values'][$this->_participantID]['participant_register_date'], '2007-02-19 00:00:00', "in line " . __LINE__); $this->assertEquals($result['values'][$this->_participantID]['participant_source'], 'Wimbeldon', "in line " . __LINE__); - $params = array( + $params = array( 'id' => $this->_participantID, 'return' => 'id,participant_register_date,event_id', @@ -178,7 +178,6 @@ class api_v3_ParticipantTest extends CiviUnitTestCase { $event = $this->eventCreate(NULL); $this->callAPISuccess('participant', 'create', array('event_id' => $event['id'], 'contact_id' => $this->_contactID)); - $description = "use nested get to get an event"; $subfile = "NestedEventGet"; $params = array( @@ -197,7 +196,8 @@ class api_v3_ParticipantTest extends CiviUnitTestCase { */ public function testGetWithReturnProperties() { $params = array( - 'contact_id' => $this->_contactID, 'return.status_id' => 1, + 'contact_id' => $this->_contactID, + 'return.status_id' => 1, 'return.participant_status_id' => 1, 'options' => array('limit' => 1) ); @@ -210,7 +210,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase { */ public function testGetContactIdOnly() { $params = array( - 'contact_id' => $this->_contactID, ); + 'contact_id' => $this->_contactID, ); $participant = $this->callAPISuccess('participant', 'get', $params); $this->assertEquals($this->_participantID, $participant['id'], @@ -237,7 +237,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase { public function testGetMultiMatchReturnFirst() { $params = array( 'event_id' => $this->_eventID, - 'rowCount' => 1, ); + 'rowCount' => 1, ); $participant = $this->callAPISuccess('participant', 'get', $params); $this->assertNotNull($participant['id']); @@ -580,7 +580,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase { 'role_id' => 3, 'register_date' => '2006-01-21', 'source' => 'US Open', - 'event_level' => 'Donation', ); + 'event_level' => 'Donation', ); $participant = $this->callAPIFailure('participant', 'create', $params); $this->assertEquals($participant['error_message'], 'Mandatory key(s) missing from params array: event_id'); // Cleanup created participant records. @@ -597,7 +597,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase { 'role_id' => 3, 'register_date' => '2006-01-21', 'source' => 'US Open', - 'event_level' => 'Donation', ); + 'event_level' => 'Donation', ); $participant = $this->callAPIFailure('Participant', 'update', $params); } @@ -616,7 +616,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase { 'role_id' => 3, 'register_date' => '2006-01-21', 'source' => 'US Open', - 'event_level' => 'Donation', ); + 'event_level' => 'Donation', ); $participant = $this->callAPIFailure('participant', 'create', $params); $result = $this->participantDelete($participantId); } @@ -644,7 +644,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase { */ public function testParticipantDelete() { $params = array( - 'id' => $this->_participantID, ); + 'id' => $this->_participantID, ); $participant = $this->callAPISuccess('participant', 'delete', $params); $this->assertAPISuccess($participant); $this->assertDBState('CRM_Event_DAO_Participant', $this->_participantID, NULL, TRUE); @@ -657,7 +657,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase { */ public function testParticipantDeleteMissingID() { $params = array( - 'event_id' => $this->_eventID, ); + 'event_id' => $this->_eventID, ); $participant = $this->callAPIFailure('participant', 'delete', $params); $this->assertNotNull($participant['error_message']); } @@ -673,7 +673,7 @@ class api_v3_ParticipantTest extends CiviUnitTestCase { $params = array('contact_id' => $this->_contactID2, 'api.participant.delete' => 1); $participants = $this->callAPIAndDocument('Participant', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile, 'Get'); $check = $this->callAPISuccess('participant', 'getcount', array()); - $this->assertEquals(1, $check,"only one participant should be left. line " . __LINE__); + $this->assertEquals(1, $check, "only one participant should be left. line " . __LINE__); } /** diff --git a/tests/phpunit/api/v3/PaymentProcessorTypeTest.php b/tests/phpunit/api/v3/PaymentProcessorTypeTest.php index 114e5d56ed..e66bf7f873 100644 --- a/tests/phpunit/api/v3/PaymentProcessorTypeTest.php +++ b/tests/phpunit/api/v3/PaymentProcessorTypeTest.php @@ -42,13 +42,13 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase { $this->_apiversion = 3; } -// function tearDown() { -// -// $tablesToTruncate = array( -// 'civicrm_payment_processor_type', -// ); -// $this->quickCleanup($tablesToTruncate); -// } + // function tearDown() { + // + // $tablesToTruncate = array( + // 'civicrm_payment_processor_type', + // ); + // $this->quickCleanup($tablesToTruncate); + // } ///////////////// civicrm_payment_processor_type_add methods @@ -57,7 +57,7 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase { */ public function testPaymentProcessorTypeCreateWithoutName() { $payProcParams = array( - 'is_active' => 1, ); + 'is_active' => 1, ); $result = $this->callAPIFailure('payment_processor_type', 'create', $payProcParams); $this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: name, title, class_name, billing_mode' @@ -68,7 +68,8 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase { * Create payment processor type */ public function testPaymentProcessorTypeCreate() { - $params = array( 'sequential' => 1, + $params = array( + 'sequential' => 1, 'name' => 'API_Test_PP', 'title' => 'API Test Payment Processor', 'class_name' => 'CRM_Core_Payment_APITest', @@ -177,7 +178,7 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase { 'title' => 'API Test Payment Processor 2', 'class_name' => 'CRM_Core_Payment_APITest 2', 'billing_mode' => 2, - 'is_recur' => 0, ); + 'is_recur' => 0, ); $result = $this->callAPISuccess('payment_processor_type', 'create', $params); $this->assertNotNull($result['id']); @@ -191,7 +192,7 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase { * Check with empty array */ public function testPaymentProcessorTypesGetEmptyParams() { - $results = $this->callAPISuccess('payment_processor_type', 'get', array( )); + $results = $this->callAPISuccess('payment_processor_type', 'get', array()); $baselineCount = $results['count']; $firstRelTypeParams = array( @@ -199,7 +200,7 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase { 'title' => 'API Test Payment Processor', 'class_name' => 'CRM_Core_Payment_APITest', 'billing_mode' => 1, - 'is_recur' => 0, ); + 'is_recur' => 0, ); $first = $this->callAPISuccess('PaymentProcessorType', 'Create', $firstRelTypeParams); @@ -208,9 +209,9 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase { 'title' => 'API Test Payment Processor 2', 'class_name' => 'CRM_Core_Payment_APITest 2', 'billing_mode' => 2, - 'is_recur' => 0, ); + 'is_recur' => 0, ); $second = $this->callAPISuccess('PaymentProcessorType', 'Create', $secondRelTypeParams); - $result = $this->callAPISuccess('payment_processor_type', 'get', array( )); + $result = $this->callAPISuccess('payment_processor_type', 'get', array()); $this->assertEquals($baselineCount + 2, $result['count']); $this->assertAPISuccess($result); @@ -225,7 +226,7 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase { 'title' => 'API Test Payment Processor 11', 'class_name' => 'CRM_Core_Payment_APITest_11', 'billing_mode' => 1, - 'is_recur' => 0, ); + 'is_recur' => 0, ); $first = $this->callAPISuccess('PaymentProcessorType', 'Create', $firstRelTypeParams); @@ -234,11 +235,11 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase { 'title' => 'API Test Payment Processor 12', 'class_name' => 'CRM_Core_Payment_APITest_12', 'billing_mode' => 2, - 'is_recur' => 0, ); + 'is_recur' => 0, ); $second = $this->callAPISuccess('PaymentProcessorType', 'Create', $secondRelTypeParams); $params = array( - 'name' => 'API_Test_PP_12', ); + 'name' => 'API_Test_PP_12', ); $result = $this->callAPISuccess('payment_processor_type', 'get', $params); $this->assertAPISuccess($result); diff --git a/tests/phpunit/api/v3/PhoneTest.php b/tests/phpunit/api/v3/PhoneTest.php index e48b18f7c6..01141df86b 100644 --- a/tests/phpunit/api/v3/PhoneTest.php +++ b/tests/phpunit/api/v3/PhoneTest.php @@ -32,8 +32,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_phone* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Contact + * @package CiviCRM_APIv3 + * @subpackage API_Contact */ class api_v3_PhoneTest extends CiviUnitTestCase { protected $_apiversion; @@ -73,7 +73,7 @@ class api_v3_PhoneTest extends CiviUnitTestCase { //create one $create = $this->callAPISuccess('phone', 'create', $this->_params); - $result = $this->callAPIAndDocument('phone', 'delete', array('id' => $create['id'],), __FUNCTION__, __FILE__); + $result = $this->callAPIAndDocument('phone', 'delete', array('id' => $create['id']), __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count'], 'In line ' . __LINE__); $get = $this->callAPISuccess('phone', 'get', array( 'id' => $create['id'], @@ -104,7 +104,7 @@ class api_v3_PhoneTest extends CiviUnitTestCase { public function testGet() { $phone = $this->callAPISuccess('phone', 'create', $this->_params); $params = array( - 'contact_id' => $this->_params['contact_id'], + 'contact_id' => $this->_params['contact_id'], 'phone' => $phone['values'][$phone['id']]['phone'], ); $result = $this->callAPIAndDocument('Phone', 'Get', $params, __FUNCTION__, __FILE__); diff --git a/tests/phpunit/api/v3/PledgePaymentTest.php b/tests/phpunit/api/v3/PledgePaymentTest.php index 1cfbd74928..836237e789 100644 --- a/tests/phpunit/api/v3/PledgePaymentTest.php +++ b/tests/phpunit/api/v3/PledgePaymentTest.php @@ -30,7 +30,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for Pledge API - civicrm_pledge_* * - * @package CiviCRM_APIv3 + * @package CiviCRM_APIv3 */ class api_v3_PledgePaymentTest extends CiviUnitTestCase { @@ -145,7 +145,6 @@ class api_v3_PledgePaymentTest extends CiviUnitTestCase { $contribution = $this->callAPISuccess('contribution', 'create', $contributionParams); $params['contribution_id'] = $contribution['id']; - $resultCont2 = $this->callAPISuccess('pledge_payment', 'create', $params); //make sure original is untouched & has not been updated $this->assertGreaterThan($result['id'], $resultCont2['id'], " in line " . __LINE__); @@ -251,7 +250,7 @@ class api_v3_PledgePaymentTest extends CiviUnitTestCase { ); $result = $this->callAPIAndDocument('pledge_payment', 'update', $updateparams, __FUNCTION__, __FILE__); - $this->getAndCheck(array_merge($params,$updateparams), $result['id'], $this->_entity); + $this->getAndCheck(array_merge($params, $updateparams), $result['id'], $this->_entity); } public function testDeletePledgePayment() { diff --git a/tests/phpunit/api/v3/PledgeTest.php b/tests/phpunit/api/v3/PledgeTest.php index 2f7c073cdd..f67f9e0e21 100644 --- a/tests/phpunit/api/v3/PledgeTest.php +++ b/tests/phpunit/api/v3/PledgeTest.php @@ -30,7 +30,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test class for Pledge API - civicrm_pledge_* * - * @package CiviCRM_APIv3 + * @package CiviCRM_APIv3 */ class api_v3_PledgeTest extends CiviUnitTestCase { @@ -43,7 +43,7 @@ class api_v3_PledgeTest extends CiviUnitTestCase { protected $_params; protected $_entity; protected $scheduled_date; - public $DBResetRequired = True; + public $DBResetRequired = TRUE; public function setUp() { $this->_apiversion = 3; @@ -91,7 +91,7 @@ class api_v3_PledgeTest extends CiviUnitTestCase { $result = $this->callAPISuccess($this->_entity, 'create', $params); $this->assertAPISuccess($result, " testCreateWithCustom "); - $this->assertAPISuccess($result, ' in line ' . __LINE__); + $this->assertAPISuccess($result, ' in line ' . __LINE__); $getparams = array('id' => $result['id'], 'return.custom_' . $ids['custom_field_id'] => 1); $check = $this->callAPISuccess($this->_entity, 'get', $getparams); $this->callAPISuccess('pledge', 'delete', array('id' => $check['id'])); @@ -111,7 +111,6 @@ class api_v3_PledgeTest extends CiviUnitTestCase { public function testGetPledge() { - $this->_pledge = $this->callAPISuccess('pledge', 'create', $this->_params); $params = array( 'pledge_id' => $this->_pledge['id'], @@ -129,7 +128,7 @@ class api_v3_PledgeTest extends CiviUnitTestCase { $this->assertEquals($pledge['pledge_next_pay_amount'], 20.00, 'in line' . __LINE__); $params2 = array( - 'pledge_id' => $this->_pledge['id'], ); + 'pledge_id' => $this->_pledge['id'], ); $pledge = $this->callAPISuccess('pledge', 'delete', $params2); } /** @@ -139,7 +138,8 @@ class api_v3_PledgeTest extends CiviUnitTestCase { $this->_pledge = $this->callAPISuccess('pledge', 'create', $this->_params); $params = array( - 'pledge_id' => $this->_pledge['id'], 'return.pledge_financial_type' => 1, + 'pledge_id' => $this->_pledge['id'], + 'return.pledge_financial_type' => 1, ); $result = $this->callAPISuccess('pledge', 'get', $params); $pledge = $result['values'][$this->_pledge['id']]; @@ -149,12 +149,13 @@ class api_v3_PledgeTest extends CiviUnitTestCase { /** * Test 'return.pledge_contribution_type' => 1 works * This is for legacy compatibility - */ + */ public function testGetPledgewithReturnLegacy() { $this->_pledge = $this->callAPISuccess('pledge', 'create', $this->_params); $params = array( - 'pledge_id' => $this->_pledge['id'], 'return.pledge_financial_type' => 1, + 'pledge_id' => $this->_pledge['id'], + 'return.pledge_financial_type' => 1, ); $result = $this->callAPISuccess('pledge', 'get', $params); $pledge = $result['values'][$this->_pledge['id']]; @@ -212,15 +213,18 @@ class api_v3_PledgeTest extends CiviUnitTestCase { 'create_date' => 'first saturday of march last year', ); $pledge2 = $this->callAPISuccess('pledge', 'create', array_merge($this->_params, $overdueParams)); - $params = array( 'pledge_is_test' => 0, + $params = array( + 'pledge_is_test' => 0, 'rowCount' => 1, ); $result = $this->callAPISuccess('pledge', 'get', $params); - $resultSortedAsc = $this->callAPISuccess('pledge', 'get', array( 'rowCount' => 1, + $resultSortedAsc = $this->callAPISuccess('pledge', 'get', array( + 'rowCount' => 1, 'sort' => 'start_date ASC', )); - $resultSortedDesc = $this->callAPISuccess('pledge', 'get', array( 'rowCount' => 1, + $resultSortedDesc = $this->callAPISuccess('pledge', 'get', array( + 'rowCount' => 1, 'sort' => 'start_date DESC', )); @@ -322,9 +326,9 @@ class api_v3_PledgeTest extends CiviUnitTestCase { } /* - * test that using original_installment_amount rather than pledge_original_installment_amount works - * Pledge field behaviour is a bit random & so pledge has come to try to handle both unique & non -unique fields - */ + * test that using original_installment_amount rather than pledge_original_installment_amount works + * Pledge field behaviour is a bit random & so pledge has come to try to handle both unique & non -unique fields + */ public function testCreatePledgeWithNonUnique() { $params = $this->_params; $params['original_installment_amount'] = $params['pledge_original_installment_amount']; @@ -344,7 +348,6 @@ class api_v3_PledgeTest extends CiviUnitTestCase { public function testCreateCancelPledge() { - $result = $this->callAPISuccess('pledge', 'create', $this->_params); $this->assertEquals(2, $result['values'][0]['status_id'], "in line " . __LINE__); $cancelparams = array('sequential' => 1, 'id' => $result['id'], 'pledge_status_id' => 3); @@ -377,7 +380,7 @@ class api_v3_PledgeTest extends CiviUnitTestCase { $pledgeID = $this->pledgeCreate($this->_individualId); $old_params = array( 'id' => $pledgeID, - 'sequential' => 1, ); + 'sequential' => 1, ); $original = $this->callAPISuccess('pledge', 'get', $old_params); //Make sure it came back $this->assertEquals($original['values'][0]['pledge_id'], $pledgeID, 'In line ' . __LINE__); @@ -387,7 +390,6 @@ class api_v3_PledgeTest extends CiviUnitTestCase { $old_frequency_interval = $original['values'][0]['pledge_frequency_interval']; $old_status_id = $original['values'][0]['pledge_status']; - //check against values in CiviUnitTestCase::createPledge() $this->assertEquals($old_contact_id, $this->_individualId, 'In line ' . __LINE__); $this->assertEquals($old_frequency_unit, 'year', 'In line ' . __LINE__); @@ -400,7 +402,7 @@ class api_v3_PledgeTest extends CiviUnitTestCase { 'amount' => 100, 'financial_type_id' => 1, 'start_date' => date('Ymd'), - 'installments' => 10, ); + 'installments' => 10, ); $pledge = $this->callAPISuccess('pledge', 'create', $params); $new_params = array( @@ -422,7 +424,7 @@ class api_v3_PledgeTest extends CiviUnitTestCase { $pledgeID = $this->pledgeCreate($this->_individualId); $old_params = array( 'id' => $pledgeID, - 'sequential' => 1, ); + 'sequential' => 1, ); $original = $this->callAPISuccess('pledge', 'get', $old_params); //Make sure it came back $this->assertEquals($original['values'][0]['pledge_id'], $pledgeID, 'In line ' . __LINE__); @@ -432,7 +434,6 @@ class api_v3_PledgeTest extends CiviUnitTestCase { $old_frequency_interval = $original['values'][0]['pledge_frequency_interval']; $old_status_id = $original['values'][0]['pledge_status']; - //check against values in CiviUnitTestCase::createPledge() $this->assertEquals($old_contact_id, $this->_individualId, 'In line ' . __LINE__); $this->assertEquals($old_frequency_unit, 'year', 'In line ' . __LINE__); diff --git a/tests/phpunit/api/v3/PriceFieldTest.php b/tests/phpunit/api/v3/PriceFieldTest.php index eb7487600d..f0f4956259 100644 --- a/tests/phpunit/api/v3/PriceFieldTest.php +++ b/tests/phpunit/api/v3/PriceFieldTest.php @@ -55,10 +55,11 @@ class api_v3_PriceFieldTest extends CiviUnitTestCase { 'is_reserved' => 1, ); - $price_set = $this->callAPISuccess('price_set', 'create',$priceSetparams); + $price_set = $this->callAPISuccess('price_set', 'create', $priceSetparams); $this->priceSetID = $price_set['id']; - $this->_params = array( 'price_set_id' => $this->priceSetID, + $this->_params = array( + 'price_set_id' => $this->priceSetID, 'name' => 'grassvariety', 'label' => 'Grass Variety', 'html_type' => 'Text', @@ -74,7 +75,7 @@ class api_v3_PriceFieldTest extends CiviUnitTestCase { ); $this->quickCleanup($tablesToTruncate); - $delete = $this->callAPISuccess('PriceSet','delete', array( + $delete = $this->callAPISuccess('PriceSet', 'delete', array( 'id' => $this->priceSetID, )); @@ -97,16 +98,16 @@ class api_v3_PriceFieldTest extends CiviUnitTestCase { ); $getResult = $this->callAPIAndDocument($this->_entity, 'get', $getParams, __FUNCTION__, __FILE__); $this->assertEquals(1, $getResult['count'], 'In line ' . __LINE__); - $this->callAPISuccess('price_field','delete', array('id' => $createResult['id'])); + $this->callAPISuccess('price_field', 'delete', array('id' => $createResult['id'])); } public function testDeletePriceField() { - $startCount = $this->callAPISuccess($this->_entity, 'getcount', array( )); + $startCount = $this->callAPISuccess($this->_entity, 'getcount', array()); $createResult = $this->callAPISuccess($this->_entity, 'create', $this->_params); $deleteParams = array('id' => $createResult['id']); $deleteResult = $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__); $this->assertAPISuccess($deleteResult, 'In line ' . __LINE__); - $endCount = $this->callAPISuccess($this->_entity, 'getcount', array( )); + $endCount = $this->callAPISuccess($this->_entity, 'getcount', array()); $this->assertEquals($startCount, $endCount, 'In line ' . __LINE__); } diff --git a/tests/phpunit/api/v3/PriceFieldValueTest.php b/tests/phpunit/api/v3/PriceFieldValueTest.php index f1073d0341..c427acad43 100644 --- a/tests/phpunit/api/v3/PriceFieldValueTest.php +++ b/tests/phpunit/api/v3/PriceFieldValueTest.php @@ -56,7 +56,7 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { 'is_reserved' => 1, ); - $price_set = $this->callAPISuccess('price_set', 'create',$priceSetparams); + $price_set = $this->callAPISuccess('price_set', 'create', $priceSetparams); $this->priceSetID = $price_set['id']; $priceFieldparams = array( @@ -67,7 +67,7 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { 'is_enter_qty' => 1, 'is_active' => 1, ); - $priceField = $this->callAPISuccess('price_field','create', $priceFieldparams); + $priceField = $this->callAPISuccess('price_field', 'create', $priceFieldparams); $this->priceFieldID = $priceField['id']; $this->_params = array( 'price_field_id' => $this->priceFieldID, @@ -87,7 +87,7 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { 'is_quick_config' => 1, 'is_reserved' => 1, ); - $price_set1 = $this->callAPISuccess('price_set', 'create',$priceSetparams1); + $price_set1 = $this->callAPISuccess('price_set', 'create', $priceSetparams1); $this->priceSetID1 = $price_set1['id']; $priceFieldparams1 = array( 'price_set_id' => $this->priceSetID1, @@ -97,7 +97,7 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { 'is_enter_qty' => 1, 'is_active' => 1, ); - $priceField1 = $this->callAPISuccess('price_field','create', $priceFieldparams1); + $priceField1 = $this->callAPISuccess('price_field', 'create', $priceFieldparams1); $this->priceFieldID1 = $priceField1['id']; } @@ -108,16 +108,16 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { ); $this->quickCleanup($tablesToTruncate); $this->membershipTypeDelete(array('id' => $this->_membershipTypeID)); - $this->callAPISuccess('PriceField','delete', array( + $this->callAPISuccess('PriceField', 'delete', array( 'id' => $this->priceFieldID1, )); - $this->callAPISuccess('PriceSet','delete', array( + $this->callAPISuccess('PriceSet', 'delete', array( 'id' => $this->priceSetID1, )); - $this->callAPISuccess('PriceField','delete', array( + $this->callAPISuccess('PriceField', 'delete', array( 'id' => $this->priceFieldID, )); - $delete = $this->callAPISuccess('PriceSet','delete', array( + $delete = $this->callAPISuccess('PriceSet', 'delete', array( 'id' => $this->priceSetID, )); @@ -141,7 +141,7 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { ); $getResult = $this->callAPIAndDocument($this->_entity, 'get', $getParams, __FUNCTION__, __FILE__); $this->assertEquals(1, $getResult['count'], 'In line ' . __LINE__); - $this->callAPISuccess('price_field_value','delete', array('id' => $createResult['id'])); + $this->callAPISuccess('price_field_value', 'delete', array('id' => $createResult['id'])); } public function testDeletePriceFieldValue() { @@ -162,7 +162,7 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { public function testCreatePriceFieldValuewithMultipleTerms() { $params = array( 'price_field_id' => $this->priceFieldID1, - 'membership_type_id' => $this->_membershipTypeID, + 'membership_type_id' => $this->_membershipTypeID, 'name' => 'memType1', 'label' => 'memType1', 'amount' => 90, @@ -178,7 +178,7 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { public function testGetPriceFieldValuewithMultipleTerms() { $params1 = array( 'price_field_id' => $this->priceFieldID1, - 'membership_type_id' => $this->_membershipTypeID, + 'membership_type_id' => $this->_membershipTypeID, 'name' => 'memType1', 'label' => 'memType1', 'amount' => 90, @@ -188,7 +188,7 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { ); $params2 = array( 'price_field_id' => $this->priceFieldID1, - 'membership_type_id' => $this->_membershipTypeID, + 'membership_type_id' => $this->_membershipTypeID, 'name' => 'memType2', 'label' => 'memType2', 'amount' => 120, @@ -198,9 +198,9 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase { ); $result1 = $this->callAPISuccess($this->_entity, 'create', $params1); $result2 = $this->callAPISuccess($this->_entity, 'create', $params2); - $result = $this->callAPISuccess($this->_entity, 'get', array('price_field_id' =>$this->priceFieldID1 )); + $result = $this->callAPISuccess($this->_entity, 'get', array('price_field_id' => $this->priceFieldID1 )); $this->assertEquals(2, $result['count'], 'In line ' . __LINE__); - $this->callAPISuccess($this->_entity,'delete', array('id' => $result1['id'])); - $this->callAPISuccess($this->_entity,'delete', array('id' => $result2['id'])); + $this->callAPISuccess($this->_entity, 'delete', array('id' => $result1['id'])); + $this->callAPISuccess($this->_entity, 'delete', array('id' => $result2['id'])); } } diff --git a/tests/phpunit/api/v3/PriceSetTest.php b/tests/phpunit/api/v3/PriceSetTest.php index e23c14f069..84f9a4797b 100644 --- a/tests/phpunit/api/v3/PriceSetTest.php +++ b/tests/phpunit/api/v3/PriceSetTest.php @@ -42,7 +42,7 @@ class api_v3_PriceSetTest extends CiviUnitTestCase { public function setUp() { parent::setUp(); $this->_params = array( -# [domain_id] => + # [domain_id] => 'name' => 'default_goat_priceset', 'title' => 'Goat accessories', 'is_active' => 1, @@ -78,7 +78,7 @@ class api_v3_PriceSetTest extends CiviUnitTestCase { 'title' => 'Some Price Set', 'is_active' => 1, 'financial_type_id' => 1, - 'extends' => array(1,2), + 'extends' => array(1, 2), ); $createResult = $this->callAPIAndDocument($this->_entity, 'create', $createParams, __FUNCTION__, __FILE__); @@ -149,7 +149,7 @@ class api_v3_PriceSetTest extends CiviUnitTestCase { } public static function setUpBeforeClass() { - // put stuff here that should happen before all tests in this unit + // put stuff here that should happen before all tests in this unit } public static function tearDownAfterClass(){ diff --git a/tests/phpunit/api/v3/ProductTest.php b/tests/phpunit/api/v3/ProductTest.php index 1c4bd281fa..1d8fef5839 100644 --- a/tests/phpunit/api/v3/ProductTest.php +++ b/tests/phpunit/api/v3/ProductTest.php @@ -44,9 +44,9 @@ class api_v3_ProductTest extends CiviUnitTestCase { ); } -// function tearDown() { -// $this->quickCleanup(array('civicrm_product'), TRUE); -// } + // function tearDown() { + // $this->quickCleanup(array('civicrm_product'), TRUE); + // } public function testGetFields() { $fields = $this->callAPISuccess($this->_entity, 'getfields', array('action' => 'create')); diff --git a/tests/phpunit/api/v3/ProfileTest.php b/tests/phpunit/api/v3/ProfileTest.php index 130968c76d..c1d0d51e9c 100644 --- a/tests/phpunit/api/v3/ProfileTest.php +++ b/tests/phpunit/api/v3/ProfileTest.php @@ -34,7 +34,7 @@ require_once 'tests/phpunit/CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_profile_* functions * - * @package CiviCRM + * @package CiviCRM */ class api_v3_ProfileTest extends CiviUnitTestCase { protected $_apiversion; @@ -173,8 +173,8 @@ class api_v3_ProfileTest extends CiviUnitTestCase { public function testProfileGetMultipleHasBillingLocation() { $individual = $this->_createIndividualContact(); $contactId = key($individual); - $this->callAPISuccess('address', 'create', array('contact_id' => $contactId , 'street_address' => '25 Big Street', 'city' => 'big city', 'location_type_id' => 5)); - $this->callAPISuccess('email', 'create', array('contact_id' => $contactId , 'email' => 'big@once.com', 'location_type_id' => 2, 'is_billing' => 1)); + $this->callAPISuccess('address', 'create', array('contact_id' => $contactId, 'street_address' => '25 Big Street', 'city' => 'big city', 'location_type_id' => 5)); + $this->callAPISuccess('email', 'create', array('contact_id' => $contactId, 'email' => 'big@once.com', 'location_type_id' => 2, 'is_billing' => 1)); $expected = current($individual); @@ -439,7 +439,7 @@ class api_v3_ProfileTest extends CiviUnitTestCase { } unset($params['email-primary']); $params['email-Primary'] = 'my@mail.com'; - $this->callAPISuccess('profile', 'submit', $params); + $this->callAPISuccess('profile', 'submit', $params); $profileDetails = $this->callAPISuccess('profile', 'get', $getParams); $this->assertEquals('my@mail.com', $profileDetails['values']['email-Primary']); } @@ -458,7 +458,7 @@ class api_v3_ProfileTest extends CiviUnitTestCase { $this->assertEquals(array_keys($membershipTypes['values']), array_keys($getoptions['values'])); $this->assertEquals(array_keys($membershipTypes['values']), array_keys($profileFields['values']['membership_type_id']['options'])); -} + } /** * Test that the fields are returned in the right order despite the faffing around that goes on @@ -827,7 +827,7 @@ class api_v3_ProfileTest extends CiviUnitTestCase { // via the api $ufGroupParams = array( - 'group_type' => 'Individual,Contact',// really we should remove this & test the ufField create sets it + 'group_type' => 'Individual,Contact', // really we should remove this & test the ufField create sets it 'name' => 'test_individual_contact_profile', 'title' => 'Flat Coffee', 'api.uf_field.create' => array( diff --git a/tests/phpunit/api/v3/RelationshipTest.php b/tests/phpunit/api/v3/RelationshipTest.php index 2a8eeaf201..fb7a8c6a53 100644 --- a/tests/phpunit/api/v3/RelationshipTest.php +++ b/tests/phpunit/api/v3/RelationshipTest.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ require_once 'CiviTest/CiviUnitTestCase.php'; @@ -177,7 +177,8 @@ class api_v3_RelationshipTest extends CiviUnitTestCase { 'contact_id_a' => $this->_cId_a, 'contact_id_b' => $this->_cId_b, 'relationship_type_id' => $this->_relTypeID, - 'start_date' => '2008-12-20', 'end_date' => NULL, + 'start_date' => '2008-12-20', + 'end_date' => NULL, 'is_active' => 1, ); $relationship = $this->callAPISuccess('relationship', 'create', $params); @@ -430,7 +431,6 @@ class api_v3_RelationshipTest extends CiviUnitTestCase { 'is_active' => 1, ); - $result = $this->callAPISuccess('CustomField', 'create', $params); $customField = NULL; @@ -677,7 +677,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase { } public function testGetIsCurrent() { - $rel2Params =array( + $rel2Params = array( 'contact_id_a' => $this->_cId_a, 'contact_id_b' => $this->_cId_b2, 'relationship_type_id' => $this->_relTypeID, @@ -698,17 +698,17 @@ class api_v3_RelationshipTest extends CiviUnitTestCase { $this->AssertEquals($rel1['id'], $result['id']); // now try not started - $rel2Params['is_active'] =1; - $rel2Params['start_date'] ='tomorrow'; + $rel2Params['is_active'] = 1; + $rel2Params['start_date'] = 'tomorrow'; $rel2 = $this->callAPISuccess('relationship', 'create', $rel2Params); $result = $this->callAPISuccess('relationship', 'get', $getParams); $this->assertEquals($result['count'], 1); $this->AssertEquals($rel1['id'], $result['id']); // now try finished - $rel2Params['is_active'] =1; - $rel2Params['start_date'] ='last week'; - $rel2Params['end_date'] ='yesterday'; + $rel2Params['is_active'] = 1; + $rel2Params['start_date'] = 'last week'; + $rel2Params['end_date'] = 'yesterday'; $rel2 = $this->callAPISuccess('relationship', 'create', $rel2Params); } /* @@ -749,11 +749,11 @@ class api_v3_RelationshipTest extends CiviUnitTestCase { $rel1 = $this->callAPISuccess('relationship', 'create', $this->_params); $rel2 = $this->callAPISuccess('relationship', 'create', array_merge($this->_params, - array('relationship_type_id' => $relationType2,))); + array('relationship_type_id' => $relationType2))); $rel3 = $this->callAPISuccess('relationship', 'create', array_merge($this->_params, - array('relationship_type_id' => $relationType3,))); + array('relationship_type_id' => $relationType3))); $rel4 = $this->callAPISuccess('relationship', 'create', array_merge($this->_params, - array('relationship_type_id' => $relationType4,))); + array('relationship_type_id' => $relationType4))); $getParams = array( 'relationship_type_id' => array('IN' => array($relationType2, $relationType3)) @@ -791,7 +791,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase { ); $result = $this->callAPIAndDocument('relationship', 'get', $getParams, __FUNCTION__, __FILE__, $description, $subfile); $this->assertEquals($result['count'], 1); - $this->AssertEquals(array($rel1['id'],), array_keys($result['values'])); + $this->AssertEquals(array($rel1['id']), array_keys($result['values'])); } /** @@ -895,7 +895,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase { * an incorrect one */ public function testGetRelationshipByTypeDAO() { - $this->ids['relationship'] = $this->callAPISuccess($this->_entity, 'create', array('format.only_id' => TRUE,) + $this->_params); + $this->ids['relationship'] = $this->callAPISuccess($this->_entity, 'create', array('format.only_id' => TRUE) + $this->_params); $result = $this->callAPISuccess($this->_entity, 'getcount', array( 'contact_id_a' => $this->_cId_a,), 1); @@ -1047,7 +1047,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase { * an incorrect one */ public function testGetRelationshipByMembershipTypeReciprocal() { - $created = $this->callAPISuccess($this->_entity, 'create', $this->_params); + $created = $this->callAPISuccess($this->_entity, 'create', $this->_params); $org3 = $this->organizationCreate(); $relType2 = 5; // lets just assume built in ones aren't being messed with! diff --git a/tests/phpunit/api/v3/RelationshipTypeTest.php b/tests/phpunit/api/v3/RelationshipTypeTest.php index d0b15dbc6b..da1daf94c4 100644 --- a/tests/phpunit/api/v3/RelationshipTypeTest.php +++ b/tests/phpunit/api/v3/RelationshipTypeTest.php @@ -178,7 +178,7 @@ class api_v3_RelationshipTypeTest extends CiviUnitTestCase { $id = $this->_relationshipTypeCreate(); // create sample relationship type. $params = array( - 'id' => $id, + 'id' => $id, ); $result = $this->callAPIAndDocument('relationship_type', 'delete', $params, __FUNCTION__, __FILE__); $this->assertAPIDeleted('relationship_type', $id); diff --git a/tests/phpunit/api/v3/ReportTemplateTest.php b/tests/phpunit/api/v3/ReportTemplateTest.php index fc739265ca..b661d685a1 100644 --- a/tests/phpunit/api/v3/ReportTemplateTest.php +++ b/tests/phpunit/api/v3/ReportTemplateTest.php @@ -31,8 +31,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_report_instance_* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Report + * @package CiviCRM_APIv3 + * @subpackage API_Report */ class api_v3_ReportTemplateTest extends CiviUnitTestCase { @@ -63,7 +63,8 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase { WHERE name = "CRM_Report_Form_Examplez"'); // change component to null - $result = $this->callAPISuccess('ReportTemplate', 'create', array( 'id' => $entityId, + $result = $this->callAPISuccess('ReportTemplate', 'create', array( + 'id' => $entityId, 'component' => '', )); $this->assertAPISuccess($result); @@ -76,7 +77,8 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase { AND component_id IS NULL'); // deactivate - $result = $this->callAPISuccess('ReportTemplate', 'create', array( 'id' => $entityId, + $result = $this->callAPISuccess('ReportTemplate', 'create', array( + 'id' => $entityId, 'is_active' => 0, )); $this->assertAPISuccess($result); @@ -88,7 +90,8 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase { WHERE name = "CRM_Report_Form_Examplez"'); // activate - $result = $this->callAPISuccess('ReportTemplate', 'create', array( 'id' => $entityId, + $result = $this->callAPISuccess('ReportTemplate', 'create', array( + 'id' => $entityId, 'is_active' => 1, )); $this->assertAPISuccess($result); @@ -139,7 +142,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase { if(stristr($reportID, 'has existing issues')) { $this->markTestIncomplete($reportID); } - $result = $this->callAPISuccess('report_template', 'getrows', array( + $result = $this->callAPISuccess('report_template', 'getrows', array( 'report_id' => $reportID, )); } @@ -151,7 +154,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase { if(stristr($reportID, 'has existing issues')) { $this->markTestIncomplete($reportID); } - if(in_array($reportID , array('contribute/softcredit', 'contribute/bookkeeping'))) { + if(in_array($reportID, array('contribute/softcredit', 'contribute/bookkeeping'))) { $this->markTestIncomplete($reportID . " has non enotices when calling statistics fn"); } $description = "Get Statistics from a report (note there isn't much data to get in the test DB :-("; @@ -166,7 +169,7 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase { */ public static function getReportTemplates() { $reportsToSkip = array( - 'activity' => 'does not respect function signature on from clause', + 'activity' => 'does not respect function signature on from clause', 'walklist' => 'Notice: Undefined index: type in CRM_Report_Form_Walklist_Walklist line 155. (suspect the select function should be removed in favour of the parent (state province field) also, type should be added to state province & others? & potentially getAddressColumns fn should be @@ -196,8 +199,6 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase { } } - - return $reportTemplates; } } diff --git a/tests/phpunit/api/v3/SettingTest.php b/tests/phpunit/api/v3/SettingTest.php index 8e4d31b092..d276964fb8 100644 --- a/tests/phpunit/api/v3/SettingTest.php +++ b/tests/phpunit/api/v3/SettingTest.php @@ -31,8 +31,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_setting_* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Core + * @package CiviCRM_APIv3 + * @subpackage API_Core */ /** @@ -53,21 +53,21 @@ class api_v3_SettingTest extends CiviUnitTestCase { $params = array( 'name' => 'Default Domain Name', ); - $result = $this->callAPISuccess( 'domain','get',$params); + $result = $this->callAPISuccess( 'domain', 'get', $params); if(empty($result['id'])){ - $result = $this->callAPISuccess( 'domain','create',$params ); + $result = $this->callAPISuccess( 'domain', 'create', $params ); } $params['name'] = 'Second Domain'; - $result = $this->callAPISuccess( 'domain','get',$params); + $result = $this->callAPISuccess( 'domain', 'get', $params); if(empty($result['id'])){ - $result = $this->callAPISuccess( 'domain','create',$params ); + $result = $this->callAPISuccess( 'domain', 'create', $params ); } $this->_domainID2 = $result['id']; $params['name'] = 'A-team domain'; - $result = $this->callAPISuccess( 'domain','get',$params); + $result = $this->callAPISuccess( 'domain', 'get', $params); if(empty($result['id'])){ - $result = $this->callAPISuccess( 'domain','create',$params ); + $result = $this->callAPISuccess( 'domain', 'create', $params ); } $this->_domainID3 = $result['id']; $this->_currentDomain = CRM_Core_Config::domainID(); @@ -77,7 +77,7 @@ class api_v3_SettingTest extends CiviUnitTestCase { public function tearDown() { CRM_Utils_Hook::singleton()->reset(); parent::tearDown(); - $this->callAPISuccess('system','flush', array()); + $this->callAPISuccess('system', 'flush', array()); $this->quickCleanup(array('civicrm_domain')); } @@ -101,7 +101,7 @@ class api_v3_SettingTest extends CiviUnitTestCase { $description = 'Demonstrate return from getfields'; $result = $this->callAPISuccess('setting', 'getfields', array()); $this->assertArrayHasKey('customCSSURL', $result['values']); - $this->callAPISuccess('system','flush', array()); + $this->callAPISuccess('system', 'flush', array()); } /** @@ -109,8 +109,8 @@ class api_v3_SettingTest extends CiviUnitTestCase { */ public function testGetFieldsCaching() { $settingsMetadata = array(); - CRM_Core_BAO_Cache::setItem($settingsMetadata,'CiviCRM setting Specs', 'settingsMetadata__'); - CRM_Core_BAO_Cache::setItem($settingsMetadata,'CiviCRM setting Spec', 'All'); + CRM_Core_BAO_Cache::setItem($settingsMetadata, 'CiviCRM setting Specs', 'settingsMetadata__'); + CRM_Core_BAO_Cache::setItem($settingsMetadata, 'CiviCRM setting Spec', 'All'); $result = $this->callAPISuccess('setting', 'getfields', array()); $this->assertArrayNotHasKey('customCSSURL', $result['values']); $this->quickCleanup(array('civicrm_cache')); @@ -120,7 +120,7 @@ class api_v3_SettingTest extends CiviUnitTestCase { $params = array('name' => 'advanced_search_options'); $result = $this->callAPISuccess('setting', 'getfields', $params); $this->assertArrayNotHasKey('customCSSURL', $result['values']); - $this->assertArrayHasKey('advanced_search_options',$result['values']); + $this->assertArrayHasKey('advanced_search_options', $result['values']); } /** @@ -130,7 +130,7 @@ class api_v3_SettingTest extends CiviUnitTestCase { $params = array('filters' => array('group' => 'multisite')); $result = $this->callAPISuccess('setting', 'getfields', $params); $this->assertArrayNotHasKey('customCSSURL', $result['values']); - $this->assertArrayHasKey('domain_group_id',$result['values']); + $this->assertArrayHasKey('domain_group_id', $result['values']); } /** @@ -140,7 +140,7 @@ class api_v3_SettingTest extends CiviUnitTestCase { $params = array('filters' => array('prefetch' => 1)); $result = $this->callAPISuccess('setting', 'getfields', $params); $this->assertArrayNotHasKey('disable_mandatory_tokens_check', $result['values']); - $this->assertArrayHasKey('monetaryDecimalPoint',$result['values']); + $this->assertArrayHasKey('monetaryDecimalPoint', $result['values']); } /** @@ -220,7 +220,7 @@ class api_v3_SettingTest extends CiviUnitTestCase { ); $result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__); - $params = array('uniq_email_per_site' => 1,); + $params = array('uniq_email_per_site' => 1); $description = "shows setting a variable for a current domain"; $result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__, $description, 'CreateSettingCurrentDomain'); $this->assertArrayHasKey(CRM_Core_Config::domainID(), $result['values']); @@ -263,18 +263,19 @@ class api_v3_SettingTest extends CiviUnitTestCase { ); $result = $this->callAPIFailure('setting', 'create', $params); - $params = array('track_civimail_replies' => '0',); + $params = array('track_civimail_replies' => '0'); $result = $this->callAPISuccess('setting', 'create', $params); - $getResult = $this->callAPISuccess('setting','get',$params); + $getResult = $this->callAPISuccess('setting', 'get', $params); $this->assertEquals(0, $getResult['values'][$this->_currentDomain]['track_civimail_replies']); - $getResult = $this->callAPISuccess('setting','get',$params); + $getResult = $this->callAPISuccess('setting', 'get', $params); $this->assertEquals(0, $getResult['values'][$this->_currentDomain]['track_civimail_replies']); - $params = array( 'domain_id' => $this->_domainID2, + $params = array( + 'domain_id' => $this->_domainID2, 'track_civimail_replies' => '1', ); $result = $this->callAPISuccess('setting', 'create', $params); - $getResult = $this->callAPISuccess('setting','get',$params); + $getResult = $this->callAPISuccess('setting', 'get', $params); $this->assertEquals(1, $getResult['values'][$this->_domainID2]['track_civimail_replies']); $params = array( @@ -282,7 +283,7 @@ class api_v3_SettingTest extends CiviUnitTestCase { 'track_civimail_replies' => 'TRUE', ); $result = $this->callAPISuccess('setting', 'create', $params); - $getResult = $this->callAPISuccess('setting','get',$params); + $getResult = $this->callAPISuccess('setting', 'get', $params); $this->assertEquals(1, $getResult['values'][$this->_domainID2]['track_civimail_replies'], "check TRUE is converted to 1"); } @@ -297,7 +298,7 @@ class api_v3_SettingTest extends CiviUnitTestCase { 'domain_id' => 'all', 'uniq_email_per_site' => 1, ); - $result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__,$description, 'CreateAllDomains'); + $result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__, $description, 'CreateAllDomains'); $this->assertEquals(1, $result['values'][2]['uniq_email_per_site']); $this->assertEquals(1, $result['values'][1]['uniq_email_per_site']); @@ -310,27 +311,27 @@ class api_v3_SettingTest extends CiviUnitTestCase { ); // we'll check it with a 'get' $description = "shows getting a variable for all domains"; - $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__,$description, 'GetAllDomains', 'Get'); + $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetAllDomains', 'Get'); $this->assertEquals(1, $result['values'][2]['uniq_email_per_site']); $this->assertEquals(1, $result['values'][1]['uniq_email_per_site']); $this->assertEquals(1, $result['values'][3]['uniq_email_per_site']); $params = array( - 'domain_id' => array(1,3), + 'domain_id' => array(1, 3), 'uniq_email_per_site' => 0, ); $description = "shows setting a variable for specified domains"; - $result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__,$description, 'CreateSpecifiedDomains'); + $result = $this->callAPIAndDocument('setting', 'create', $params, __FUNCTION__, __FILE__, $description, 'CreateSpecifiedDomains'); $this->assertEquals(0, $result['values'][3]['uniq_email_per_site']); $this->assertEquals(0, $result['values'][1]['uniq_email_per_site']); $params = array( - 'domain_id' => array(1,2), + 'domain_id' => array(1, 2), 'return' => array('uniq_email_per_site'), ); $description = "shows getting a variable for specified domains"; - $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__,$description, 'GetSpecifiedDomains', 'Get'); + $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetSpecifiedDomains', 'Get'); $this->assertEquals(1, $result['values'][2]['uniq_email_per_site']); $this->assertEquals(0, $result['values'][1]['uniq_email_per_site']); @@ -343,13 +344,13 @@ class api_v3_SettingTest extends CiviUnitTestCase { ); $description = "shows get setting a variable for a given domain - if no domain is set current is assumed"; - $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__); + $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__); $params = array( 'return' => 'uniq_email_per_site', ); $description = "shows getting a variable for a current domain"; - $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetSettingCurrentDomain'); + $result = $this->callAPIAndDocument('setting', 'get', $params, __FUNCTION__, __FILE__, $description, 'GetSettingCurrentDomain'); $this->assertArrayHasKey(CRM_Core_Config::domainID(), $result['values']); } @@ -396,7 +397,8 @@ class api_v3_SettingTest extends CiviUnitTestCase { */ public function testGetConfigSetting() { $settings = $this->callAPISuccess('setting', 'get', array( - 'name' => 'defaultCurrency', 'sequential' => 1,) + 'name' => 'defaultCurrency', + 'sequential' => 1,) ); $this->assertEquals('USD', $settings['values'][0]['defaultCurrency']); } @@ -406,13 +408,16 @@ class api_v3_SettingTest extends CiviUnitTestCase { */ public function testGetSetConfigSettingMultipleDomains() { $settings = $this->callAPISuccess('setting', 'create', array( - 'defaultCurrency' => 'USD', 'domain_id' => $this->_currentDomain) + 'defaultCurrency' => 'USD', + 'domain_id' => $this->_currentDomain) ); $settings = $this->callAPISuccess('setting', 'create', array( - 'defaultCurrency' => 'CAD', 'domain_id' => $this->_domainID2) + 'defaultCurrency' => 'CAD', + 'domain_id' => $this->_domainID2) ); $settings = $this->callAPISuccess('setting', 'get', array( - 'return' => 'defaultCurrency', 'domain_id' => 'all', + 'return' => 'defaultCurrency', + 'domain_id' => 'all', ) ); $this->assertEquals('USD', $settings['values'][$this->_currentDomain]['defaultCurrency']); @@ -425,7 +430,8 @@ class api_v3_SettingTest extends CiviUnitTestCase { * Use getValue against a config setting */ public function testGetValueConfigSetting() { - $params = array( 'name' => 'monetaryThousandSeparator', + $params = array( + 'name' => 'monetaryThousandSeparator', 'group' => 'Localization Setting', ); $result = $this->callAPISuccess('setting', 'getvalue', $params); @@ -433,7 +439,8 @@ class api_v3_SettingTest extends CiviUnitTestCase { } public function testGetValue() { - $params = array( 'name' => 'petition_contacts', + $params = array( + 'name' => 'petition_contacts', 'group' => 'Campaign Preferences' ); $description = "Demonstrates getvalue action - intended for runtime use as better caching than get"; @@ -448,9 +455,9 @@ class api_v3_SettingTest extends CiviUnitTestCase { $params = array( 'name' => 'address_format', ); - $result = $this->callAPIAndDocument('setting', 'getdefaults', $params, __FUNCTION__, __FILE__,$description,'GetDefaults','getdefaults'); + $result = $this->callAPIAndDocument('setting', 'getdefaults', $params, __FUNCTION__, __FILE__, $description, 'GetDefaults', 'getdefaults'); $this->assertEquals("{contact.address_name}\n{contact.street_address}\n{contact.supplemental_address_1}\n{contact.supplemental_address_2}\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\n{contact.country}", $result['values'][CRM_Core_Config::domainID()]['address_format']); - $params = array('name' => 'mailing_format',); + $params = array('name' => 'mailing_format'); $result = $this->callAPISuccess('setting', 'getdefaults', $params); $this->assertEquals("{contact.addressee}\n{contact.street_address}\n{contact.supplemental_address_1}\n{contact.supplemental_address_2}\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\n{contact.country}", $result['values'][CRM_Core_Config::domainID()]['mailing_format']); $this->assertArrayHasKey(CRM_Core_Config::domainID(), $result['values']); @@ -460,22 +467,25 @@ class api_v3_SettingTest extends CiviUnitTestCase { * Function tests reverting a specific parameter */ public function testRevert() { - $params = array( 'address_format' => 'xyz', + $params = array( + 'address_format' => 'xyz', 'mailing_format' => 'bcs', ); $result = $this->callAPISuccess('setting', 'create', $params); $this->assertAPISuccess($result, "in line " . __LINE__); - $revertParams = array( 'name' => 'address_format' + $revertParams = array( + 'name' => 'address_format' ); $result = $this->callAPISuccess('setting', 'get', $params); //make sure it's set $this->assertEquals('xyz', $result['values'][CRM_Core_Config::domainID()]['address_format']); $description = "Demonstrates reverting a parameter to default value"; - $result = $this->callAPIAndDocument('setting', 'revert', $revertParams, __FUNCTION__, __FILE__,$description,'','revert'); + $result = $this->callAPIAndDocument('setting', 'revert', $revertParams, __FUNCTION__, __FILE__, $description, '', 'revert'); //make sure it's reverted $result = $this->callAPISuccess('setting', 'get', $params); $this->assertEquals("{contact.address_name}\n{contact.street_address}\n{contact.supplemental_address_1}\n{contact.supplemental_address_2}\n{contact.city}{, }{contact.state_province}{ }{contact.postal_code}\n{contact.country}", $result['values'][CRM_Core_Config::domainID()]['address_format']); - $params = array( 'return' => array('mailing_format'), + $params = array( + 'return' => array('mailing_format'), ); $result = $this->callAPISuccess('setting', 'get', $params); //make sure it's unchanged @@ -486,11 +496,12 @@ class api_v3_SettingTest extends CiviUnitTestCase { * Tests reverting ALL parameters (specific domain) */ public function testRevertAll() { - $params = array( 'address_format' => 'xyz', + $params = array( + 'address_format' => 'xyz', 'mailing_format' => 'bcs', ); $result = $this->callAPISuccess('setting', 'create', $params); - $revertParams = array( ); + $revertParams = array(); $result = $this->callAPISuccess('setting', 'get', $params); //make sure it's set $this->assertEquals('xyz', $result['values'][CRM_Core_Config::domainID()]['address_format']); @@ -513,16 +524,18 @@ class api_v3_SettingTest extends CiviUnitTestCase { $params = array( 'domain_id' => 'all', ); $result = $this->callAPISuccess('setting', 'get', $params); - $params = array( 'address_format' => 'xyz', + $params = array( + 'address_format' => 'xyz', 'mailing_format' => 'bcs', 'domain_id' => $this->_domainID2, ); $result = $this->callAPISuccess('setting', 'create', $params); - $params = array( 'domain_id' => $dom['id'], + $params = array( + 'domain_id' => $dom['id'], ); $result = $this->callAPISuccess('setting', 'get', $params); $this->assertAPISuccess($result, "in line " . __LINE__); - $this->assertArrayNotHasKey('tag_unconfirmed', $result['values'][$dom['id']],'setting for domain 3 should not be set. Debug this IF domain test is passing'); + $this->assertArrayNotHasKey('tag_unconfirmed', $result['values'][$dom['id']], 'setting for domain 3 should not be set. Debug this IF domain test is passing'); $result = $this->callAPISuccess('setting', 'fill', $params); $this->assertAPISuccess($result, "in line " . __LINE__); $result = $this->callAPISuccess('setting', 'get', $params); diff --git a/tests/phpunit/api/v3/SurveyRespondantTest.php b/tests/phpunit/api/v3/SurveyRespondantTest.php index ddd1ac4815..128e02fa49 100644 --- a/tests/phpunit/api/v3/SurveyRespondantTest.php +++ b/tests/phpunit/api/v3/SurveyRespondantTest.php @@ -31,7 +31,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; * Class api_v3_SurveyRespondantTest */ class api_v3_SurveyRespondantTest extends CiviUnitTestCase { - protected $_apiversion =3; + protected $_apiversion = 3; protected $params; @@ -47,8 +47,8 @@ class api_v3_SurveyRespondantTest extends CiviUnitTestCase { ); $survey = $this->callAPISuccess('survey', 'create', $surveyParams); $surveyID = $survey['id']; - $this->params = array ( - 'sequential' =>'1', + $this->params = array( + 'sequential' => '1', 'survey_id' => $surveyID ); } @@ -57,7 +57,7 @@ class api_v3_SurveyRespondantTest extends CiviUnitTestCase { * Test survey respondent get. */ public function testGetSurveyRespondants() { - $result = $this->callAPIAndDocument("SurveyRespondant","get", $this->params, __FUNCTION__, __FILE__); + $result = $this->callAPIAndDocument("SurveyRespondant", "get", $this->params, __FUNCTION__, __FILE__); } } diff --git a/tests/phpunit/api/v3/SurveyTest.php b/tests/phpunit/api/v3/SurveyTest.php index 5cca43e1ee..1ad88c415f 100644 --- a/tests/phpunit/api/v3/SurveyTest.php +++ b/tests/phpunit/api/v3/SurveyTest.php @@ -88,14 +88,13 @@ class api_v3_SurveyTest extends CiviUnitTestCase { $this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__); } -/** - * Check the delete function succeeds - */ + /** + * Check the delete function succeeds + */ public function testDeleteSurvey() { $entity = $this->createTestEntity(); $result = $this->callAPIAndDocument('survey', 'delete', array('id' => $entity['id']), __FUNCTION__, __FILE__); - $checkDeleted = $this->callAPISuccess($this->entity, 'get', array( - )); + $checkDeleted = $this->callAPISuccess($this->entity, 'get', array()); $this->assertEquals(0, $checkDeleted['count'], 'In line ' . __LINE__); } diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 8ce24368e4..851118bd93 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -79,7 +79,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { $this->toBeImplemented['get'] = array('Profile', 'CustomValue', 'Constant', 'CustomSearch', 'Extension', 'ReportTemplate', 'System', 'Setting'); $this->toBeImplemented['create'] = array('SurveyRespondant', 'OptionGroup', 'MailingRecipients', 'UFMatch', 'LocationType', 'CustomSearch', 'Extension', 'ReportTemplate', 'System'); $this->toBeImplemented['delete'] = array('MembershipPayment', 'OptionGroup', 'SurveyRespondant', 'UFJoin', 'UFMatch', 'Extension', 'LocationType', 'System'); - $this->onlyIDNonZeroCount['get'] = array('ActivityType', 'Entity', 'Domain','Setting'); + $this->onlyIDNonZeroCount['get'] = array('ActivityType', 'Entity', 'Domain', 'Setting'); $this->deprecatedAPI = array('Location', 'ActivityType', 'SurveyRespondant'); $this->deletableTestObjects = array(); } @@ -185,10 +185,10 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { foreach ($entities as $entityName => $entity ) { if(!in_array($entityName, $invalidEntities) && !in_array($entityName, $entitiesToFix)) { - if(!empty(self::$componentMap[$entityName]) && empty($enabledComponents[self::$componentMap[$entityName]])) { - CRM_Core_BAO_ConfigSetting::enableComponent(self::$componentMap[$entityName]); - } - $customDataEntities[] = array($entityName); + if(!empty(self::$componentMap[$entityName]) && empty($enabledComponents[self::$componentMap[$entityName]])) { + CRM_Core_BAO_ConfigSetting::enableComponent(self::$componentMap[$entityName]); + } + $customDataEntities[] = array($entityName); } } return $customDataEntities; @@ -267,7 +267,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { public static function toBeSkipped_getfields($sequential = FALSE) { $entitiesWithMetadataNotYetFixed = array('ReportTemplate', 'CustomSearch'); if ($sequential === TRUE) { - return $entitiesWithMetadataNotYetFixed ; + return $entitiesWithMetadataNotYetFixed; } $entities = array(); foreach ($entitiesWithMetadataNotYetFixed as $e) { @@ -275,13 +275,13 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { } return $entities; } -/** - * Generate list of entities to test for get by id functions - * @param bool $sequential - * @return array Entities to be skipped - */ + /** + * Generate list of entities to test for get by id functions + * @param bool $sequential + * @return array Entities to be skipped + */ public static function toBeSkipped_automock($sequential = FALSE) { - $entitiesWithoutGet = array('MailingContact', 'EntityTag', 'Participant', 'ParticipantPayment', 'Setting', 'SurveyRespondant', 'MailingRecipients', 'CustomSearch', 'Extension', 'ReportTemplate', 'System'); + $entitiesWithoutGet = array('MailingContact', 'EntityTag', 'Participant', 'ParticipantPayment', 'Setting', 'SurveyRespondant', 'MailingRecipients', 'CustomSearch', 'Extension', 'ReportTemplate', 'System'); if ($sequential === TRUE) { return $entitiesWithoutGet; } @@ -294,8 +294,8 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { /** - * At this stage exclude the ones that don't pass & add them as we can troubleshoot them - */ + * At this stage exclude the ones that don't pass & add them as we can troubleshoot them + */ public static function toBeSkipped_updatesingle($sequential = FALSE) { $entitiesWithout = array( 'Attachment', // pseudo-entity; testUpdateSingleValueAlter doesn't introspect properly on it. Multiple magic fields @@ -371,7 +371,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { */ public static function toBeSkipped_getlimit() { $entitiesWithout = array( - 'Case',//case api has non-std mandatory fields one of (case_id, contact_id, activity_id, contact_id) + 'Case', //case api has non-std mandatory fields one of (case_id, contact_id, activity_id, contact_id) 'EntityTag', // non-standard api - has inappropriate mandatory fields & doesn't implement limit 'Event', // failed 'check that a 5 limit returns 5' - probably is_template field is wrong or something, or could be limit doesn't work right 'Extension', // can't handle creating 25 @@ -386,7 +386,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { */ public static function toBeSkipped_getSqlOperators() { $entitiesWithout = array( - 'Case',//case api has non-std mandatory fields one of (case_id, contact_id, activity_id, contact_id) + 'Case', //case api has non-std mandatory fields one of (case_id, contact_id, activity_id, contact_id) 'Contact', // on the todo list! 'EntityTag', // non-standard api - has inappropriate mandatory fields & doesn't implement limit 'Extension', // can't handle creating 25 @@ -418,10 +418,9 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { 'Address' => array( 'cant_update' => array( 'state_province_id', //issues with country id - need to ensure same country - 'master_id',//creates relationship + 'master_id', //creates relationship ), - 'cant_return' => array( - ) + 'cant_return' => array() ), 'Batch' => array( 'cant_update' => array( @@ -481,10 +480,8 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { 'cant_update' => array( 'billing_mode', ), - 'break_return' => array( - ), - 'cant_return' => array( - ), + 'break_return' => array(), + 'cant_return' => array(), ), 'PriceFieldValue' => array( 'cant_update' => array( @@ -502,13 +499,13 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { /** * @dataProvider toBeSkipped_get - entities that don't need a get action + entities that don't need a get action */ public function testNotImplemented_get($Entity) { $result = civicrm_api($Entity, 'Get', array('version' => 3)); $this->assertEquals(1, $result['is_error'], 'In line ' . __LINE__); // $this->assertContains("API ($Entity, Get) does not exist", $result['error_message']); - $this->assertRegExp('/API (.*) does not exist/', $result['error_message']); + $this->assertRegExp('/API (.*) does not exist/', $result['error_message']); } /** @@ -861,7 +858,6 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { return; } - $this->assertArrayHasKey('version', $result); $this->assertEquals(3, $result['version']); if (!in_array($Entity, $this->onlyIDNonZeroCount['get'])) { @@ -873,7 +869,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { /** * @dataProvider toBeSkipped_create - entities that don't need a create action + entities that don't need a create action */ public function testNotImplemented_create($Entity) { $result = civicrm_api($Entity, 'Create', array('version' => 3)); @@ -955,14 +951,14 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { $fields = $fields['values']; $return = array_keys($fieldsGet['values']); $valuesNotToReturn = $this->getKnownUnworkablesUpdateSingle($entityName, 'break_return'); - // these can't be requested as return values + // these can't be requested as return values $entityValuesThatDoNotWork = array_merge( $this->getKnownUnworkablesUpdateSingle($entityName, 'cant_update'), $this->getKnownUnworkablesUpdateSingle($entityName, 'cant_return'), $valuesNotToReturn ); - $return = array_diff($return,$valuesNotToReturn); + $return = array_diff($return, $valuesNotToReturn); $baoObj = new CRM_Core_DAO(); $baoObj->createTestObject($baoString, array('currency' => 'USD'), 2, 0); @@ -987,7 +983,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { $fieldName = $specs['uniquename']; } if ($field == 'currency' || $field == 'id' || $field == strtolower($entityName) . '_id' - || in_array($field,$entityValuesThatDoNotWork)) { + || in_array($field, $entityValuesThatDoNotWork)) { //@todo id & entity_id are correct but we should fix currency & frequency_day continue; } @@ -997,6 +993,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { case CRM_Utils_Type::T_TIMESTAMP: $entity[$fieldName] = '2012-05-20'; break; + //case CRM_Utils_Type::T_DATETIME: case 12: @@ -1009,7 +1006,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { case CRM_Utils_Type::T_TEXT: case CRM_Utils_Type::T_LONGTEXT: case CRM_Utils_Type::T_EMAIL: - $entity[$fieldName] = substr('New String',0, CRM_Utils_Array::Value('maxlength',$specs,100)); + $entity[$fieldName] = substr('New String', 0, CRM_Utils_Array::Value('maxlength', $specs, 100)); break; case CRM_Utils_Type::T_INT: @@ -1027,7 +1024,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { $resetFKTo = array($fieldName => $entity[$fieldName]); } $entity[$fieldName] = (string) empty($entity2[$field]) ? CRM_Utils_Array::value($uniqueName, $entity2) : $entity2[$field]; - //todo - there isn't always something set here - & our checking on unset values is limited + //todo - there isn't always something set here - & our checking on unset values is limited if (empty($entity[$field])) { unset($entity[$field]); } @@ -1105,7 +1102,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { /** * @dataProvider toBeSkipped_delete - entities that don't need a delete action + entities that don't need a delete action */ public function testNotImplemented_delete($Entity) { $nonExistantID = 151416349; @@ -1188,7 +1185,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { $this->callAPISuccess($entityName, 'delete', array('id' => $baoObj2->id)); //make sure 1 less exists now $result = $this->callAPISuccess($entityName, 'getcount', array(), - ($createcount + $startCount) -1 + ($createcount + $startCount) - 1 ); //make sure id #1 exists @@ -1212,7 +1209,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { if (in_array($entity, $entities)) { $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, $entity . 'Test.php'); } - $actions = $this->callAPISuccess($entity, 'getactions', array()); + $actions = $this->callAPISuccess($entity, 'getactions', array()); foreach ($actions['values'] as $action) { if (substr($action, -7) == '_create' || substr($action, -4) == '_get' || substr($action, -7) == '_delete') { //getactions can't distinguish between contribution_page.create & contribution_page.create @@ -1261,7 +1258,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { $baos = array(); $i = 0; while($i < $count) { - // create entities + // create entities $baoObj = CRM_Core_DAO::createTestObject($baoString, array('currency' => 'USD')); $this->assertTrue(is_integer($baoObj->id), 'check first id'); $this->deletableTestObjects[$baoString][] = $baoObj->id; @@ -1328,8 +1325,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { // Verify that chaining handles decoding $chainResult = $this->callAPISuccess('Event', 'Get', array( 'id' => $eventId, - 'api.event.get' => array( - ), + 'api.event.get' => array(), )); $this->assertEquals('CiviCRM <> TheRest', $chainResult['values'][$eventId]['title']); $this->assertEquals('TheRest <> CiviCRM', $chainResult['values'][$eventId]['description']); @@ -1353,7 +1349,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { )); //$this->assertTrue((bool)$setValueDescriptionResult['is_error']); // not supported by setValue $this->assertEquals('setValueDescription: TheRest <> CiviCRM', $setValueDescriptionResult['values']['description']); -} + } /** * Verify that write operations (create/update) use partial HTML-encoding diff --git a/tests/phpunit/api/v3/TagTest.php b/tests/phpunit/api/v3/TagTest.php index 777204175b..58fd439b83 100644 --- a/tests/phpunit/api/v3/TagTest.php +++ b/tests/phpunit/api/v3/TagTest.php @@ -31,12 +31,12 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_tag_* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Core + * @package CiviCRM_APIv3 + * @subpackage API_Core */ class api_v3_TagTest extends CiviUnitTestCase { - protected $_apiversion =3; + protected $_apiversion = 3; /** * @ids array of values to be cleaned up in the tear down */ @@ -102,7 +102,7 @@ class api_v3_TagTest extends CiviUnitTestCase { * Test civicrm_tag_create with empty params. */ public function testCreateEmptyParams() { - $result = $this->callAPIFailure('tag', 'create', array(),'Mandatory key(s) missing from params array: name'); + $result = $this->callAPIFailure('tag', 'create', array(), 'Mandatory key(s) missing from params array: name'); } /** diff --git a/tests/phpunit/api/v3/TaxContributionPageTest.php b/tests/phpunit/api/v3/TaxContributionPageTest.php index 5e282b402f..78df4ce089 100644 --- a/tests/phpunit/api/v3/TaxContributionPageTest.php +++ b/tests/phpunit/api/v3/TaxContributionPageTest.php @@ -67,7 +67,7 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase { 'pay_later_text' => 'I will pay later', 'pay_later_receipt' => "I will pay later", 'is_monetary' => TRUE, - 'is_billing_required' => True + 'is_billing_required' => TRUE ); $this->_priceSetParams = array( @@ -81,7 +81,7 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase { 'is_quick_config' => 0, 'is_reserved' => 0 ); - // Financial Account with 20% tax rate + // Financial Account with 20% tax rate $financialAccountSetparams = array( #[domain_id] => 'name' => 'vat full taxrate account'.substr(sha1(rand()), 0, 7), @@ -103,7 +103,7 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase { 'is_reserved' => 0, 'is_active' => 1, ); - $priceField = $this->callAPISuccess('financial_type','create', $financialType); + $priceField = $this->callAPISuccess('financial_type', 'create', $financialType); $this->financialtypeID = $priceField['id']; $financialRelationParams = array( 'entity_table' => 'civicrm_financial_type', @@ -133,7 +133,7 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase { ); $halfFinancialType = CRM_Financial_BAO_FinancialType::add($halfFinancialtypeHalftax); - $this->halfFinancialTypeId = $halfFinancialType->id ; + $this->halfFinancialTypeId = $halfFinancialType->id; $financialRelationHalftax = array( 'entity_table' => 'civicrm_financial_type', 'entity_id' => $this->halfFinancialTypeId, @@ -144,7 +144,7 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase { $halfFinancialRelation = CRM_Financial_BAO_FinancialTypeAccount::add($financialRelationHalftax); // Enable component contribute setting - $contributeSetting = array ( + $contributeSetting = array( 'invoicing' => 1, 'invoice_prefix' => 'INV_', 'credit_notes_prefix' => 'CN_', @@ -259,7 +259,7 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase { $this->_ids['contributionId'] = $contribution['id']; $this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId, 'In line ' . __LINE__); $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 120.00, 'In line ' . __LINE__); - $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],$this->financialtypeID, 'In line ' . __LINE__ ); + $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID, 'In line ' . __LINE__ ); $this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345, 'In line ' . __LINE__); $this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890, 'In line ' . __LINE__); $this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF', 'In line ' . __LINE__); @@ -300,9 +300,9 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase { $description = "Create Contribution with Nested Line Items"; $subfile = "CreateWithNestedLineItems"; - $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__,__FILE__, $description, $subfile); + $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile); - $lineItems = $this->callAPISuccess('line_item','get',array( + $lineItems = $this->callAPISuccess('line_item', 'get', array( 'entity_id' => $contribution['id'], 'contribution_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution', @@ -328,7 +328,7 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase { $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__); $this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId, 'In line ' . __LINE__); $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 120.00, 'In line ' . __LINE__); - $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],$this->financialtypeID, 'In line ' . __LINE__ ); + $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID, 'In line ' . __LINE__ ); $this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345, 'In line ' . __LINE__); $this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890, 'In line ' . __LINE__); $this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF', 'In line ' . __LINE__); @@ -353,7 +353,7 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase { $contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__); $this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId, 'In line ' . __LINE__); $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 120.00, 'In line ' . __LINE__); - $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'],$this->financialtypeID, 'In line ' . __LINE__ ); + $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID, 'In line ' . __LINE__ ); $this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345, 'In line ' . __LINE__); $this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890, 'In line ' . __LINE__); $this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF', 'In line ' . __LINE__); @@ -377,7 +377,7 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase { 'contribution_status_id' => 1, ); $contribution = $this->callAPISuccess('contribution', 'create', $this->contributionParams); - $lineItems = $this->callAPISuccess('line_item','getvalue', array( + $lineItems = $this->callAPISuccess('line_item', 'getvalue', array( 'entity_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution', 'sequential' => 1, @@ -393,7 +393,7 @@ class api_v3_TaxContributionPageTest extends CiviUnitTestCase { ); $contribution = $this->callAPISuccess('contribution', 'update', $newParams); - $lineItems = $this->callAPISuccess('line_item','getvalue',array( + $lineItems = $this->callAPISuccess('line_item', 'getvalue', array( 'entity_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution', 'sequential' => 1, diff --git a/tests/phpunit/api/v3/UFGroupTest.php b/tests/phpunit/api/v3/UFGroupTest.php index cfa2d3e6b9..515f63b690 100644 --- a/tests/phpunit/api/v3/UFGroupTest.php +++ b/tests/phpunit/api/v3/UFGroupTest.php @@ -31,7 +31,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; * Test class for UFGroup API - civicrm_uf_* * @todo Split UFGroup and UFJoin tests * - * @package CiviCRM + * @package CiviCRM */ class api_v3_UFGroupTest extends CiviUnitTestCase { // ids from the uf_group_test.xml fixture @@ -39,7 +39,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase { protected $_ufFieldId; protected $_contactId; protected $_groupId; - protected $_apiversion =3; + protected $_apiversion = 3; protected $params; protected function setUp() { @@ -50,7 +50,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase { $ufGroup = $this->callAPISuccess('uf_group', 'create', array( 'group_type' => 'Contact', 'help_pre' => 'Profile to Test API', - 'title' =>'Test Profile', + 'title' => 'Test Profile', )); $this->_ufGroupId = $ufGroup['id']; $ufMatch = $this->callAPISuccess('uf_match', 'create', array( @@ -160,7 +160,7 @@ class api_v3_UFGroupTest extends CiviUnitTestCase { 'name' => 'test_group', 'notify' => 'admin@example.org', 'post_URL' => 'http://example.org/post', - 'title' => 'Test Group', ); + 'title' => 'Test Group', ); $result = $this->callAPISuccess('uf_group', 'create', $params); $params['created_date'] = date('YmdHis', strtotime($params['created_date'])); foreach ($params as $key => $value) { diff --git a/tests/phpunit/api/v3/UFJoinTest.php b/tests/phpunit/api/v3/UFJoinTest.php index fc020f86e3..39ba60a7d3 100644 --- a/tests/phpunit/api/v3/UFJoinTest.php +++ b/tests/phpunit/api/v3/UFJoinTest.php @@ -34,7 +34,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; * Test class for UFGroup API - civicrm_uf_* * @todo Split UFGroup and UFJoin tests * - * @package CiviCRM + * @package CiviCRM */ class api_v3_UFJoinTest extends CiviUnitTestCase { // ids from the uf_group_test.xml fixture @@ -86,12 +86,12 @@ class api_v3_UFJoinTest extends CiviUnitTestCase { 'entity_id' => 1, 'weight' => 1, 'uf_group_id' => $this->_ufGroupId, - 'is_active' => 1, ); + 'is_active' => 1, ); $ufJoin = $this->callAPISuccess('uf_join', 'create', $params); $searchParams = array( 'entity_table' => 'civicrm_contribution_page', - 'entity_id' => 1, ); + 'entity_id' => 1, ); $result = $this->callAPISuccess('uf_join', 'get', $searchParams); foreach ($result['values'] as $key => $value) { @@ -118,7 +118,7 @@ class api_v3_UFJoinTest extends CiviUnitTestCase { 'entity_table' => 'civicrm_contribution_page', 'entity_id' => 1, 'weight' => 1, - 'is_active' => 1, ); + 'is_active' => 1, ); $result = $this->callAPIFailure('uf_join', 'create', $params); $this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: uf_group_id', 'In line ' . __LINE__); } @@ -133,7 +133,8 @@ class api_v3_UFJoinTest extends CiviUnitTestCase { 'entity_id' => 1, 'weight' => 1, 'uf_group_id' => $this->_ufGroupId, - 'is_active' => 1, 'sequential' => 1, + 'is_active' => 1, + 'sequential' => 1, ); $ufJoin = $this->callAPIAndDocument('uf_join', 'create', $params, __FUNCTION__, __FILE__); $this->assertEquals($ufJoin['values'][0]['module'], $params['module'], 'In line ' . __LINE__); @@ -147,7 +148,8 @@ class api_v3_UFJoinTest extends CiviUnitTestCase { 'entity_id' => 1, 'weight' => 1, 'uf_group_id' => $this->_ufGroupId, - 'is_active' => 0, 'sequential' => 1, + 'is_active' => 0, + 'sequential' => 1, ); $ufJoinUpdated = $this->callAPISuccess('uf_join', 'create', $params); $this->assertEquals($ufJoinUpdated['values'][0]['module'], $params['module'], 'In line ' . __LINE__); @@ -189,12 +191,13 @@ class api_v3_UFJoinTest extends CiviUnitTestCase { 'entity_id' => 1, 'weight' => 1, 'uf_group_id' => $this->_ufGroupId, - 'is_active' => 1, ); + 'is_active' => 1, ); $ufJoin = $this->callAPISuccess('uf_join', 'create', $params); $searchParams = array( 'entity_table' => 'civicrm_contribution_page', - 'entity_id' => 1, 'sequential' => 1, + 'entity_id' => 1, + 'sequential' => 1, ); $result = $this->callAPIAndDocument('uf_join', 'get', $searchParams, __FUNCTION__, __FILE__); diff --git a/tests/phpunit/api/v3/UFMatchTest.php b/tests/phpunit/api/v3/UFMatchTest.php index 3b1020fb39..2c0952caee 100644 --- a/tests/phpunit/api/v3/UFMatchTest.php +++ b/tests/phpunit/api/v3/UFMatchTest.php @@ -34,7 +34,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; * Test class for UFGroup API - civicrm_uf_* * @todo Split UFGroup and UFJoin tests * - * @package CiviCRM + * @package CiviCRM */ class api_v3_UFMatchTest extends CiviUnitTestCase { // ids from the uf_group_test.xml fixture @@ -135,11 +135,14 @@ class api_v3_UFMatchTest extends CiviUnitTestCase { public function testDelete() { $result = $this->callAPISuccess('uf_match', 'create', $this->_params); - $this->assertEquals(1, $this->callAPISuccess('uf_match', 'getcount', array( 'id' => $result['id'], + $this->assertEquals(1, $this->callAPISuccess('uf_match', 'getcount', array( + 'id' => $result['id'], ))); - $this->callAPISuccess('uf_match', 'delete', array( 'id' => $result['id'], + $this->callAPISuccess('uf_match', 'delete', array( + 'id' => $result['id'], )); - $this->assertEquals(0, $this->callAPISuccess('uf_match', 'getcount', array('id' => $result['id'], + $this->assertEquals(0, $this->callAPISuccess('uf_match', 'getcount', array( + 'id' => $result['id'], ))); } } diff --git a/tests/phpunit/api/v3/UtilsTest.php b/tests/phpunit/api/v3/UtilsTest.php index beb4f01635..4276ed4d3e 100644 --- a/tests/phpunit/api/v3/UtilsTest.php +++ b/tests/phpunit/api/v3/UtilsTest.php @@ -253,7 +253,9 @@ class api_v3_UtilsTest extends CiviUnitTestCase { $params = array( 'registration_start_date' => 20080601, - 'registration_end_date' => '2008-10-15', 'start_date' => '2010-12-20', 'end_date' => '', + 'registration_end_date' => '2008-10-15', + 'start_date' => '2010-12-20', + 'end_date' => '', ); $fields = civicrm_api3('Event', 'getfields', array('action' => 'create')); _civicrm_api3_validate_fields('event', 'create', $params, $fields['values']); diff --git a/tests/phpunit/api/v3/WebsiteTest.php b/tests/phpunit/api/v3/WebsiteTest.php index f13023a1ea..9c96449dd6 100644 --- a/tests/phpunit/api/v3/WebsiteTest.php +++ b/tests/phpunit/api/v3/WebsiteTest.php @@ -31,8 +31,8 @@ require_once 'CiviTest/CiviUnitTestCase.php'; /** * Test APIv3 civicrm_website_* functions * - * @package CiviCRM_APIv3 - * @subpackage API_Contact + * @package CiviCRM_APIv3 + * @subpackage API_Contact */ class api_v3_WebsiteTest extends CiviUnitTestCase { @@ -90,7 +90,8 @@ class api_v3_WebsiteTest extends CiviUnitTestCase { */ public function testGetMetadata() { $result = $this->callAPIAndDocument($this->_entity, 'get', array( - 'options' => array('metadata' => array('fields') + 'options' => array( + 'metadata' => array('fields') )), __FUNCTION__, __FILE__, 'Demonostrates returning field metadata', 'GetWithMetadata'); $this->assertEquals('Website', $result['metadata']['fields']['url']['title']); } diff --git a/tests/phpunit/api/v3/settings/test.setting.php b/tests/phpunit/api/v3/settings/test.setting.php index 866582f988..3f1edd1c5d 100644 --- a/tests/phpunit/api/v3/settings/test.setting.php +++ b/tests/phpunit/api/v3/settings/test.setting.php @@ -9,7 +9,7 @@ return array( 'is_domain' => 1, 'is_contact' => 0, 'description' => 'Test Key', - 'title' => 'Test Key', + 'title' => 'Test Key', 'help_text' => '', 'html_type' => 'Text', 'quick_form_type' => 'Element', -- 2.25.1