Commit 922e4357 authored by DaveD's avatar DaveD
Browse files

add test for receipts issued

parent cf5c0ba6
{
"singlePR": {
"include": [
{
"php-versions": "CIVICARROT_PHP_SENSIBLE",
"drupal": "CIVICARROT_DRUPAL_LATEST",
"civicrm": "dev-master"
}
]
}
}
......@@ -40,9 +40,12 @@ class CdntaxreceiptsBase extends CiviCrmTestBase {
'access CiviCRM',
'administer CiviCRM system',
'administer CiviCRM data',
'administer Reports',
'access CiviReport',
'access all custom data',
'edit all contacts',
'delete contacts',
'access deleted contacts',
'access CiviContribute',
'edit contributions',
'delete in CiviContribute',
......
<?php
namespace Civi\Cdntaxreceipts\Tests\Mink;
/**
* @group mink
*/
class ReceiptsIssuedReportTest extends CdntaxreceiptsBase {
/**
* @var array
* We always create one contact to start with.
*/
protected $contact;
public function setUp(): void {
parent::setUp();
$this->createUserAndLogIn();
$this->contact = $this->createContact();
}
public function testReport() {
$this->setDeliveryMethod(CDNTAX_DELIVERY_PRINT_ONLY);
$contribution = civicrm_api3('Contribution', 'create', [
'contact_id' => $this->contact['id'],
'financial_type_id' => 'Donation',
'total_amount' => '10',
'receive_date' => date('Y-m-d'),
]);
// go to the contribution
$this->drupalGet(\CRM_Utils_System::url("civicrm/contact/view/contribution", "reset=1&id={$contribution['id']}&cid={$this->contact['id']}&action=view", TRUE, NULL, FALSE));
$this->assertPageHasNoErrorMessages();
// click the tax receipt button
$this->getSession()->getPage()->pressButton('Tax Receipt');
$this->assertPageHasNoErrorMessages();
$this->assertSession()->waitForElementVisible('css', '.crm-button_qf_ViewTaxReceipt_next');
$this->getSession()->getPage()->pressButton('_qf_ViewTaxReceipt_next-bottom');
$this->assertPageHasNoErrorMessages();
// go to the report
$this->drupalGet(\CRM_Utils_System::url('civicrm/report/cdntaxreceipts%3Areceiptsissued', 'reset=1', TRUE, NULL, FALSE));
$this->assertPageHasNoErrorMessages();
// click the button
$this->getSession()->getPage()->pressButton('_qf_ReceiptsIssued_submit');
$this->htmlOutput();
$this->assertPageHasNoErrorMessages();
$this->assertSession()->pageTextContains('Tax Receipts - Receipts Issued');
$this->assertSession()->pageTextContains('C-00000001');
$this->assertSession()->pageTextContains('Total Amount Issued');
$this->assertSession()->pageTextContains('$ 10.00');
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment