Merge pull request #15821 from seamuslee001/dev_core_183_custom_group
[civicrm-core.git] / tests / phpunit / CRM / Campaign / Form / CampaignTest.php
CommitLineData
484627ca
SL
1<?php
2/*
3 +--------------------------------------------------------------------+
7d61e75f 4 | Copyright CiviCRM LLC. All rights reserved. |
484627ca 5 | |
7d61e75f
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
484627ca
SL
9 +--------------------------------------------------------------------+
10 */
11
12/**
13 * Test APIv3 civicrm_contribute_* functions
14 *
15 * @package CiviCRM_APIv3
16 * @subpackage API_Contribution
17 * @group headless
18 */
19class CRM_Campaign_Form_CampaignTest extends CiviUnitTestCase {
20
21 /**
22 * Test the submit function on the contribution page.
23 *
24 * @param string $thousandSeparator
25 *
26 * @dataProvider getThousandSeparators
27 */
28 public function testSubmit($thousandSeparator) {
29 $this->setCurrencySeparators($thousandSeparator);
30 $this->createLoggedInUser();
31 $form = new CRM_Campaign_Form_Campaign();
32 $form->_action = CRM_Core_Action::ADD;
33 $result = CRM_Campaign_Form_Campaign::Submit([
34 'goal_revenue' => '$10' . $thousandSeparator . '000',
35 'is_active' => 1,
36 'title' => 'Test Campaign',
37 'start_date' => date('Y-m-d'),
38 'includeGroups' => [],
39 'custom' => [],
40 'campaign_type_id' => 1,
41 ], $form);
484627ca
SL
42 $campaign = $this->callAPISuccess('campaign', 'get', ['id' => $result['id']]);
43 $this->assertEquals('10000', $campaign['values'][$campaign['id']]['goal_revenue']);
44 }
45
46}