(REF) PaymentTest - Use "Invasive" helper
authorTim Otten <totten@civicrm.org>
Thu, 31 Dec 2020 09:29:43 +0000 (01:29 -0800)
committerTim Otten <totten@civicrm.org>
Thu, 31 Dec 2020 09:31:49 +0000 (01:31 -0800)
It's shorter/prettier.

tests/phpunit/CRM/Core/PaymentTest.php

index a93759f7318869308c4930e7a94d5688ad859c5e..3615719a072a9726e27a6c868488acced5607e2c 100644 (file)
@@ -9,6 +9,8 @@
  +--------------------------------------------------------------------+
  */
 
+use Civi\Test\Invasive;
+
 /**
  * Class CRM_Core_PaymentTest
  * @group headless
@@ -64,14 +66,8 @@ class CRM_Core_PaymentTest extends CiviUnitTestCase {
     $processor->setCancelUrl($cancel);
     $processor->setSuccessUrl($success);
 
-    // Using ReflectionUtils to access protected methods
-    $successGetter = new ReflectionMethod($processor, 'getReturnSuccessUrl');
-    $successGetter->setAccessible(TRUE);
-    $this->assertEquals($success, $successGetter->invoke($processor, NULL));
-
-    $cancelGetter = new ReflectionMethod($processor, 'getReturnFailUrl');
-    $cancelGetter->setAccessible(TRUE);
-    $this->assertEquals($cancel, $cancelGetter->invoke($processor, NULL));
+    $this->assertEquals($success, Invasive::call([$processor, 'getReturnSuccessUrl'], [NULL]));
+    $this->assertEquals($cancel, Invasive::call([$processor, 'getReturnFailUrl'], [NULL]));
   }
 
 }