Commit | Line | Data |
---|---|---|
201b45e2 PN |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2016 | | |
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 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 | +--------------------------------------------------------------------+ | |
25 | */ | |
26 | ||
27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; | |
28 | ||
29 | /** | |
30 | * Class WebTest_Admin_Form_Setting_LocalizationTest | |
31 | */ | |
32 | class WebTest_Contribute_AccrualSettingTest extends CiviSeleniumTestCase { | |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
38 | public function testAccrualSettings() { | |
39 | $this->webtestLogin(); | |
40 | $this->openCiviPage("admin/setting/preferences/contribute", "reset=1"); | |
41 | $this->waitForElementPresent("_qf_Contribute_next"); | |
42 | ||
43 | // Check hide/show | |
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;']"); | |
48 | ||
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); | |
56 | ||
57 | // Input value | |
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']"); | |
62 | ||
63 | $this->select('default_invoice_page', "value={$pageId}"); | |
64 | ||
65 | // Check hide/show | |
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;']"); | |
70 | ||
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"); | |
75 | ||
76 | $this->webtestFillDate('period_closing_date', 'now+2'); | |
77 | $this->click('_qf_Contribute_next'); | |
78 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
79 | ||
80 | //does data saved. | |
81 | $this->assertTrue($this->isTextPresent('Changes saved.'), | |
82 | "Status message didn't show up after saving!" | |
83 | ); | |
84 | } | |
85 | ||
86 | } |