Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-19298 - ensure we get two receipts, with no total line. #9438

Merged
merged 4 commits into from
Nov 28, 2016

Conversation

jmcclelland
Copy link
Contributor

@jmcclelland jmcclelland commented Nov 23, 2016

@eileenmcnaughton
Copy link
Contributor

@jmcclelland looks like there is a style issue

@jmcclelland
Copy link
Contributor Author

Thanks for the heads up Eileen

'Membership Fee',
),
array(
'Total: $'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmcclelland still there :-(

ContributionPageTest.php:451, CommaLastItem, Priority: Normal
A comma should follow the last multiline array item. Found: 'Total: $'

No description available. Please upgrade to latest checkstyle version.

@eileenmcnaughton
Copy link
Contributor

I just came across this & pasting it mostly for information - this is how I have been testing receipts recently - ie. with a special template to expose the variables

  /**
   * Test to ensure mail is sent on chosing pay later
   */
  public function testpayLater() {
    $mut = new CiviMailUtils($this, TRUE);
    $this->swapMessageTemplateForTestTemplate();
    $this->createLoggedInUser();

    // create contribution page first
    $contributionPageParams = array(
      'title' => 'Help Support CiviCRM!',
      'financial_type_id' => 1,
      'is_monetary' => TRUE,
      'is_pay_later' => 1,
      'is_quick_config' => TRUE,
      'pay_later_text' => 'I will send payment by check',
      'pay_later_receipt' => 'This is a pay later reciept',
      'is_allow_other_amount' => 1,
      'min_amount' => 10.00,
      'max_amount' => 10000.00,
      'goal_amount' => 100000.00,
      'is_email_receipt' => 1,
      'is_active' => 1,
      'amount_block_is_active' => 1,
      'currency' => 'USD',
      'is_billing_required' => 0,
    );
    $contributionPageResult = $this->callAPISuccess('contribution_page', 'create', $contributionPageParams);

    // submit form values
    $priceSet = $this->callAPISuccess('price_set', 'getsingle', array('name' => 'default_contribution_amount'));
    $params = array(
      'id' => $contributionPageResult['id'],
      'contact_id' => $this->_individualId,
      'email-5' => 'anthony_anderson@civicrm.org',
      'payment_processor_id' => 0,
      'amount' => 100.00,
      'tax_amount' => '',
      'currencyID' => 'USD',
      'is_pay_later' => 1,
      'invoiceID' => 'f28e1ddc86f8c4a0ff5bcf46393e4bc8',
      'is_quick_config' => 1,
      'description' => 'Online Contribution: Help Support CiviCRM!',
      'price_set_id' => $priceSet['id'],
    );
    $this->callAPISuccess('contribution_page', 'submit', $params);

    $mut->checkMailLog(array(
      'is_pay_later:::1',
      'email:::anthony_anderson@civicrm.org',
      'pay_later_receipt:::' . $contributionPageParams['pay_later_receipt'],
      'displayName:::Mr. Anthony Anderson II',
      'contributionPageId:::' . $contributionPageResult['id'],
      'title:::' . $contributionPageParams['title'],
      'amount:::' . $params['amount'],
    ));
    $mut->stop();
    $this->revertTemplateToReservedTemplate();
  }

@eileenmcnaughton
Copy link
Contributor

This is additional testing only - hence adding 'merge on pass' label

@jmcclelland
Copy link
Contributor Author

Thanks Eileen - damn that comma.

Also thanks for the tip on swapping templates. However... that doesn't allow any of the smarty logic in the template to get tested - which could be the source of the bug.

@eileenmcnaughton
Copy link
Contributor

It's trying to torture you

In "sites/all/modules/civicrm/", final commit is "8978bd29995eb6c235954d38e53bbe6a46114b7f".
~/buildkit/build/core-9438-1qa2e/sites/all/modules/civicrm ~/workspace/CiviCRM-Core-PR
===========================[ Identify Files ]===========================
PHP Files:

  • tests/phpunit/api/v3/ContributionPageTest.php
    ===============================[ php -l ]===============================
    PHP Parse error: syntax error, unexpected ')' in tests/phpunit/api/v3/ContributionPageTest.php on line 454
    Errors parsing tests/phpunit/api/v3/ContributionPageTest.php
    ===============================[ phpcs ]===============================

@jmcclelland
Copy link
Contributor Author

OMG. I wish I could blame the tests. I think I must be trying to torture myself!

@eileenmcnaughton
Copy link
Contributor

It passed! woot

@eileenmcnaughton eileenmcnaughton merged commit 97f643c into civicrm:master Nov 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants