+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016 |
+ | Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
// total amount
$this->type("total_amount", "100");
+ // revenue recognition date (CRM-16189)
+ if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
+ $this->webtestFillDate('revenue_recognition_date', 'now+4');
+ }
// select payment instrument type = Check and enter chk number
$this->select("payment_instrument_id", "value=4");
if ($label == 'sort_name') {
continue;
}
- $this->verifyText("xpath=//form[@id='ContributionView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
- preg_quote($value)
- );
+ $this->assertElementContainsText("xpath=//form[@id='ContributionView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td", "{$value}");
}
// now find contact and go back to contact summary
$this->assertElementContainsText("xpath=//table[@id='info']/tbody/tr[2]/td[1]", "£ 100.00");
}
+ public function testRevenueRecognitionDateAdd() {
+ $this->webtestLogin();
+ $this->openCiviPage("admin/setting/preferences/contribute", "reset=1");
+ $this->waitForElementPresent("_qf_Contribute_next");
+ $this->click('deferred_revenue_enabled');
+ $this->click('_qf_Contribute_next');
+ $this->waitForPageToLoad($this->getTimeoutMsec());
+
+ // Create a contact to be used as soft creditor
+ $softCreditFname = substr(sha1(rand()), 0, 7);
+ $softCreditLname = substr(sha1(rand()), 0, 7);
+ $this->webtestAddContact($softCreditFname, $softCreditLname, FALSE);
+
+ //financial account for check
+ $this->openCiviPage("admin/options/payment_instrument", "reset=1");
+ $financialAccount = $this->getText("xpath=//div[@id='payment_instrument']/table/tbody//tr/td[1]/div[text()='Check']/../../td[3]");
+
+ // Add new Financial Account
+ $orgName = 'Alberta ' . substr(sha1(rand()), 0, 7);
+ $financialAccountTitle = 'Financial Account ' . substr(sha1(rand()), 0, 4);
+ $financialAccountDescription = "{$financialAccountTitle} Description";
+ $accountingCode = 1033;
+ $financialAccountType = 'Asset';
+ $taxDeductible = FALSE;
+ $isActive = FALSE;
+ $isTax = TRUE;
+ $taxRate = 9;
+ $isDefault = FALSE;
+
+ //Add new organisation
+ if ($orgName) {
+ $this->webtestAddOrganization($orgName);
+ }
+
+ $this->_testAddFinancialAccount($financialAccountTitle,
+ $financialAccountDescription,
+ $accountingCode,
+ $orgName,
+ $financialAccountType,
+ $taxDeductible,
+ $isActive,
+ $isTax,
+ $taxRate,
+ $isDefault
+ );
+
+ $firstName = 'John' . substr(sha1(rand()), 0, 7);
+ $lastName = 'Dsouza' . substr(sha1(rand()), 0, 7);
+ $this->webtestAddContact($firstName, $lastName);
+
+ $this->waitForElementPresent("css=li#tab_contribute a");
+ $this->click("css=li#tab_contribute a");
+ $this->waitForElementPresent("link=Record Contribution (Check, Cash, EFT ...)");
+ $this->clickLink("link=Record Contribution (Check, Cash, EFT ...)", "_qf_Contribution_cancel-bottom", FALSE);
+
+ // select financial type
+ $this->select("financial_type_id", "value=1");
+
+ // fill in Received Date
+ $this->webtestFillDate('receive_date');
+
+ // source
+ $this->type("source", "Mailer 1");
+
+ // total amount
+ $this->type("total_amount", "100");
+
+ // revenue recognition date (CRM-16189)
+ $this->webtestFillDate('revenue_recognition_date', 'now');
+
+ // select payment instrument type = Check and enter chk number
+ $this->select("payment_instrument_id", "value=4");
+ $this->waitForElementPresent("check_number");
+ $this->type("check_number", "check #1041");
+
+ $this->type("trxn_id", "P20901X1" . rand(100, 10000));
+
+ //Additional Detail section
+ $this->click("AdditionalDetail");
+ $this->waitForElementPresent("thankyou_date");
+
+ $this->type("note", "This is a test note.");
+ $this->type("non_deductible_amount", "10.00");
+ $this->type("fee_amount", "0");
+ $this->type("net_amount", "0");
+ $this->type("invoice_id", time());
+ $this->webtestFillDate('thankyou_date');
+
+ // Clicking save.
+ $this->click("_qf_Contribution_upload");
+
+ // verify if Contribution is created
+ $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='Edit']");
+
+ //click through to the Contribution edit screen
+ $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='Edit']");
+ $this->waitForElementPresent("_qf_Contribution_cancel");
+ $val = $this->getValue("xpath=//input[@id='revenue_recognition_date']");
+ $this->assertEquals(date('m/d/Y'), $val);
+ }
+
}