From: Tim Otten Date: Thu, 31 Dec 2020 09:29:20 +0000 (-0800) Subject: (REF) MailingJobTest - Use "Invasive" helper X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=340306cf98ed0927461aadd6f49552363833502a;p=civicrm-core.git (REF) MailingJobTest - Use "Invasive" helper It's shorter/prettier. --- diff --git a/tests/phpunit/CRM/Mailing/BAO/MailingJobTest.php b/tests/phpunit/CRM/Mailing/BAO/MailingJobTest.php index 4eaa81523d..04f4e8b300 100644 --- a/tests/phpunit/CRM/Mailing/BAO/MailingJobTest.php +++ b/tests/phpunit/CRM/Mailing/BAO/MailingJobTest.php @@ -9,22 +9,14 @@ +--------------------------------------------------------------------+ */ +use Civi\Test\Invasive; + /** * Class CRM_Mailing_BAO_MailingTest * @group headless */ class CRM_Mailing_BAO_MailingJobTest extends CiviUnitTestCase { - /** - * Calls a protected method. - */ - public static function callMethod($obj, $name, $args) { - $class = new ReflectionClass($obj); - $method = $class->getMethod($name); - $method->setAccessible(TRUE); - return $method->invokeArgs($obj, $args); - } - /** * Tests CRM_Mailing_BAO_MailingJob::isTemporaryError() method. */ @@ -38,7 +30,7 @@ class CRM_Mailing_BAO_MailingJobTest extends CiviUnitTestCase { $testcases[] = ['return' => FALSE, 'message' => 'authentication failure [SMTP: Invalid response code received from SMTP server while sending email. This is often caused by a misconfiguration in Outbound Email settings. Please verify the settings at Administer CiviCRM >> Global Settings >> Outbound Email (SMTP). (code: 454, response: Temporary authentication failure)]']; $object = new CRM_Mailing_BAO_MailingJob(); foreach ($testcases as $testcase) { - $isTemporaryError = self::callMethod($object, 'isTemporaryError', [$testcase['message']]); + $isTemporaryError = Invasive::call([$object, 'isTemporaryError'], [$testcase['message']]); if ($testcase['return']) { $this->assertTrue($isTemporaryError); }