From b6708aebbc04438be1e5a8a97213d0fc9a89d483 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 13 May 2013 14:23:19 +1200 Subject: [PATCH] CRM-12595 fix formatting in tests files --- tests/extensions/README.txt | 2 +- .../info.xml | 2 +- .../info.xml | 2 +- .../CRM/Contact/BAO/GroupContactCacheTest.php | 10 +- tests/phpunit/CRM/Core/JobManagerTest.php | 28 +- tests/phpunit/CRM/Core/Page/AJAXTest.php | 2 +- .../CRM/Core/Payment/AuthorizeNetTest.php | 4 +- .../Extension/Container/CollectionTest.php | 28 +- .../CRM/Extension/Manager/ModuleTest.php | 4 +- .../CRM/Extension/Manager/PaymentTest.php | 28 +- tests/phpunit/CRM/Extension/ManagerTest.php | 28 +- .../test.crm.extension.browsertest.a.xml | 2 +- .../phpunit/CRM/Member/Form/dataset/data.xml | 8 +- tests/phpunit/CRM/Queue/Queue/SqlTest.php | 4 +- tests/phpunit/CRM/Queue/RunnerTest.php | 4 +- tests/phpunit/CRM/Utils/SignerTest.php | 32 +- tests/phpunit/CRM/Utils/SystemTest.php | 2 +- tests/phpunit/CRM/Utils/ZipTest.php | 41 +- tests/phpunit/CiviTest/AuthorizeNet.php | 4 +- .../CiviTest/ReleaseTestSettings.php.txt | 30 +- .../Activity/ContactContextAddTest.php | 6 +- .../WebTest/Admin/CustomAddTestSameField.php | 48 +- .../Financial/FinancialBatchExport.php | 234 ++--- tests/phpunit/api/v3/ACLPermissionTest.php | 1 - tests/phpunit/api/v3/APIStandardsTest.php | 4 +- tests/phpunit/api/v3/APITest.php | 1 - tests/phpunit/api/v3/ActivityTest.php | 2 +- tests/phpunit/api/v3/ActivityTypeTest.php | 1 - tests/phpunit/api/v3/AddressTest.php | 1 - tests/phpunit/api/v3/CampaignTest.php | 27 +- tests/phpunit/api/v3/ContactTest.php | 2 +- tests/phpunit/api/v3/CustomFieldTest.php | 27 +- tests/phpunit/api/v3/CustomValueTest.php | 27 +- tests/phpunit/api/v3/DomainTest.php | 1 - tests/phpunit/api/v3/EmailTest.php | 26 +- tests/phpunit/api/v3/EventTest.php | 3 +- tests/phpunit/api/v3/GroupContactTest.php | 1 - tests/phpunit/api/v3/GroupNestingTest.php | 1 - .../phpunit/api/v3/GroupOrganizationTest.php | 1 - tests/phpunit/api/v3/JobTest.php | 1 - tests/phpunit/api/v3/LineItemTest.php | 27 +- tests/phpunit/api/v3/LocBlockTest.php | 27 +- tests/phpunit/api/v3/MailSettingsTest.php | 26 +- tests/phpunit/api/v3/MailingGroupTest.php | 50 +- .../phpunit/api/v3/MembershipPaymentTest.php | 1 - tests/phpunit/api/v3/MembershipStatusTest.php | 1 - tests/phpunit/api/v3/OptionGroupTest.php | 26 +- .../api/v3/ParticipantStatusTypeTest.php | 26 +- tests/phpunit/api/v3/PaymentProcessorTest.php | 1 - .../api/v3/PaymentProcessorTypeTest.php | 1 - tests/phpunit/api/v3/PledgePaymentTest.php | 2 +- tests/phpunit/api/v3/PriceFieldTest.php | 27 +- tests/phpunit/api/v3/PriceFieldValueTest.php | 29 +- tests/phpunit/api/v3/PriceSetTest.php | 27 +- tests/phpunit/api/v3/ProfileTest.php | 27 +- tests/phpunit/api/v3/RelationshipTypeTest.php | 27 +- tests/phpunit/api/v3/SurveyRespondantTest.php | 6 +- tests/phpunit/api/v3/SystemTest.php | 35 +- tests/phpunit/api/v3/UFFieldTest.php | 839 +++++++++--------- tests/phpunit/api/v3/UFGroupTest.php | 1 - tests/phpunit/api/v3/UFJoinTest.php | 1 - tests/phpunit/api/v3/UFMatchTest.php | 1 - tests/phpunit/api/v3/UtilsTest.php | 9 +- tests/phpunit/api/v3/dataset/acl_1_all.xml | 2 +- .../api/v3/dataset/activity_1_emailed.xml | 2 +- .../api/v3/dataset/activity_4_created.xml | 4 +- .../api/v3/dataset/activity_type_5.xml | 4 +- tests/phpunit/api/v3/dataset/contact_hld.xml | 4 +- .../api/v3/dataset/contact_hld_upd.xml | 4 +- tests/phpunit/api/v3/dataset/contact_ind.xml | 4 +- tests/phpunit/api/v3/dataset/contact_org.xml | 4 +- .../api/v3/dataset/contact_org_upd.xml | 4 +- .../api/v3/dataset/contribution_types.xml | 10 +- .../api/v3/dataset/financial_accounts.xml | 14 +- .../option_value_from_email_address.xml | 26 +- .../api/v3/Contact/ExampleAction2.php | 1 - .../api/v3/Generic/ExampleAction1.php | 1 - .../api/v3/Generic/ExampleAction2.php | 1 - .../v3/dataset/resolver/api/v3/TestEntity.php | 1 - .../api/v3/dataset/uf_field_uf_group_25.xml | 2 +- .../configuration/AdultDayCareReferral.xml | 4 +- .../Case/xml/configuration/HousingSupport.xml | 6 +- .../CRM/Case/xml/configuration/Settings.xml | 40 +- tests/qunit/README.txt | 6 +- 84 files changed, 1267 insertions(+), 774 deletions(-) diff --git a/tests/extensions/README.txt b/tests/extensions/README.txt index 427ad8aa2d..6140e5a6a7 100644 --- a/tests/extensions/README.txt +++ b/tests/extensions/README.txt @@ -1,6 +1,6 @@ Extensions in the "test.*" namespace are used for testing the extension system. All "test.*" extensions are automatically uninstalled in between -test runs. +test runs. Note: For simplicity and performance, the automatic uninstallation may bypass the normal lifecycle events (hook_install, hook_enable, hook_disable, diff --git a/tests/extensions/test.extension.manager.reporttest/info.xml b/tests/extensions/test.extension.manager.reporttest/info.xml index eafdaf18b5..f145a50256 100644 --- a/tests/extensions/test.extension.manager.reporttest/info.xml +++ b/tests/extensions/test.extension.manager.reporttest/info.xml @@ -3,6 +3,6 @@ test_extension_manager_reporttest test/extension/manager/reporttest - CiviContribute + CiviContribute diff --git a/tests/extensions/test.extension.manager.searchtest/info.xml b/tests/extensions/test.extension.manager.searchtest/info.xml index ffedaca773..93a2ca28f6 100644 --- a/tests/extensions/test.extension.manager.searchtest/info.xml +++ b/tests/extensions/test.extension.manager.searchtest/info.xml @@ -3,6 +3,6 @@ test_extension_manager_searchtest test/extension/manager/searchtest - CiviContribute + CiviContribute diff --git a/tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php b/tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php index ea60b1ff66..35f2c5bb87 100644 --- a/tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php +++ b/tests/phpunit/CRM/Contact/BAO/GroupContactCacheTest.php @@ -90,7 +90,7 @@ class CRM_Contact_BAO_GroupContactCacheTest extends CiviUnitTestCase { $group->id ); } - + /** * Allow removing contact from a parent group even if contact is in * a child group. (CRM-8858) @@ -135,7 +135,7 @@ class CRM_Contact_BAO_GroupContactCacheTest extends CiviUnitTestCase { array($deceased[0]->id, $deceased[1]->id, $deceased[2]->id), $parent->id ); - + // Remove $c1 from $parent $result = civicrm_api('group_contact', 'create', array( 'contact_id' => $deceased[0]->id, @@ -144,16 +144,16 @@ class CRM_Contact_BAO_GroupContactCacheTest extends CiviUnitTestCase { 'version' => '3', )); $this->assertAPISuccess($result); - + // Assert $c1 not in $parent CRM_Contact_BAO_GroupContactCache::load($parent, TRUE); $this->assertCacheMatches( array( /* deceased[0], */ $deceased[1]->id, $deceased[2]->id), $parent->id ); - + // Assert $c1 still in $child - $this->assertDBQuery(1, + $this->assertDBQuery(1, 'select count(*) from civicrm_group_contact where group_id=%1 and contact_id=%2 and status=%3', array( 1 => array($child->id, 'Integer'), diff --git a/tests/phpunit/CRM/Core/JobManagerTest.php b/tests/phpunit/CRM/Core/JobManagerTest.php index d64ff70f41..f76e3df97a 100644 --- a/tests/phpunit/CRM/Core/JobManagerTest.php +++ b/tests/phpunit/CRM/Core/JobManagerTest.php @@ -1,5 +1,29 @@ getMock('stdClass', array('civicrm_cron')); $hook->expects($this->once()) diff --git a/tests/phpunit/CRM/Core/Page/AJAXTest.php b/tests/phpunit/CRM/Core/Page/AJAXTest.php index a5b711a7a4..35c9dfb75d 100644 --- a/tests/phpunit/CRM/Core/Page/AJAXTest.php +++ b/tests/phpunit/CRM/Core/Page/AJAXTest.php @@ -40,7 +40,7 @@ class CRM_Core_Page_AJAXTest extends CiviUnitTestCase { $cases[] = array('class', 'CRM_Contact_Page_Inline_Phone', TRUE); $cases[] = array('', 'CRM_Foo_Bar', FALSE); $cases[] = array('', 'CRM_Contact_Page_Inline_Demographics', TRUE); - + // invalid type $cases[] = array('invalidtype', 'CRM_Foo_Page_Inline_Bar', FALSE); $cases[] = array('invalidtype', 'CRM_Foo_Page_AJAX::method', FALSE); diff --git a/tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php b/tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php index 91db8f10e4..11619b5542 100644 --- a/tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php +++ b/tests/phpunit/CRM/Core/Payment/AuthorizeNetTest.php @@ -194,7 +194,7 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase { $subscriptionID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionRecur', $recur->id, 'processor_id'); $result = $this->processor->cancelSubscription($message, array('subscriptionId' => $subscriptionID)); $this->assertTrue($result, 'Failed to cancel subscription with Authorize.'); - + Contact::delete($contactId); } @@ -335,7 +335,7 @@ class CRM_Core_Payment_AuthorizeNetTest extends CiviUnitTestCase { $subscriptionID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionRecur', $recur->id, 'processor_id'); $result = $this->processor->cancelSubscription($message, array('subscriptionId' => $subscriptionID)); $this->assertTrue($result, 'Failed to cancel subscription with Authorize.'); - + Contact::delete($contactId); } } diff --git a/tests/phpunit/CRM/Extension/Container/CollectionTest.php b/tests/phpunit/CRM/Extension/Container/CollectionTest.php index cd30052db7..5d9774a02c 100644 --- a/tests/phpunit/CRM/Extension/Container/CollectionTest.php +++ b/tests/phpunit/CRM/Extension/Container/CollectionTest.php @@ -1,5 +1,29 @@ _createContainer(); - $this->assertEquals(array('test.conflict', 'test.whiz', 'test.whizbang', 'test.foo', 'test.foo.bar'), $c->getKeys()); + $this->assertEquals(array('test.conflict', 'test.whiz', 'test.whizbang', 'test.foo', 'test.foo.bar'), $c->getKeys()); } function testGetPath() { diff --git a/tests/phpunit/CRM/Extension/Manager/ModuleTest.php b/tests/phpunit/CRM/Extension/Manager/ModuleTest.php index 14cbbb7e2f..b777b65387 100644 --- a/tests/phpunit/CRM/Extension/Manager/ModuleTest.php +++ b/tests/phpunit/CRM/Extension/Manager/ModuleTest.php @@ -249,12 +249,12 @@ class CRM_Extension_Manager_ModuleTest extends CiviUnitTestCase { $this->system->getCache()->flush(); $this->system->getManager()->refresh(); } - + public static function incHookCount($module, $name) { global $_test_extension_manager_moduletest_counts; $_test_extension_manager_moduletest_counts[$module][$name] = 1 + (int) $_test_extension_manager_moduletest_counts[$module][$name]; } - + const MODULE_TEMPLATE = " system->getManager(); $this->assertDBQuery(0, 'SELECT count(*) FROM civicrm_payment_processor_type WHERE class_name = "test.extension.manager.paymenttest"'); - + $manager->install(array('test.extension.manager.paymenttest')); $this->assertEquals(1, test_extension_manager_paymenttest::$counts['install']); $this->assertDBQuery(1, 'SELECT count(*) FROM civicrm_payment_processor_type WHERE class_name = "test.extension.manager.paymenttest" AND is_active = 1'); diff --git a/tests/phpunit/CRM/Extension/ManagerTest.php b/tests/phpunit/CRM/Extension/ManagerTest.php index ee11ae4382..52b637ac3d 100644 --- a/tests/phpunit/CRM/Extension/ManagerTest.php +++ b/tests/phpunit/CRM/Extension/ManagerTest.php @@ -1,5 +1,29 @@ _createManager(array( self::TESTING_TYPE => $testingTypeManager, )); - + // initial installation $this->assertEquals('uninstalled', $manager->getStatus('test.whiz.bang')); $manager->install(array('test.whiz.bang')); diff --git a/tests/phpunit/CRM/Extension/dataset/good-repository/test.crm.extension.browsertest.a.xml b/tests/phpunit/CRM/Extension/dataset/good-repository/test.crm.extension.browsertest.a.xml index c4b81c1ed8..4898b996ab 100644 --- a/tests/phpunit/CRM/Extension/dataset/good-repository/test.crm.extension.browsertest.a.xml +++ b/tests/phpunit/CRM/Extension/dataset/good-repository/test.crm.extension.browsertest.a.xml @@ -6,6 +6,6 @@ http://example.com/test.crm.extension.browsertest.a-0.1.zip test/extension/browsertest/a - CiviContribute + CiviContribute diff --git a/tests/phpunit/CRM/Member/Form/dataset/data.xml b/tests/phpunit/CRM/Member/Form/dataset/data.xml index 77178f8d19..b16145cf2f 100644 --- a/tests/phpunit/CRM/Member/Form/dataset/data.xml +++ b/tests/phpunit/CRM/Member/Form/dataset/data.xml @@ -82,7 +82,7 @@ weight="1" is_default="0" is_active="1" - is_reserved="0" + is_reserved="0" /> diff --git a/tests/phpunit/CRM/Queue/Queue/SqlTest.php b/tests/phpunit/CRM/Queue/Queue/SqlTest.php index 158122985c..9c3f3f11ac 100644 --- a/tests/phpunit/CRM/Queue/Queue/SqlTest.php +++ b/tests/phpunit/CRM/Queue/Queue/SqlTest.php @@ -104,7 +104,7 @@ class CRM_Queue_Queue_SqlTest extends CiviUnitTestCase { $this->queue->createItem( array( 'test-key' => 'start', - ), + ), array( 'weight' => -1, ) @@ -112,7 +112,7 @@ class CRM_Queue_Queue_SqlTest extends CiviUnitTestCase { $this->queue->createItem( array( 'test-key' => 'end', - ), + ), array( 'weight' => 1, ) diff --git a/tests/phpunit/CRM/Queue/RunnerTest.php b/tests/phpunit/CRM/Queue/RunnerTest.php index a4f2ec1323..6dd3f381ee 100644 --- a/tests/phpunit/CRM/Queue/RunnerTest.php +++ b/tests/phpunit/CRM/Queue/RunnerTest.php @@ -54,7 +54,7 @@ class CRM_Queue_RunnerTest extends CiviUnitTestCase { function tearDown() { unset($this->queue); unset($this->queueService); - + CRM_Utils_Time::resetTime(); $tablesToTruncate = array('civicrm_queue_item'); @@ -257,7 +257,7 @@ class CRM_Queue_RunnerTest extends CiviUnitTestCase { function _throwException($taskCtx, $value) { throw new Exception("Manufactured error: $value"); } - + static function _enqueueNumbers($taskCtx, $low, $high) { for ($i = $low; $i <= $high; $i++) { diff --git a/tests/phpunit/CRM/Utils/SignerTest.php b/tests/phpunit/CRM/Utils/SignerTest.php index 9ba1fceb01..576a6e8f2c 100644 --- a/tests/phpunit/CRM/Utils/SignerTest.php +++ b/tests/phpunit/CRM/Utils/SignerTest.php @@ -1,5 +1,29 @@ TRUE, ); - + foreach ($cases as $caseId => $case) { require_once 'CRM/Utils/Signer.php'; $signer = new CRM_Utils_Signer('secret', array('a', 'b', 'c')); $signature = $signer->sign($case['signParams']); $this->assertTrue(!empty($signature) && is_string($signature)); // arbitrary - + $validator = new CRM_Utils_Signer('secret', array('a', 'b', 'c')); // same as $signer but physically separate $isValid = $validator->validate($signature, $case['validateParams']); - + if ($isValid !== $case['isValid']) { $this->fail("Case ${caseId}: Mismatch: " . var_export($case, TRUE)); } diff --git a/tests/phpunit/CRM/Utils/SystemTest.php b/tests/phpunit/CRM/Utils/SystemTest.php index 23780e135f..37f065b868 100644 --- a/tests/phpunit/CRM/Utils/SystemTest.php +++ b/tests/phpunit/CRM/Utils/SystemTest.php @@ -23,7 +23,7 @@ class CRM_Utils_SystemTest extends CiviUnitTestCase { $actual = CRM_Utils_System::url('civicrm/foo/bar', 'foo=ab&bar=cd%26ef', false, null, false); $this->assertEquals($expected, $actual); } - + function testUrlQueryArray() { $config = CRM_Core_Config::singleton(); $this->assertTrue($config->userSystem instanceof CRM_Utils_System_UnitTests); diff --git a/tests/phpunit/CRM/Utils/ZipTest.php b/tests/phpunit/CRM/Utils/ZipTest.php index 1d878884f0..df2566b837 100644 --- a/tests/phpunit/CRM/Utils/ZipTest.php +++ b/tests/phpunit/CRM/Utils/ZipTest.php @@ -1,4 +1,29 @@ file = FALSE; } - + function tearDown() { parent::tearDown(); if ($this->file) { @@ -34,7 +59,7 @@ class CRM_Utils_ZipTest extends CiviUnitTestCase { array() ); } - + function testFindBaseDirName_plainfile() { $this->_doFindBaseDirName(FALSE, array(), @@ -100,7 +125,7 @@ class CRM_Utils_ZipTest extends CiviUnitTestCase { 'com.example.foo' ); } - + function testGuessBaseDir_plainfile() { $this->_doGuessBaseDir(FALSE, array(), @@ -116,7 +141,7 @@ class CRM_Utils_ZipTest extends CiviUnitTestCase { 'com.example.foo' ); } - + function testGuessBaseDir_weird() { $this->_doGuessBaseDir(FALSE, array('foo/../'), @@ -124,20 +149,20 @@ class CRM_Utils_ZipTest extends CiviUnitTestCase { 'com.example.foo' ); } - + function _doFindBaseDirName($expectedBaseDirName, $dirs, $files) { $this->file = tempnam(sys_get_temp_dir(), 'testzip-'); $this->assertTrue(CRM_Utils_Zip::createTestZip($this->file, $dirs, $files)); - + $zip = new ZipArchive(); $this->assertTrue($zip->open($this->file)); $this->assertEquals($expectedBaseDirName, CRM_Utils_Zip::findBaseDirName($zip)); } - + function _doGuessBaseDir($expectedResult, $dirs, $files, $expectedKey) { $this->file = tempnam(sys_get_temp_dir(), 'testzip-'); $this->assertTrue(CRM_Utils_Zip::createTestZip($this->file, $dirs, $files)); - + $zip = new ZipArchive(); $this->assertTrue($zip->open($this->file)); $this->assertEquals($expectedResult, CRM_Utils_Zip::guessBaseDir($zip, $expectedKey)); diff --git a/tests/phpunit/CiviTest/AuthorizeNet.php b/tests/phpunit/CiviTest/AuthorizeNet.php index a24a3d8b84..13bae28459 100644 --- a/tests/phpunit/CiviTest/AuthorizeNet.php +++ b/tests/phpunit/CiviTest/AuthorizeNet.php @@ -29,12 +29,12 @@ class AuthorizeNet extends PHPUnit_Framework_Testcase { } /* - * Helper function to delete a PayPal Pro + * Helper function to delete a PayPal Pro * payment processor * @param int $id - id of the PayPal Pro payment processor * to be deleted * @return boolean true if payment processor deleted, false otherwise - * + * */ function delete($id) { $paymentProcessor = new CRM_Financial_DAO_PaymentProcessor(); diff --git a/tests/phpunit/CiviTest/ReleaseTestSettings.php.txt b/tests/phpunit/CiviTest/ReleaseTestSettings.php.txt index 4b43ded97e..a977b49eb2 100644 --- a/tests/phpunit/CiviTest/ReleaseTestSettings.php.txt +++ b/tests/phpunit/CiviTest/ReleaseTestSettings.php.txt @@ -2,16 +2,16 @@ class ReleaseTestSettings { - var $publicSandbox = false; - var $browser = '*firefox'; - var $sandboxURL = 'http://url.url'; - var $sandboxPATH = ''; - var $installPATH = '/sites/trunk.drupal/modules/civicrm/install/'; - var $upgradePATH = '/civicrm/upgrade?reset=1'; - var $username = ''; - var $password = ''; - var $adminUsername = ''; - var $adminPassword = ''; + var $publicSandbox = false; + var $browser = '*firefox'; + var $sandboxURL = 'http://url.url'; + var $sandboxPATH = ''; + var $installPATH = '/sites/trunk.drupal/modules/civicrm/install/'; + var $upgradePATH = '/civicrm/upgrade?reset=1'; + var $username = ''; + var $password = ''; + var $adminUsername = ''; + var $adminPassword = ''; var $UFemail = 'noreply@civicrm.org'; var $civiDBServer = 'localhost'; @@ -25,11 +25,11 @@ class ReleaseTestSettings { var $drupalDBName = ''; - function __construct() { - $this->fullSandboxPath = $this->sandboxURL . $this->sandboxPATH; - $this->installURL = $this->fullSandboxPath . $this->installPATH; - $this->upgradeURL = $this->fullSandboxPath . $this->upgradePATH; - } + function __construct() { + $this->fullSandboxPath = $this->sandboxURL . $this->sandboxPATH; + $this->installURL = $this->fullSandboxPath . $this->installPATH; + $this->upgradeURL = $this->fullSandboxPath . $this->upgradePATH; + } } ?> diff --git a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php index 06f364ff3b..88fa27c5fb 100644 --- a/tests/phpunit/WebTest/Activity/ContactContextAddTest.php +++ b/tests/phpunit/WebTest/Activity/ContactContextAddTest.php @@ -211,7 +211,7 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { $subject = "This is subject of test activity for creating a separate activity for contacts {$firstName1},{$firstName2} and {$firstName3}."; $this->type("subject", $subject); - + $this->webtestFillDateTime('activity_date_time', '+1 month 11:10PM'); $this->select("status_id", "value=1"); @@ -223,9 +223,9 @@ class WebTest_Activity_ContactContextAddTest extends CiviSeleniumTestCase { //activity search page $this->openCiviPage('activity/search', 'reset=1'); - + $this->type('activity_subject', $subject); - + $this->clickLink('_qf_Search_refresh'); $targetContacts = array("Summerson, ". $firstName1, "Andersonnn, ". $firstName2, "Anderson, ". $firstName3 ); diff --git a/tests/phpunit/WebTest/Admin/CustomAddTestSameField.php b/tests/phpunit/WebTest/Admin/CustomAddTestSameField.php index be76e76dd6..1c44639b04 100644 --- a/tests/phpunit/WebTest/Admin/CustomAddTestSameField.php +++ b/tests/phpunit/WebTest/Admin/CustomAddTestSameField.php @@ -35,28 +35,28 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase { function testCustomSameFieldAdd() { $this->open($this->sboxPath); $this->webtestLogin(); - + $this->_testCustomAdd(); $this->_testCustomAdd(); } - + function _testCustomAdd() { //CRM-7564 : Different gropus can contain same custom fields - $this->open($this->sboxPath . "civicrm/admin/custom/group?action=add&reset=1"); + $this->open($this->sboxPath . "civicrm/admin/custom/group?action=add&reset=1"); $this->waitForPageToLoad($this->getTimeoutMsec()); //fill custom group title $customGroupTitle = 'custom_group' . substr(sha1(rand()), 0, 3); $this->click("title"); $this->type("title", $customGroupTitle); - + //custom group extends $this->click("extends[0]"); $this->select("extends[0]", "label=Contacts"); $this->click("//option[@value='Contact']"); $this->click("//form[@id='Group']/div[2]/div[3]/span[1]/input"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + //Is custom group created? $this->assertTrue($this->isTextPresent("Your custom field set '$customGroupTitle' has been added. You can add custom fields now.")); //add custom field - alphanumeric text @@ -71,7 +71,7 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase { $this->click("data_type[1]"); $this->select("data_type[1]", "label=CheckBox"); $this->click("//option[@value='CheckBox']"); - + $checkboxFieldLabel = 'test_checkbox'; $this->type("label", $checkboxFieldLabel); $checkboxOptionLabel1 = 'check1'; @@ -88,32 +88,32 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase { $checkboxOptionLabel4 = 'check4'; $this->type("option_label_4", $checkboxOptionLabel4); $this->type("option_value_4", "4"); - + //enter options per line $this->type("options_per_line", "2"); - + //enter pre help message $this->type("help_pre", "this is field pre help"); //enter post help message $this->type("help_post", "this field post help"); - + //Is searchable? $this->click("is_searchable"); - + //clicking save $this->click("_qf_Field_next_new-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + //Is custom field created? $this->assertTrue($this->isTextPresent("Your custom field '$checkboxFieldLabel' has been saved.")); - + //add custom field - alphanumeric text $textFieldLabel = 'test_text_field'; $this->click("header"); $this->type("label", $textFieldLabel); $this->click("_qf_Field_next_new-bottom"); - + // Same group will not contain same custome fields so will show error for this field : $this->waitForPageToLoad($this->getTimeoutMsec()); $this->click("data_type[0]"); @@ -124,7 +124,7 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase { $this->click("//option[@value='CheckBox']"); //Is custom field created $this->assertTrue($this->isTextPresent("Custom field '$textFieldLabel' already exists in Database.")); - + //create another custom field - Number Radio $this->click("data_type[0]"); $this->select("data_type[0]", "value=2"); @@ -132,7 +132,7 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase { $this->click("data_type[1]"); $this->select("data_type[1]", "value=Radio"); $this->click("//option[@value='Radio']"); - + $radioFieldLabel = 'test_radio'; $this->type("label", $radioFieldLabel); $radioOptionLabel1 = 'radio1'; @@ -141,26 +141,26 @@ class WebTest_Admin_CustomAddTestSameField extends CiviSeleniumTestCase { $radioOptionLabel2 = 'radio2'; $this->type("option_label_2", $radioOptionLabel2); $this->type("option_value_2", "2"); - + //select options per line $this->type("options_per_line", "3"); - + //enter pre help msg $this->type("help_pre", "this is field pre help"); - + //enter post help msg $this->type("help_post", "this is field post help"); - + //Is searchable? $this->click("is_searchable"); - + //clicking save $this->click("_qf_Field_next-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); - + //Is custom field created - $this->assertTrue($this->isTextPresent("Your custom field '$radioFieldLabel' has been saved.")); - - } + $this->assertTrue($this->isTextPresent("Your custom field '$radioFieldLabel' has been saved.")); + + } } diff --git a/tests/phpunit/WebTest/Financial/FinancialBatchExport.php b/tests/phpunit/WebTest/Financial/FinancialBatchExport.php index 565f4197c4..457288430e 100644 --- a/tests/phpunit/WebTest/Financial/FinancialBatchExport.php +++ b/tests/phpunit/WebTest/Financial/FinancialBatchExport.php @@ -1,120 +1,120 @@ -webtestLogin('admin'); - $this->openCiviPage("financial/batch", "reset=1&action=add", '_qf_FinancialBatch_next-botttom'); - $setTitle = 'Batch ' . substr(sha1(rand()), 0, 7) . date('Y-m-d'); - $setDescription = 'Test Batch Creation'; - $setPaymentInstrument = 'Credit Card'; - $numberOfTrxn = '10'; // can be 10, 25, 50, 100 - $totalAmt = '1000'; - $exportFormat = 'CSV'; - $batchId = $this->_testAddBatch( - $setTitle, - $setDescription, - $setPaymentInstrument, - $numberOfTrxn, - $totalAmt - ); - $this->_testAssignBatch($numberOfTrxn); - $this->_testExportBatch($setTitle, $batchId, $exportFormat); - } - - function _testAddBatch($setTitle, $setDescription, $setPaymentInstrument, $numberOfTrxn, $totalAmt) { - // Enter Optional Constraints - $this->type('title', $setTitle); - $this->type('description', $setDescription); - if ($setPaymentInstrument == 'Credit Card') { - $this->select("payment_instrument_id", "value=1"); - } - elseif ($setPaymentInstrument == 'Debit Card') { - $this->select("payment_instrument_id", "value=2"); - } - elseif ($setPaymentInstrument == 'Cash') { - $this->select("payment_instrument_id", "value=3"); - } - elseif ($setPaymentInstrument == 'Check') { - $this->select("payment_instrument_id", "value=4"); - } - elseif ($setPaymentInstrument == 'EFT') { - $this->select("payment_instrument_id", "value=5"); - } - $this->type('item_count', $numberOfTrxn); - $this->type('total', $totalAmt); - - $this->click('_qf_FinancialBatch_next-botttom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - // parse URL to grab the batch ID - $batchId = $this->urlArg('bid'); - return $batchId; - } - - function _testAssignBatch($numberOfTrxn) { - $this->select( "xpath=//div[@id='crm-transaction-selector-assign_length']/label/select[@name='crm-transaction-selector-assign_length']", "value=$numberOfTrxn" ); +webtestLogin('admin'); + $this->openCiviPage("financial/batch", "reset=1&action=add", '_qf_FinancialBatch_next-botttom'); + $setTitle = 'Batch ' . substr(sha1(rand()), 0, 7) . date('Y-m-d'); + $setDescription = 'Test Batch Creation'; + $setPaymentInstrument = 'Credit Card'; + $numberOfTrxn = '10'; // can be 10, 25, 50, 100 + $totalAmt = '1000'; + $exportFormat = 'CSV'; + $batchId = $this->_testAddBatch( + $setTitle, + $setDescription, + $setPaymentInstrument, + $numberOfTrxn, + $totalAmt + ); + $this->_testAssignBatch($numberOfTrxn); + $this->_testExportBatch($setTitle, $batchId, $exportFormat); + } + + function _testAddBatch($setTitle, $setDescription, $setPaymentInstrument, $numberOfTrxn, $totalAmt) { + // Enter Optional Constraints + $this->type('title', $setTitle); + $this->type('description', $setDescription); + if ($setPaymentInstrument == 'Credit Card') { + $this->select("payment_instrument_id", "value=1"); + } + elseif ($setPaymentInstrument == 'Debit Card') { + $this->select("payment_instrument_id", "value=2"); + } + elseif ($setPaymentInstrument == 'Cash') { + $this->select("payment_instrument_id", "value=3"); + } + elseif ($setPaymentInstrument == 'Check') { + $this->select("payment_instrument_id", "value=4"); + } + elseif ($setPaymentInstrument == 'EFT') { + $this->select("payment_instrument_id", "value=5"); + } + $this->type('item_count', $numberOfTrxn); + $this->type('total', $totalAmt); + + $this->click('_qf_FinancialBatch_next-botttom'); + $this->waitForPageToLoad($this->getTimeoutMsec()); + + // parse URL to grab the batch ID + $batchId = $this->urlArg('bid'); + return $batchId; + } + + function _testAssignBatch($numberOfTrxn) { + $this->select( "xpath=//div[@id='crm-transaction-selector-assign_length']/label/select[@name='crm-transaction-selector-assign_length']", "value=$numberOfTrxn" ); // Because it tends to cause problems, all uses of sleep() must be justified in comments // Sleep should never be used for wait for anything to load from the server // Justification for this instance: FIXME - sleep(5); - $this->click('toggleSelect'); - $this->select('trans_assign', 'value=Assign'); - $this->click('Go'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - } - - function _testExportBatch($setTitle, $batchId, $exportFormat) { - $this->openCiviPage("financial/batch", "reset=1&action=export&id=$batchId"); - if ($exportFormat == 'CSV') { - $this->click("xpath=//form[@id='FinancialBatch']/div[2]/table[@class='form-layout']/tbody/tr/td/input[2]"); - $this->click('_qf_FinancialBatch_next-botttom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - } - else { - $this->click("xpath=//form[@id='FinancialBatch']/div[2]/table[@class='form-layout']/tbody/tr/td/input[1]"); - $this->click('_qf_FinancialBatch_next-botttom'); - $this->waitForPageToLoad($this->getTimeoutMsec()); - } - $this->openCiviPage("dashboard", "reset=1"); - $this->waitForPageToLoad($this->getTimeoutMsec()); - - $this->clickLink("xpath=//div[@id='recently-viewed']/ul/li[1]/a", "_qf_Activity_cancel-bottom"); - $this->webtestVerifyTabularData( - array( - 'Current Attachment(s)' => 'Financial_Transactions_' - ) - ); - } -} + sleep(5); + $this->click('toggleSelect'); + $this->select('trans_assign', 'value=Assign'); + $this->click('Go'); + $this->waitForPageToLoad($this->getTimeoutMsec()); + } + + function _testExportBatch($setTitle, $batchId, $exportFormat) { + $this->openCiviPage("financial/batch", "reset=1&action=export&id=$batchId"); + if ($exportFormat == 'CSV') { + $this->click("xpath=//form[@id='FinancialBatch']/div[2]/table[@class='form-layout']/tbody/tr/td/input[2]"); + $this->click('_qf_FinancialBatch_next-botttom'); + $this->waitForPageToLoad($this->getTimeoutMsec()); + } + else { + $this->click("xpath=//form[@id='FinancialBatch']/div[2]/table[@class='form-layout']/tbody/tr/td/input[1]"); + $this->click('_qf_FinancialBatch_next-botttom'); + $this->waitForPageToLoad($this->getTimeoutMsec()); + } + $this->openCiviPage("dashboard", "reset=1"); + $this->waitForPageToLoad($this->getTimeoutMsec()); + + $this->clickLink("xpath=//div[@id='recently-viewed']/ul/li[1]/a", "_qf_Activity_cancel-bottom"); + $this->webtestVerifyTabularData( + array( + 'Current Attachment(s)' => 'Financial_Transactions_' + ) + ); + } +} diff --git a/tests/phpunit/api/v3/ACLPermissionTest.php b/tests/phpunit/api/v3/ACLPermissionTest.php index cb9ea5183a..611c170a82 100644 --- a/tests/phpunit/api/v3/ACLPermissionTest.php +++ b/tests/phpunit/api/v3/ACLPermissionTest.php @@ -1,5 +1,4 @@ _regexForGettingAPIStdFunctions = '/^civicrm_api3_ #starts with civicrm_api_3 (ignore internal functions) - .*_ #any number of characters up to the last _ + .*_ #any number of characters up to the last _ # negative look ahead on string getfields - (?:(?!getfields))/x'; + (?:(?!getfields))/x'; // functions to skip from utils.php mainly since they get sucked in via // a require chain in the include files $this->_skipFunctionList = array( diff --git a/tests/phpunit/api/v3/APITest.php b/tests/phpunit/api/v3/APITest.php index 7cb1b6f2a9..763a6d8489 100644 --- a/tests/phpunit/api/v3/APITest.php +++ b/tests/phpunit/api/v3/APITest.php @@ -1,5 +1,4 @@ 'a test activity', 'activity_status_id' => 1, 'activity_name' => 'Test activity type', - 'version' => $this->_apiversion, + 'version' => $this->_apiversion, ); $result = civicrm_api('activity', 'create' , $params ); diff --git a/tests/phpunit/api/v3/ActivityTypeTest.php b/tests/phpunit/api/v3/ActivityTypeTest.php index a281844f7e..8177795e3a 100644 --- a/tests/phpunit/api/v3/ActivityTypeTest.php +++ b/tests/phpunit/api/v3/ActivityTypeTest.php @@ -1,5 +1,4 @@ 'man2@yahoo.com', 'contact_type' => 'Individual', 'location_type_id' => 1, - 'version' => $this->_apiversion, + 'version' => $this->_apiversion, 'api.contribution.create' => array( 'receive_date' => '2010-01-01', diff --git a/tests/phpunit/api/v3/CustomFieldTest.php b/tests/phpunit/api/v3/CustomFieldTest.php index bfcc5ed4e2..aa842a64ef 100644 --- a/tests/phpunit/api/v3/CustomFieldTest.php +++ b/tests/phpunit/api/v3/CustomFieldTest.php @@ -1,5 +1,30 @@ assertEquals(0, $result['count']); } function testGetEventByIdSort() { - $params = array( + $params = array( 'return.sort' => 'id ASC', 'return.max_results' => 1, 'version' => $this->_apiversion, diff --git a/tests/phpunit/api/v3/GroupContactTest.php b/tests/phpunit/api/v3/GroupContactTest.php index 179dfa690e..022020f33e 100644 --- a/tests/phpunit/api/v3/GroupContactTest.php +++ b/tests/phpunit/api/v3/GroupContactTest.php @@ -1,5 +1,4 @@ . - */ +/* + +--------------------------------------------------------------------+ +| CiviCRM version 4.3 | ++--------------------------------------------------------------------+ +| Copyright CiviCRM LLC (c) 2004-2013 | ++--------------------------------------------------------------------+ +| This file is a part of CiviCRM. | +| | +| CiviCRM is free software; you can copy, modify, and distribute it | +| under the terms of the GNU Affero General Public License | +| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | +| | +| CiviCRM is distributed in the hope that it will be useful, but | +| WITHOUT ANY WARRANTY; without even the implied warranty of | +| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | +| See the GNU Affero General Public License for more details. | +| | +| You should have received a copy of the GNU Affero General Public | +| License and the CiviCRM Licensing Exception along | +| with this program; if not, contact CiviCRM LLC | +| at info[AT]civicrm[DOT]org. If you have questions about the | +| 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'; diff --git a/tests/phpunit/api/v3/MembershipPaymentTest.php b/tests/phpunit/api/v3/MembershipPaymentTest.php index c6636f418c..e45b5dc32c 100644 --- a/tests/phpunit/api/v3/MembershipPaymentTest.php +++ b/tests/phpunit/api/v3/MembershipPaymentTest.php @@ -1,5 +1,4 @@ assertAPISuccess($resultcreatenew); - + $this->assertEquals(0, $resultcreatenew['is_error'], "in line " . __LINE__); $result = civicrm_api('PledgePayment', 'Get', array( 'version' => 3, diff --git a/tests/phpunit/api/v3/PriceFieldTest.php b/tests/phpunit/api/v3/PriceFieldTest.php index a5830af558..c791604350 100644 --- a/tests/phpunit/api/v3/PriceFieldTest.php +++ b/tests/phpunit/api/v3/PriceFieldTest.php @@ -1,5 +1,30 @@ 'juicy and healthy', 'amount' => 1 ); - + $membershipOrgId = $this->organizationCreate(NULL); $this->_membershipTypeID = $this->membershipTypeCreate($membershipOrgId); $priceSetparams1 = array( diff --git a/tests/phpunit/api/v3/PriceSetTest.php b/tests/phpunit/api/v3/PriceSetTest.php index daf4a59009..d1ce89269e 100644 --- a/tests/phpunit/api/v3/PriceSetTest.php +++ b/tests/phpunit/api/v3/PriceSetTest.php @@ -1,5 +1,30 @@ params = array ( 'version' => $this->_apiversion, - 'sequential' =>'1', + 'sequential' =>'1', 'survey_id' => $surveyID ); parent::setUp(); @@ -53,7 +53,7 @@ class api_v3_SurveyRespondantTest extends CiviUnitTestCase { function tearDown() { $this->quickCleanup(array('civicrm_survey')); } - + /** * Test surveyRespondent get with wrong params type. */ @@ -62,7 +62,7 @@ class api_v3_SurveyRespondantTest extends CiviUnitTestCase { $GetWrongParamsType = civicrm_api("SurveyRespondant","get", $params ); $this->assertEquals($GetWrongParamsType['error_message'], 'Input variable `params` is not an array'); } - + /** * Test surveyRespondent get with empty params. */ diff --git a/tests/phpunit/api/v3/SystemTest.php b/tests/phpunit/api/v3/SystemTest.php index 37f242804b..4b766b7cd4 100644 --- a/tests/phpunit/api/v3/SystemTest.php +++ b/tests/phpunit/api/v3/SystemTest.php @@ -1,5 +1,30 @@ assertTrue(NULL === CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH)); - + $data = 'abc'; CRM_Core_BAO_Cache::setItem($data, self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH); - + $this->assertEquals('abc', CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH)); $params = array( @@ -88,7 +113,7 @@ class api_v3_SystemTest extends CiviUnitTestCase { $result = civicrm_api('system', 'flush', $params); $this->assertAPISuccess($result); $this->documentMe($params, $result, __FUNCTION__, __FILE__, "Flush all system caches", 'Flush', 'flush'); - + $this->assertTrue(NULL === CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH)); } } diff --git a/tests/phpunit/api/v3/UFFieldTest.php b/tests/phpunit/api/v3/UFFieldTest.php index 138b665d8f..1f06871334 100644 --- a/tests/phpunit/api/v3/UFFieldTest.php +++ b/tests/phpunit/api/v3/UFFieldTest.php @@ -1,420 +1,419 @@ -quickCleanup( - array( - 'civicrm_group', - 'civicrm_contact', - 'civicrm_uf_group', - 'civicrm_uf_field', - 'civicrm_uf_join', - 'civicrm_uf_match', - ) - ); - - $this->_apiversion = 3; - $op = new PHPUnit_Extensions_Database_Operation_Insert; - $op->execute( - $this->_dbconn, - new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml') - ); - $this->_sethtmlGlobals(); - - $this->_params = array( - 'field_name' => 'phone', - 'field_type' => 'Contact', - 'visibility' => 'Public Pages and Listings', - 'weight' => 1, - 'label' => 'Test Phone', - 'is_searchable' => 1, - 'is_active' => 1, - 'location_type_id' => 1, - 'phone_type_id' => 1, - 'version' => $this->_apiversion, - 'uf_group_id' => $this->_ufGroupId, - ); - } - - function tearDown() { - $this->quickCleanup( - array( - 'civicrm_group', - 'civicrm_contact', - 'civicrm_uf_group', - 'civicrm_uf_join', - 'civicrm_uf_match', - ) - ); - } - - /** - * create / updating field - */ - public function testCreateUFField() { - $params = $this->_params; // copy - $ufField = civicrm_api('uf_field', 'create', $params); - $this->documentMe($params, $ufField, __FUNCTION__, __FILE__); - unset($params['version']); - unset($params['uf_group_id']); - $this->_ufFieldId = $ufField['id']; - $this->assertEquals(0, $ufField['is_error'], " in line " . __LINE__); - foreach ($params as $key => $value) { - $this->assertEquals($ufField['values'][$ufField['id']][$key], $params[$key]); - } - } - - public function testCreateUFFieldWithBadFieldName() { - $params = $this->_params; // copy - $params['field_name'] = 'custom_98789'; // invalid field - $result = civicrm_api('uf_field', 'create', $params); - $this->assertEquals($result['is_error'], 1); - } - - function testCreateUFFieldWithEmptyParams() { - $params = array(); - $result = civicrm_api('uf_field', 'create', $params); - $this->assertEquals($result['is_error'], 1); - } - - function testCreateUFFieldWithWrongParams() { - $result = civicrm_api('uf_field', 'create', array('field_name' => 'test field')); - $this->assertEquals($result['is_error'], 1); - $result = civicrm_api('uf_field', 'create', 'a string'); - $this->assertEquals($result['is_error'], 1); - $result = civicrm_api('uf_field', 'create', array('label' => 'name-less field')); - $this->assertEquals($result['is_error'], 1); - } - /** - * Create a field with 'weight=1' and then a second with 'weight=1'. The second field - * winds up with weight=1, and the first field gets bumped to 'weight=2'. - */ - public function testCreateUFFieldWithDefaultAutoWeight() { - $params1 = $this->_params; // copy - $ufField1 = civicrm_api('uf_field', 'create', $params1); - $this->assertEquals(1, $ufField1['values'][$ufField1['id']]['weight']); - $this->assertDBQuery(1, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', array( - 1 => array($ufField1['id'], 'Int'), - )); - - $params2 = $this->_params; // copy - $params2['location_type_id'] = 2; // needs to be a different field - $ufField2 = civicrm_api('uf_field', 'create', $params2); - $this->assertEquals(1, $ufField2['values'][$ufField2['id']]['weight']); - $this->assertDBQuery(1, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', array( - 1 => array($ufField2['id'], 'Int'), - )); - $this->assertDBQuery(2, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', array( - 1 => array($ufField1['id'], 'Int'), - )); - } - - /** - * deleting field - */ - public function testDeleteUFField() { - - $ufField = civicrm_api('uf_field', 'create', $this->_params); - $this->assertAPISuccess($ufField, 'in line' . __LINE__); - $this->_ufFieldId = $ufField['id']; - $params = array( - 'version' => $this->_apiversion, - 'field_id' => $ufField['id'], - ); - $result = civicrm_api('uf_field', 'delete', $params); - $this->documentMe($params, $result, __FUNCTION__, __FILE__); - $this->assertAPISuccess($result, 0, 'in line' . __LINE__); - } - - public function testGetUFFieldSuccess() { - - civicrm_api($this->_entity, 'create', $this->_params); - $params = array('version' => 3); - $result = civicrm_api($this->_entity, 'get', $params); - $this->documentMe($params, $result, __FUNCTION__, __FILE__); - $this->assertAPISuccess($result, 0, 'in line' . __LINE__); - $this->getAndCheck($this->_params, $result['id'], $this->_entity); - } - - /** - * create / updating field - */ - public function testReplaceUFFields() { - $baseFields = array(); - $baseFields[] = array( - 'field_name' => 'first_name', - 'field_type' => 'Contact', - 'visibility' => 'Public Pages and Listings', - 'weight' => 3, - 'label' => 'Test First Name', - 'is_searchable' => 1, - 'is_active' => 1, - ); - $baseFields[] = array( - 'field_name' => 'country', - 'field_type' => 'Contact', - 'visibility' => 'Public Pages and Listings', - 'weight' => 2, - 'label' => 'Test Country', - 'is_searchable' => 1, - 'is_active' => 1, - 'location_type_id' => 1, - ); - $baseFields[] = array( - 'field_name' => 'phone', - 'field_type' => 'Contact', - 'visibility' => 'Public Pages and Listings', - 'weight' => 1, - 'label' => 'Test Phone', - 'is_searchable' => 1, - 'is_active' => 1, - 'location_type_id' => 1, - 'phone_type_id' => 1, - ); - - $params = array( - 'version' => $this->_apiversion, - 'uf_group_id' => $this->_ufGroupId, - 'option.autoweight' => FALSE, - 'values' => $baseFields, - ); - - $result = civicrm_api('uf_field', 'replace', $params); - $this->assertAPISuccess($result); - $this->documentMe($params, $result, __FUNCTION__, __FILE__); - $inputsByName = CRM_Utils_Array::index(array('field_name'), $params['values']); - $this->assertEquals(count($params['values']), count($result['values'])); - foreach ($result['values'] as $outUfField) { - $this->assertTrue(is_string($outUfField['field_name'])); - $inUfField = $inputsByName[$outUfField['field_name']]; - foreach ($inUfField as $key => $inValue) { - $this->assertEquals($inValue, $outUfField[$key], - sprintf("field_name=[%s] key=[%s] expected=[%s] actual=[%s]", - $outUfField['field_name'], - $key, - $inValue, - $outUfField[$key] - ) - ); - } - } - } - - /** - * FIXME: something NULLs $GLOBALS['_HTML_QuickForm_registered_rules'] when the tests are ran all together - * (NB unclear if this is still required) - */ - function _sethtmlGlobals() { - $GLOBALS['_HTML_QuickForm_registered_rules'] = array( - 'required' => array( - 'html_quickform_rule_required', - 'HTML/QuickForm/Rule/Required.php' - ), - 'maxlength' => array( - 'html_quickform_rule_range', - 'HTML/QuickForm/Rule/Range.php' - ), - 'minlength' => array( - 'html_quickform_rule_range', - 'HTML/QuickForm/Rule/Range.php' - ), - 'rangelength' => array( - 'html_quickform_rule_range', - 'HTML/QuickForm/Rule/Range.php' - ), - 'email' => array( - 'html_quickform_rule_email', - 'HTML/QuickForm/Rule/Email.php' - ), - 'regex' => array( - 'html_quickform_rule_regex', - 'HTML/QuickForm/Rule/Regex.php' - ), - 'lettersonly' => array( - 'html_quickform_rule_regex', - 'HTML/QuickForm/Rule/Regex.php' - ), - 'alphanumeric' => array( - 'html_quickform_rule_regex', - 'HTML/QuickForm/Rule/Regex.php' - ), - 'numeric' => array( - 'html_quickform_rule_regex', - 'HTML/QuickForm/Rule/Regex.php' - ), - 'nopunctuation' => array( - 'html_quickform_rule_regex', - 'HTML/QuickForm/Rule/Regex.php' - ), - 'nonzero' => array( - 'html_quickform_rule_regex', - 'HTML/QuickForm/Rule/Regex.php' - ), - 'callback' => array( - 'html_quickform_rule_callback', - 'HTML/QuickForm/Rule/Callback.php' - ), - 'compare' => array( - 'html_quickform_rule_compare', - 'HTML/QuickForm/Rule/Compare.php' - ) - ); - // FIXME: …ditto for $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] - $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] = array( - 'group' => array( - 'HTML/QuickForm/group.php', - 'HTML_QuickForm_group' - ), - 'hidden' => array( - 'HTML/QuickForm/hidden.php', - 'HTML_QuickForm_hidden' - ), - 'reset' => array( - 'HTML/QuickForm/reset.php', - 'HTML_QuickForm_reset' - ), - 'checkbox' => array( - 'HTML/QuickForm/checkbox.php', - 'HTML_QuickForm_checkbox' - ), - 'file' => array( - 'HTML/QuickForm/file.php', - 'HTML_QuickForm_file' - ), - 'image' => array( - 'HTML/QuickForm/image.php', - 'HTML_QuickForm_image' - ), - 'password' => array( - 'HTML/QuickForm/password.php', - 'HTML_QuickForm_password' - ), - 'radio' => array( - 'HTML/QuickForm/radio.php', - 'HTML_QuickForm_radio' - ), - 'button' => array( - 'HTML/QuickForm/button.php', - 'HTML_QuickForm_button' - ), - 'submit' => array( - 'HTML/QuickForm/submit.php', - 'HTML_QuickForm_submit' - ), - 'select' => array( - 'HTML/QuickForm/select.php', - 'HTML_QuickForm_select' - ), - 'hiddenselect' => array( - 'HTML/QuickForm/hiddenselect.php', - 'HTML_QuickForm_hiddenselect' - ), - 'text' => array( - 'HTML/QuickForm/text.php', - 'HTML_QuickForm_text' - ), - 'textarea' => array( - 'HTML/QuickForm/textarea.php', - 'HTML_QuickForm_textarea' - ), - 'fckeditor' => array( - 'HTML/QuickForm/fckeditor.php', - 'HTML_QuickForm_FCKEditor' - ), - 'tinymce' => array( - 'HTML/QuickForm/tinymce.php', - 'HTML_QuickForm_TinyMCE' - ), - 'dojoeditor' => array( - 'HTML/QuickForm/dojoeditor.php', - 'HTML_QuickForm_dojoeditor' - ), - 'link' => array( - 'HTML/QuickForm/link.php', - 'HTML_QuickForm_link' - ), - 'advcheckbox' => array( - 'HTML/QuickForm/advcheckbox.php', - 'HTML_QuickForm_advcheckbox' - ), - 'date' => array( - 'HTML/QuickForm/date.php', - 'HTML_QuickForm_date' - ), - 'static' => array( - 'HTML/QuickForm/static.php', - 'HTML_QuickForm_static' - ), - 'header' => array( - 'HTML/QuickForm/header.php', - 'HTML_QuickForm_header' - ), - 'html' => array( - 'HTML/QuickForm/html.php', - 'HTML_QuickForm_html' - ), - 'hierselect' => array( - 'HTML/QuickForm/hierselect.php', - 'HTML_QuickForm_hierselect' - ), - 'autocomplete' => array( - 'HTML/QuickForm/autocomplete.php', - 'HTML_QuickForm_autocomplete' - ), - 'xbutton' => array( - 'HTML/QuickForm/xbutton.php', - 'HTML_QuickForm_xbutton' - ), - 'advmultiselect' => array( - 'HTML/QuickForm/advmultiselect.php', - 'HTML_QuickForm_advmultiselect' - ) - ); - } -} +quickCleanup( + array( + 'civicrm_group', + 'civicrm_contact', + 'civicrm_uf_group', + 'civicrm_uf_field', + 'civicrm_uf_join', + 'civicrm_uf_match', + ) + ); + + $this->_apiversion = 3; + $op = new PHPUnit_Extensions_Database_Operation_Insert; + $op->execute( + $this->_dbconn, + new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml') + ); + $this->_sethtmlGlobals(); + + $this->_params = array( + 'field_name' => 'phone', + 'field_type' => 'Contact', + 'visibility' => 'Public Pages and Listings', + 'weight' => 1, + 'label' => 'Test Phone', + 'is_searchable' => 1, + 'is_active' => 1, + 'location_type_id' => 1, + 'phone_type_id' => 1, + 'version' => $this->_apiversion, + 'uf_group_id' => $this->_ufGroupId, + ); + } + + function tearDown() { + $this->quickCleanup( + array( + 'civicrm_group', + 'civicrm_contact', + 'civicrm_uf_group', + 'civicrm_uf_join', + 'civicrm_uf_match', + ) + ); + } + + /** + * create / updating field + */ + public function testCreateUFField() { + $params = $this->_params; // copy + $ufField = civicrm_api('uf_field', 'create', $params); + $this->documentMe($params, $ufField, __FUNCTION__, __FILE__); + unset($params['version']); + unset($params['uf_group_id']); + $this->_ufFieldId = $ufField['id']; + $this->assertEquals(0, $ufField['is_error'], " in line " . __LINE__); + foreach ($params as $key => $value) { + $this->assertEquals($ufField['values'][$ufField['id']][$key], $params[$key]); + } + } + + public function testCreateUFFieldWithBadFieldName() { + $params = $this->_params; // copy + $params['field_name'] = 'custom_98789'; // invalid field + $result = civicrm_api('uf_field', 'create', $params); + $this->assertEquals($result['is_error'], 1); + } + + function testCreateUFFieldWithEmptyParams() { + $params = array(); + $result = civicrm_api('uf_field', 'create', $params); + $this->assertEquals($result['is_error'], 1); + } + + function testCreateUFFieldWithWrongParams() { + $result = civicrm_api('uf_field', 'create', array('field_name' => 'test field')); + $this->assertEquals($result['is_error'], 1); + $result = civicrm_api('uf_field', 'create', 'a string'); + $this->assertEquals($result['is_error'], 1); + $result = civicrm_api('uf_field', 'create', array('label' => 'name-less field')); + $this->assertEquals($result['is_error'], 1); + } + /** + * Create a field with 'weight=1' and then a second with 'weight=1'. The second field + * winds up with weight=1, and the first field gets bumped to 'weight=2'. + */ + public function testCreateUFFieldWithDefaultAutoWeight() { + $params1 = $this->_params; // copy + $ufField1 = civicrm_api('uf_field', 'create', $params1); + $this->assertEquals(1, $ufField1['values'][$ufField1['id']]['weight']); + $this->assertDBQuery(1, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', array( + 1 => array($ufField1['id'], 'Int'), + )); + + $params2 = $this->_params; // copy + $params2['location_type_id'] = 2; // needs to be a different field + $ufField2 = civicrm_api('uf_field', 'create', $params2); + $this->assertEquals(1, $ufField2['values'][$ufField2['id']]['weight']); + $this->assertDBQuery(1, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', array( + 1 => array($ufField2['id'], 'Int'), + )); + $this->assertDBQuery(2, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', array( + 1 => array($ufField1['id'], 'Int'), + )); + } + + /** + * deleting field + */ + public function testDeleteUFField() { + + $ufField = civicrm_api('uf_field', 'create', $this->_params); + $this->assertAPISuccess($ufField, 'in line' . __LINE__); + $this->_ufFieldId = $ufField['id']; + $params = array( + 'version' => $this->_apiversion, + 'field_id' => $ufField['id'], + ); + $result = civicrm_api('uf_field', 'delete', $params); + $this->documentMe($params, $result, __FUNCTION__, __FILE__); + $this->assertAPISuccess($result, 0, 'in line' . __LINE__); + } + + public function testGetUFFieldSuccess() { + + civicrm_api($this->_entity, 'create', $this->_params); + $params = array('version' => 3); + $result = civicrm_api($this->_entity, 'get', $params); + $this->documentMe($params, $result, __FUNCTION__, __FILE__); + $this->assertAPISuccess($result, 0, 'in line' . __LINE__); + $this->getAndCheck($this->_params, $result['id'], $this->_entity); + } + + /** + * create / updating field + */ + public function testReplaceUFFields() { + $baseFields = array(); + $baseFields[] = array( + 'field_name' => 'first_name', + 'field_type' => 'Contact', + 'visibility' => 'Public Pages and Listings', + 'weight' => 3, + 'label' => 'Test First Name', + 'is_searchable' => 1, + 'is_active' => 1, + ); + $baseFields[] = array( + 'field_name' => 'country', + 'field_type' => 'Contact', + 'visibility' => 'Public Pages and Listings', + 'weight' => 2, + 'label' => 'Test Country', + 'is_searchable' => 1, + 'is_active' => 1, + 'location_type_id' => 1, + ); + $baseFields[] = array( + 'field_name' => 'phone', + 'field_type' => 'Contact', + 'visibility' => 'Public Pages and Listings', + 'weight' => 1, + 'label' => 'Test Phone', + 'is_searchable' => 1, + 'is_active' => 1, + 'location_type_id' => 1, + 'phone_type_id' => 1, + ); + + $params = array( + 'version' => $this->_apiversion, + 'uf_group_id' => $this->_ufGroupId, + 'option.autoweight' => FALSE, + 'values' => $baseFields, + ); + + $result = civicrm_api('uf_field', 'replace', $params); + $this->assertAPISuccess($result); + $this->documentMe($params, $result, __FUNCTION__, __FILE__); + $inputsByName = CRM_Utils_Array::index(array('field_name'), $params['values']); + $this->assertEquals(count($params['values']), count($result['values'])); + foreach ($result['values'] as $outUfField) { + $this->assertTrue(is_string($outUfField['field_name'])); + $inUfField = $inputsByName[$outUfField['field_name']]; + foreach ($inUfField as $key => $inValue) { + $this->assertEquals($inValue, $outUfField[$key], + sprintf("field_name=[%s] key=[%s] expected=[%s] actual=[%s]", + $outUfField['field_name'], + $key, + $inValue, + $outUfField[$key] + ) + ); + } + } + } + + /** + * FIXME: something NULLs $GLOBALS['_HTML_QuickForm_registered_rules'] when the tests are ran all together + * (NB unclear if this is still required) + */ + function _sethtmlGlobals() { + $GLOBALS['_HTML_QuickForm_registered_rules'] = array( + 'required' => array( + 'html_quickform_rule_required', + 'HTML/QuickForm/Rule/Required.php' + ), + 'maxlength' => array( + 'html_quickform_rule_range', + 'HTML/QuickForm/Rule/Range.php' + ), + 'minlength' => array( + 'html_quickform_rule_range', + 'HTML/QuickForm/Rule/Range.php' + ), + 'rangelength' => array( + 'html_quickform_rule_range', + 'HTML/QuickForm/Rule/Range.php' + ), + 'email' => array( + 'html_quickform_rule_email', + 'HTML/QuickForm/Rule/Email.php' + ), + 'regex' => array( + 'html_quickform_rule_regex', + 'HTML/QuickForm/Rule/Regex.php' + ), + 'lettersonly' => array( + 'html_quickform_rule_regex', + 'HTML/QuickForm/Rule/Regex.php' + ), + 'alphanumeric' => array( + 'html_quickform_rule_regex', + 'HTML/QuickForm/Rule/Regex.php' + ), + 'numeric' => array( + 'html_quickform_rule_regex', + 'HTML/QuickForm/Rule/Regex.php' + ), + 'nopunctuation' => array( + 'html_quickform_rule_regex', + 'HTML/QuickForm/Rule/Regex.php' + ), + 'nonzero' => array( + 'html_quickform_rule_regex', + 'HTML/QuickForm/Rule/Regex.php' + ), + 'callback' => array( + 'html_quickform_rule_callback', + 'HTML/QuickForm/Rule/Callback.php' + ), + 'compare' => array( + 'html_quickform_rule_compare', + 'HTML/QuickForm/Rule/Compare.php' + ) + ); + // FIXME: …ditto for $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] + $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] = array( + 'group' => array( + 'HTML/QuickForm/group.php', + 'HTML_QuickForm_group' + ), + 'hidden' => array( + 'HTML/QuickForm/hidden.php', + 'HTML_QuickForm_hidden' + ), + 'reset' => array( + 'HTML/QuickForm/reset.php', + 'HTML_QuickForm_reset' + ), + 'checkbox' => array( + 'HTML/QuickForm/checkbox.php', + 'HTML_QuickForm_checkbox' + ), + 'file' => array( + 'HTML/QuickForm/file.php', + 'HTML_QuickForm_file' + ), + 'image' => array( + 'HTML/QuickForm/image.php', + 'HTML_QuickForm_image' + ), + 'password' => array( + 'HTML/QuickForm/password.php', + 'HTML_QuickForm_password' + ), + 'radio' => array( + 'HTML/QuickForm/radio.php', + 'HTML_QuickForm_radio' + ), + 'button' => array( + 'HTML/QuickForm/button.php', + 'HTML_QuickForm_button' + ), + 'submit' => array( + 'HTML/QuickForm/submit.php', + 'HTML_QuickForm_submit' + ), + 'select' => array( + 'HTML/QuickForm/select.php', + 'HTML_QuickForm_select' + ), + 'hiddenselect' => array( + 'HTML/QuickForm/hiddenselect.php', + 'HTML_QuickForm_hiddenselect' + ), + 'text' => array( + 'HTML/QuickForm/text.php', + 'HTML_QuickForm_text' + ), + 'textarea' => array( + 'HTML/QuickForm/textarea.php', + 'HTML_QuickForm_textarea' + ), + 'fckeditor' => array( + 'HTML/QuickForm/fckeditor.php', + 'HTML_QuickForm_FCKEditor' + ), + 'tinymce' => array( + 'HTML/QuickForm/tinymce.php', + 'HTML_QuickForm_TinyMCE' + ), + 'dojoeditor' => array( + 'HTML/QuickForm/dojoeditor.php', + 'HTML_QuickForm_dojoeditor' + ), + 'link' => array( + 'HTML/QuickForm/link.php', + 'HTML_QuickForm_link' + ), + 'advcheckbox' => array( + 'HTML/QuickForm/advcheckbox.php', + 'HTML_QuickForm_advcheckbox' + ), + 'date' => array( + 'HTML/QuickForm/date.php', + 'HTML_QuickForm_date' + ), + 'static' => array( + 'HTML/QuickForm/static.php', + 'HTML_QuickForm_static' + ), + 'header' => array( + 'HTML/QuickForm/header.php', + 'HTML_QuickForm_header' + ), + 'html' => array( + 'HTML/QuickForm/html.php', + 'HTML_QuickForm_html' + ), + 'hierselect' => array( + 'HTML/QuickForm/hierselect.php', + 'HTML_QuickForm_hierselect' + ), + 'autocomplete' => array( + 'HTML/QuickForm/autocomplete.php', + 'HTML_QuickForm_autocomplete' + ), + 'xbutton' => array( + 'HTML/QuickForm/xbutton.php', + 'HTML_QuickForm_xbutton' + ), + 'advmultiselect' => array( + 'HTML/QuickForm/advmultiselect.php', + 'HTML_QuickForm_advmultiselect' + ) + ); + } +} diff --git a/tests/phpunit/api/v3/UFGroupTest.php b/tests/phpunit/api/v3/UFGroupTest.php index 0d3b380ddb..edea02abd3 100644 --- a/tests/phpunit/api/v3/UFGroupTest.php +++ b/tests/phpunit/api/v3/UFGroupTest.php @@ -1,5 +1,4 @@ assertEquals('CRM_Core_DAO_CustomGroup', $DAO); @@ -196,8 +195,8 @@ class api_v3_UtilsTest extends CiviUnitTestCase { $this->assertEquals('CRM_Member_DAO_Membership', $DAO); } /* - * Test GET DAO function returns DAO - */ + * Test GET DAO function returns DAO + */ function testGetBAO() { $BAO = _civicrm_api3_get_BAO('civicrm_api3_website_get'); $this->assertEquals('CRM_Core_BAO_Website', $BAO); diff --git a/tests/phpunit/api/v3/dataset/acl_1_all.xml b/tests/phpunit/api/v3/dataset/acl_1_all.xml index ea1094579b..dabfacd7d0 100644 --- a/tests/phpunit/api/v3/dataset/acl_1_all.xml +++ b/tests/phpunit/api/v3/dataset/acl_1_all.xml @@ -25,7 +25,7 @@ 1 - + 3 Core ACL diff --git a/tests/phpunit/api/v3/dataset/activity_1_emailed.xml b/tests/phpunit/api/v3/dataset/activity_1_emailed.xml index 677d4b698c..50fb52766a 100644 --- a/tests/phpunit/api/v3/dataset/activity_1_emailed.xml +++ b/tests/phpunit/api/v3/dataset/activity_1_emailed.xml @@ -52,7 +52,7 @@ This is a test activity 0 - + diff --git a/tests/phpunit/api/v3/dataset/activity_4_created.xml b/tests/phpunit/api/v3/dataset/activity_4_created.xml index d324799a3a..f01c310f5a 100644 --- a/tests/phpunit/api/v3/dataset/activity_4_created.xml +++ b/tests/phpunit/api/v3/dataset/activity_4_created.xml @@ -22,7 +22,7 @@ relationship_id is_current_revision original_id - result + result is_deleted campaign_id engagement_level @@ -50,7 +50,7 @@ - + diff --git a/tests/phpunit/api/v3/dataset/activity_type_5.xml b/tests/phpunit/api/v3/dataset/activity_type_5.xml index 226a2b0738..e6d3ed7e81 100644 --- a/tests/phpunit/api/v3/dataset/activity_type_5.xml +++ b/tests/phpunit/api/v3/dataset/activity_type_5.xml @@ -22,7 +22,7 @@ relationship_id is_current_revision original_id - result + result is_deleted 4 @@ -45,7 +45,7 @@ - + diff --git a/tests/phpunit/api/v3/dataset/contact_hld.xml b/tests/phpunit/api/v3/dataset/contact_hld.xml index c96a73694a..350ebc99af 100644 --- a/tests/phpunit/api/v3/dataset/contact_hld.xml +++ b/tests/phpunit/api/v3/dataset/contact_hld.xml @@ -49,7 +49,7 @@ sic_code user_unique_id employer_id - is_deleted + is_deleted 25 Household @@ -98,7 +98,7 @@ - 0 + 0 diff --git a/tests/phpunit/api/v3/dataset/contact_hld_upd.xml b/tests/phpunit/api/v3/dataset/contact_hld_upd.xml index ef95f25e38..be09e851ca 100644 --- a/tests/phpunit/api/v3/dataset/contact_hld_upd.xml +++ b/tests/phpunit/api/v3/dataset/contact_hld_upd.xml @@ -49,7 +49,7 @@ sic_code user_unique_id employer_id - is_deleted + is_deleted 25 Household @@ -98,7 +98,7 @@ - 0 + 0 diff --git a/tests/phpunit/api/v3/dataset/contact_ind.xml b/tests/phpunit/api/v3/dataset/contact_ind.xml index 5f1dce20ba..f942f1ca7a 100644 --- a/tests/phpunit/api/v3/dataset/contact_ind.xml +++ b/tests/phpunit/api/v3/dataset/contact_ind.xml @@ -49,7 +49,7 @@ sic_code user_unique_id employer_id - is_deleted + is_deleted 23 Individual @@ -98,7 +98,7 @@ - 0 + 0 diff --git a/tests/phpunit/api/v3/dataset/contact_org.xml b/tests/phpunit/api/v3/dataset/contact_org.xml index 782e234242..716c2bb3b1 100644 --- a/tests/phpunit/api/v3/dataset/contact_org.xml +++ b/tests/phpunit/api/v3/dataset/contact_org.xml @@ -49,7 +49,7 @@ sic_code user_unique_id employer_id - is_deleted + is_deleted 24 Organization @@ -98,7 +98,7 @@ - 0 + 0 diff --git a/tests/phpunit/api/v3/dataset/contact_org_upd.xml b/tests/phpunit/api/v3/dataset/contact_org_upd.xml index 9a9272a885..f6b2984aee 100644 --- a/tests/phpunit/api/v3/dataset/contact_org_upd.xml +++ b/tests/phpunit/api/v3/dataset/contact_org_upd.xml @@ -49,7 +49,7 @@ sic_code user_unique_id employer_id - is_deleted + is_deleted 24 Organization @@ -98,7 +98,7 @@ ABC12DEF - 0 + 0 diff --git a/tests/phpunit/api/v3/dataset/contribution_types.xml b/tests/phpunit/api/v3/dataset/contribution_types.xml index 1f000c0bd4..fbd8455d50 100644 --- a/tests/phpunit/api/v3/dataset/contribution_types.xml +++ b/tests/phpunit/api/v3/dataset/contribution_types.xml @@ -15,8 +15,8 @@ 1004 For some worthwhile cause 0 - - 1 + + 1 11 @@ -24,8 +24,8 @@ 1005 Also for some worthwhile cause 0 - - 1 - + + 1 + diff --git a/tests/phpunit/api/v3/dataset/financial_accounts.xml b/tests/phpunit/api/v3/dataset/financial_accounts.xml index 1277ad3c7a..5cfee5ca32 100644 --- a/tests/phpunit/api/v3/dataset/financial_accounts.xml +++ b/tests/phpunit/api/v3/dataset/financial_accounts.xml @@ -9,15 +9,15 @@ is_deductible is_reserved is_active - financial_account_type_id + financial_account_type_id 10 Gift 1004 For some worthwhile cause 0 - - 1 + + 1 3 @@ -26,9 +26,9 @@ 1005 Also for some worthwhile cause 0 - - 1 - 3 - + + 1 + 3 + diff --git a/tests/phpunit/api/v3/dataset/option_value_from_email_address.xml b/tests/phpunit/api/v3/dataset/option_value_from_email_address.xml index a041be5068..f985d9cd50 100644 --- a/tests/phpunit/api/v3/dataset/option_value_from_email_address.xml +++ b/tests/phpunit/api/v3/dataset/option_value_from_email_address.xml @@ -18,21 +18,21 @@ component_id visibility_id - 234 - 52 + 234 + 52 ]]> - 1 + 1 ]]> - - 0 - 1 - 1 - Default domain email address and from name. - 0 - 0 - 1 - - + + 0 + 1 + 1 + Default domain email address and from name. + 0 + 0 + 1 + + diff --git a/tests/phpunit/api/v3/dataset/resolver/api/v3/Contact/ExampleAction2.php b/tests/phpunit/api/v3/dataset/resolver/api/v3/Contact/ExampleAction2.php index 086e8101cc..e104a70ea1 100644 --- a/tests/phpunit/api/v3/dataset/resolver/api/v3/Contact/ExampleAction2.php +++ b/tests/phpunit/api/v3/dataset/resolver/api/v3/Contact/ExampleAction2.php @@ -1,5 +1,4 @@ Postal Code Contact 0 - + diff --git a/tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/AdultDayCareReferral.xml b/tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/AdultDayCareReferral.xml index 42c72a0054..d43daeae17 100644 --- a/tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/AdultDayCareReferral.xml +++ b/tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/AdultDayCareReferral.xml @@ -19,7 +19,7 @@ Follow up - + Change Case Type @@ -79,6 +79,6 @@ Benefits Specialist - + diff --git a/tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/HousingSupport.xml b/tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/HousingSupport.xml index 8eaa82e97b..0622457aee 100644 --- a/tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/HousingSupport.xml +++ b/tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/HousingSupport.xml @@ -25,12 +25,12 @@ Follow up - + Change Case Type Change Case Status - + Change Case Start Date @@ -104,6 +104,6 @@ Benefits Specialist - + diff --git a/tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/Settings.xml b/tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/Settings.xml index a6cd3cada5..ba3322a3c1 100644 --- a/tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/Settings.xml +++ b/tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/Settings.xml @@ -1,25 +1,25 @@ - - - - 0 - - 0 - - 0 - - - - Change Case Status - 0 + + + + 0 + + 0 + + 0 + + + + Change Case Status + 0 - - Change Case Start Date - 0 + + Change Case Start Date + 0 - + \ No newline at end of file diff --git a/tests/qunit/README.txt b/tests/qunit/README.txt index 1b9d5d70be..a74f18ad5b 100644 --- a/tests/qunit/README.txt +++ b/tests/qunit/README.txt @@ -61,7 +61,7 @@ To create a new test-suite: qunit test is part of the core codebase (aka extension="civicrm"), and suppose the suite is "my-stuff". Then navigate to: - http://localhost/civicrm/dev/qunit/civicrm/my-stuff + http://localhost/civicrm/dev/qunit/civicrm/my-stuff ==== CONVENTIONS ==== @@ -83,7 +83,7 @@ with it, we can change it -- but please communicate any problems/issues * Each QUnit test-suite for CiviCRM lives in a subdirectory of "tests/qunit/". - + Rationale: Following a predictable naming convention will help us automate testing/loading across all suites, and it will make the code more recognizable to other developers. @@ -91,7 +91,7 @@ with it, we can change it -- but please communicate any problems/issues * Each QUnit test-suite *may* include the file "test.php" to specify loading of resource files or bundles (such as CSS/JS). The file will be recognized automatically. - + Rationale: CiviCRM has its own resource-loading conventions. When preparing a test environment, one needs to load JS/CSS dependencies. Since there is no autoloader, this is most easily done with CiviCRM's -- 2.25.1