Commit a86d27fc authored by eileen's avatar eileen

CRM-12108 tests on refactored PayPalProIPN, if CRM-12972 is fixed try catch...

CRM-12108 tests on refactored PayPalProIPN, if CRM-12972 is fixed try catch can be removed & can update to check mail is sent
parent 28658972
......@@ -158,6 +158,8 @@ class CRM_Contribute_BAO_ContributionPageTest extends CiviUnitTestCase {
* test checkRecurPaymentProcessor() method
*/
function testcheckRecurPaymentProcessor() {
//@todo paypalpro create seems to fail silently without causing this class to fail
// $this->paymentProcessorCreate may be a better option
$paymentProcessor = PaypalPro::create();
$params = array(
'title' => 'Test Contribution Page',
......
This diff is collapsed.
......@@ -680,7 +680,10 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
* @param string $entity
* @param string $action
* @param array $params
* @param mixed $checkAgainst optional value to check result against, implemented for getvalue, getcount, getsingle
* @param mixed $checkAgainst optional value to check result against, implemented for getvalue,
* getcount, getsingle. Note that for getvalue the type is checked rather than the value
* for getsingle the array is compared against an array passed in - the id is not compared (for
* better or worse )
*/
function callAPISuccess($entity, $action, $params, $checkAgainst = NULL) {
$params = array_merge(array(
......@@ -2268,179 +2271,46 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' )
}
}
/**
* FIXME: something NULLs $GLOBALS['_HTML_QuickForm_registered_rules'] when the tests are ran all together
* (NB unclear if this is still required)
*/
function _sethtmlGlobals() {
$GLOBALS['_HTML_QuickForm_registered_rules'] = array(
'required' => array(
'html_quickform_rule_required',
'HTML/QuickForm/Rule/Required.php'
),
'maxlength' => array(
'html_quickform_rule_range',
'HTML/QuickForm/Rule/Range.php'
),
'minlength' => array(
'html_quickform_rule_range',
'HTML/QuickForm/Rule/Range.php'
),
'rangelength' => array(
'html_quickform_rule_range',
'HTML/QuickForm/Rule/Range.php'
),
'email' => array(
'html_quickform_rule_email',
'HTML/QuickForm/Rule/Email.php'
),
'regex' => array(
'html_quickform_rule_regex',
'HTML/QuickForm/Rule/Regex.php'
),
'lettersonly' => array(
'html_quickform_rule_regex',
'HTML/QuickForm/Rule/Regex.php'
),
'alphanumeric' => array(
'html_quickform_rule_regex',
'HTML/QuickForm/Rule/Regex.php'
),
'numeric' => array(
'html_quickform_rule_regex',
'HTML/QuickForm/Rule/Regex.php'
),
'nopunctuation' => array(
'html_quickform_rule_regex',
'HTML/QuickForm/Rule/Regex.php'
),
'nonzero' => array(
'html_quickform_rule_regex',
'HTML/QuickForm/Rule/Regex.php'
),
'callback' => array(
'html_quickform_rule_callback',
'HTML/QuickForm/Rule/Callback.php'
),
'compare' => array(
'html_quickform_rule_compare',
'HTML/QuickForm/Rule/Compare.php'
)
);
// FIXME: …ditto for $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES']
$GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'] = array(
'group' => array(
'HTML/QuickForm/group.php',
'HTML_QuickForm_group'
),
'hidden' => array(
'HTML/QuickForm/hidden.php',
'HTML_QuickForm_hidden'
),
'reset' => array(
'HTML/QuickForm/reset.php',
'HTML_QuickForm_reset'
),
'checkbox' => array(
'HTML/QuickForm/checkbox.php',
'HTML_QuickForm_checkbox'
),
'file' => array(
'HTML/QuickForm/file.php',
'HTML_QuickForm_file'
),
'image' => array(
'HTML/QuickForm/image.php',
'HTML_QuickForm_image'
),
'password' => array(
'HTML/QuickForm/password.php',
'HTML_QuickForm_password'
),
'radio' => array(
'HTML/QuickForm/radio.php',
'HTML_QuickForm_radio'
),
'button' => array(
'HTML/QuickForm/button.php',
'HTML_QuickForm_button'
),
'submit' => array(
'HTML/QuickForm/submit.php',
'HTML_QuickForm_submit'
),
'select' => array(
'HTML/QuickForm/select.php',
'HTML_QuickForm_select'
),
'hiddenselect' => array(
'HTML/QuickForm/hiddenselect.php',
'HTML_QuickForm_hiddenselect'
),
'text' => array(
'HTML/QuickForm/text.php',
'HTML_QuickForm_text'
),
'textarea' => array(
'HTML/QuickForm/textarea.php',
'HTML_QuickForm_textarea'
),
'fckeditor' => array(
'HTML/QuickForm/fckeditor.php',
'HTML_QuickForm_FCKEditor'
),
'tinymce' => array(
'HTML/QuickForm/tinymce.php',
'HTML_QuickForm_TinyMCE'
),
'dojoeditor' => array(
'HTML/QuickForm/dojoeditor.php',
'HTML_QuickForm_dojoeditor'
),
'link' => array(
'HTML/QuickForm/link.php',
'HTML_QuickForm_link'
),
'advcheckbox' => array(
'HTML/QuickForm/advcheckbox.php',
'HTML_QuickForm_advcheckbox'
),
'date' => array(
'HTML/QuickForm/date.php',
'HTML_QuickForm_date'
),
'static' => array(
'HTML/QuickForm/static.php',
'HTML_QuickForm_static'
),
'header' => array(
'HTML/QuickForm/header.php',
'HTML_QuickForm_header'
),
'html' => array(
'HTML/QuickForm/html.php',
'HTML_QuickForm_html'
),
'hierselect' => array(
'HTML/QuickForm/hierselect.php',
'HTML_QuickForm_hierselect'
),
'autocomplete' => array(
'HTML/QuickForm/autocomplete.php',
'HTML_QuickForm_autocomplete'
),
'xbutton' => array(
'HTML/QuickForm/xbutton.php',
'HTML_QuickForm_xbutton'
),
'advmultiselect' => array(
'HTML/QuickForm/advmultiselect.php',
'HTML_QuickForm_advmultiselect'
)
);
}
}
/**
* Create an instance of the paypal processor
* @todo this isn't a great place to put it - but really it belongs on a class that extends
* this parent class & we don't have a structure for that yet
* There is another function to this effect on the PaypalPro test but it appears to be silently failing
* & the best protection agains that is the functions this class affords
*/
function paymentProcessorCreate($params = array()) {
$params = array_merge(array(
'name' => 'demo',
'domain_id' => CRM_Core_Config::domainID(),
'payment_processor_type_id' => 'PayPal',
'is_active' => 1,
'is_default' => 0,
'is_test' => 1,
'user_name' => 'sunil._1183377782_biz_api1.webaccess.co.in',
'password' => '1183377788',
'signature' => 'APixCoQ-Zsaj-u3IH7mD5Do-7HUqA9loGnLSzsZga9Zr-aNmaJa3WGPH',
'url_site' => 'https://www.sandbox.paypal.com/',
'url_api' => 'https://api-3t.sandbox.paypal.com/',
'url_button' => 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif',
'class_name' => 'Payment_PayPalImpl',
'billing_mode' => 3,
'financial_type_id' => 1,
),
$params);
if(!is_numeric($params['payment_processor_type_id'])) {
// really the api should handle this through getoptions but it's not exactly api call so lets just sort it
//here
$params['payment_processor_type_id'] = $this->callAPISuccess('payment_processor_type', 'getvalue', array(
'name' => $params['payment_processor_type_id'],
'return' => 'id',
), 'integer');
}
$result = $this->callAPISuccess('payment_processor', 'create', $params);
return $result['id'];
}
function CiviUnitTestCase_fatalErrorHandler($message) {
throw new Exception("{$message['message']}: {$message['code']}");
}
}
......@@ -6,6 +6,9 @@ class PaypalPro extends PHPUnit_Framework_Testcase {
* a payment processor of type Paypal Pro
*
* @return $paymentProcessor id of created payment processor
* @todo this appears not to be working but because it doesn't extend the test class
* callAPISuccess won't work
* I have duplicated this on the main test class as a work around
*/
static function create() {
......
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