3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
30 * Class WebTest_Admin_Form_Setting_LocalizationTest
32 class WebTest_Contribute_AccrualSettingTest
extends CiviSeleniumTestCase
{
34 protected function setUp() {
38 public function testAccrualSettings() {
39 $this->webtestLogin();
40 $this->openCiviPage("admin/setting/preferences/contribute", "reset=1");
41 $this->waitForElementPresent("_qf_Contribute_next");
44 $this->click("deferred_revenue_enabled");
45 $this->waitForElementPresent("xpath=//tr[@class='crm-preferences-form-block-default_invoice_page'][@style='display: table-row;']");
46 $this->click("deferred_revenue_enabled");
47 $this->waitForElementPresent("xpath=//tr[@class='crm-preferences-form-block-default_invoice_page'][@style='display: none;']");
49 // a random 7-char string and an even number to make this pass unique
50 $hash = substr(sha1(rand()), 0, 7);
51 $rand = 2 * rand(2, 50);
52 $pageTitle = 'Test Contribution Page ' . $hash;
53 // create contribution page with randomized title and default params
54 $pageId = $this->webtestAddContributionPage($hash, $rand, $pageTitle, array('Test Processor' => 'Dummy'), FALSE, FALSE, FALSE, FALSE,
55 FALSE, FALSE, NULL, FALSE, 1, 7, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 'Donation', TRUE, FALSE);
58 $this->openCiviPage("admin/setting/preferences/contribute", "reset=1");
59 $this->waitForElementPresent("_qf_Contribute_next");
60 $this->click("deferred_revenue_enabled");
61 $this->waitForElementPresent("xpath=//*[@id='default_invoice_page']");
63 $this->select('default_invoice_page', "value={$pageId}");
66 $this->click("financial_account_bal_enable");
67 $this->waitForElementPresent("xpath=//tr[@class='crm-preferences-form-block-fiscalYearStart'][@style='display: table-row;']");
68 $this->click("financial_account_bal_enable");
69 $this->waitForElementPresent("xpath=//tr[@class='crm-preferences-form-block-fiscalYearStart'][@style='display: none;']");
71 $this->click("financial_account_bal_enable");
72 $this->waitForElementPresent("xpath=//*[@id='fiscalYearStart_M']");
73 $this->select('fiscalYearStart_M', "value=4");
74 $this->select('fiscalYearStart_d', "value=30");
76 $this->webtestFillDate('period_closing_date', 'now+2');
77 $this->click('_qf_Contribute_next');
78 $this->waitForPageToLoad($this->getTimeoutMsec());
81 $this->assertTrue($this->isTextPresent('Changes saved.'),
82 "Status message didn't show up after saving!"