Merge pull request #14639 from colemanw/i18nCleanup
[civicrm-core.git] / tests / phpunit / CRM / Event / Form / SearchTest.php
CommitLineData
12cda498
AP
1<?php
2
3/**
4 * @group headless
5 */
6class CRM_Event_Form_SearchTest extends CiviUnitTestCase {
7
8 public function setUp() {
9 parent::setUp();
10 $this->individualID = $this->individualCreate();
11 }
12
13 /**
14 * Test that search form returns correct number of rows for complex regex filters.
15 */
16 public function testSearch() {
17 $priceFieldValues = $this->createPriceSet('event', NULL, array(
18 'html_type' => 'Radio',
19 'option_label' => array('1' => 'Radio Label A (inc. GST)', '2' => 'Radio Label B (inc. GST)'),
20 'option_name' => array('1' => 'Radio Label A', '2' => 'Radio Label B'),
21 ));
22
23 $priceFieldValues = $priceFieldValues['values'];
24 $participantPrice = NULL;
25 foreach ($priceFieldValues as $priceFieldValue) {
26 $participantPrice = $priceFieldValue;
27 break;
28 }
29
30 $event = $this->eventCreate();
31 $individualID = $this->individualCreate();
32 $today = new DateTime();
33 $this->participantCreate(array(
34 'event_id' => $event['id'],
35 'contact_id' => $individualID,
36 'status_id' => 1,
37 'fee_level' => $participantPrice['label'],
38 'fee_amount' => $participantPrice['amount'],
39 'fee_currency' => 'USD',
40 'register_date' => $today->format('YmdHis'),
41 ));
42
43 $form = new CRM_Event_Form_Search();
44 $form->controller = new CRM_Event_Controller_Search();
45 $form->preProcess();
46 $form->testSubmit(array(
47 'participant_test' => 0,
48 'participant_fee_id' => array(
49 $participantPrice['id'],
50 ),
51 'radio_ts' => 'ts_all',
52 ));
53 $rows = $form->controller->get('rows');
54 $this->assertEquals(1, count($rows), 'Exactly one row should be returned for given price field value.');
55 }
56
57}