Merge pull request #14222 from mfb/debug-var
[civicrm-core.git] / tests / phpunit / CRM / Campaign / Form / CampaignTest.php
CommitLineData
484627ca
SL
1<?php
2/*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28/**
29 * Test APIv3 civicrm_contribute_* functions
30 *
31 * @package CiviCRM_APIv3
32 * @subpackage API_Contribution
33 * @group headless
34 */
35class CRM_Campaign_Form_CampaignTest extends CiviUnitTestCase {
36
37 /**
38 * Test the submit function on the contribution page.
39 *
40 * @param string $thousandSeparator
41 *
42 * @dataProvider getThousandSeparators
43 */
44 public function testSubmit($thousandSeparator) {
45 $this->setCurrencySeparators($thousandSeparator);
46 $this->createLoggedInUser();
47 $form = new CRM_Campaign_Form_Campaign();
48 $form->_action = CRM_Core_Action::ADD;
49 $result = CRM_Campaign_Form_Campaign::Submit([
50 'goal_revenue' => '$10' . $thousandSeparator . '000',
51 'is_active' => 1,
52 'title' => 'Test Campaign',
53 'start_date' => date('Y-m-d'),
54 'includeGroups' => [],
55 'custom' => [],
56 'campaign_type_id' => 1,
57 ], $form);
58 var_dump($form);
59 $campaign = $this->callAPISuccess('campaign', 'get', ['id' => $result['id']]);
60 $this->assertEquals('10000', $campaign['values'][$campaign['id']]['goal_revenue']);
61 }
62
63}