From 85c726778cb0754ccdd2ab5f52aa2be9b53b3c33 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 23 May 2017 09:51:01 +1200 Subject: [PATCH] CRM-19821 unit test --- .../phpunit/CRM/Activity/Form/SearchTest.php | 62 +++++++++++++++++++ .../CRM/Contact/BAO/ActivitySearchTest.php | 2 +- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 tests/phpunit/CRM/Activity/Form/SearchTest.php diff --git a/tests/phpunit/CRM/Activity/Form/SearchTest.php b/tests/phpunit/CRM/Activity/Form/SearchTest.php new file mode 100644 index 0000000000..01044e8a24 --- /dev/null +++ b/tests/phpunit/CRM/Activity/Form/SearchTest.php @@ -0,0 +1,62 @@ +individualID = $this->individualCreate(); + $this->contributionCreate(array('contact_id' => $this->individualID, 'receive_date' => '2017-01-30')); + } + + public function tearDown() { + $tablesToTruncate = array( + 'civicrm_activity', + 'civicrm_activity_contact', + ); + $this->quickCleanup($tablesToTruncate); + } + + /** + * Test submitted the search form. + */ + public function testSearch() { + + $form = new CRM_Activity_Form_Search(); + $_SERVER['REQUEST_METHOD'] = 'GET'; + $form->controller = new CRM_Activity_Controller_Search(); + $form->preProcess(); + $form->postProcess(); + $qfKey = $form->controller->_key; + $rows = $form->controller->get('rows'); + $this->assertEquals(array(array( + 'contact_id' => '3', + 'contact_type' => '
', + 'sort_name' => 'Anderson, Anthony', + 'display_name' => 'Mr. Anthony Anderson II', + 'activity_id' => '1', + 'activity_date_time' => '2017-01-30 00:00:00', + 'activity_status_id' => '2', + 'activity_status' => 'Completed', + 'activity_subject' => '$ 100.00 - SSF', + 'source_record_id' => '1', + 'activity_type_id' => '6', + 'activity_type' => 'Contribution', + 'activity_is_test' => '0', + 'target_contact_name' => array(), + 'assignee_contact_name' => array(), + 'source_contact_id' => '3', + 'source_contact_name' => 'Anderson, Anthony', + 'checkbox' => 'mark_x_1', + 'mailingId' => '', + 'action' => 'View', + 'campaign' => NULL, + 'campaign_id' => NULL, + 'repeat' => '', + )), $rows); + } + +} diff --git a/tests/phpunit/CRM/Contact/BAO/ActivitySearchTest.php b/tests/phpunit/CRM/Contact/BAO/ActivitySearchTest.php index f1adc37f09..cfad097932 100644 --- a/tests/phpunit/CRM/Contact/BAO/ActivitySearchTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ActivitySearchTest.php @@ -104,7 +104,7 @@ class CRM_Contact_BAO_ActivitySearchTest extends CiviUnitTestCase { $subject = 'test activity ' . __FUNCTION__; $params = $this->_params; $params['subject'] = $subject; - $activity = $this->callAPISuccess('Activity', 'Create', $params); + $this->callAPISuccess('Activity', 'Create', $params); $case = array( 'form_value' => array( -- 2.25.1