From 48eab573e97910a0179100860463836820520316 Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Sun, 12 Feb 2023 13:32:53 +0000 Subject: [PATCH] [REF][PHP8.2] Remove use of dynamic properties in CRM_Contact_Form_Task_EmailTest --- .../CRM/Contact/Form/Task/EmailTest.php | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/phpunit/CRM/Contact/Form/Task/EmailTest.php b/tests/phpunit/CRM/Contact/Form/Task/EmailTest.php index 2c807b24d1..7cdf0b2fb5 100644 --- a/tests/phpunit/CRM/Contact/Form/Task/EmailTest.php +++ b/tests/phpunit/CRM/Contact/Form/Task/EmailTest.php @@ -17,17 +17,24 @@ use Civi\Api4\Activity; */ class CRM_Contact_Form_Task_EmailTest extends CiviUnitTestCase { + /** + * Option value for 'From Email Address' option, + * created as part of test setup. + * + * @var array + */ + private $optionValue; + /** * Set up for tests. * */ protected function setUp(): void { parent::setUp(); - $this->_contactIds = [ - $this->individualCreate(['first_name' => 'Antonia', 'last_name' => 'D`souza']), - $this->individualCreate(['first_name' => 'Anthony', 'last_name' => 'Collins']), - ]; - $this->_optionValue = $this->callAPISuccess('optionValue', 'create', [ + $this->individualCreate(['first_name' => 'Antonia', 'last_name' => 'D`souza']); + $this->individualCreate(['first_name' => 'Anthony', 'last_name' => 'Collins']); + + $this->optionValue = $this->callAPISuccess('optionValue', 'create', [ 'label' => '"Seamus Lee" ', 'option_group_id' => 'from_email_address', ]); @@ -50,10 +57,10 @@ class CRM_Contact_Form_Task_EmailTest extends CiviUnitTestCase { $emails = CRM_Core_BAO_Email::domainEmails(); $this->assertNotEmpty($emails); $optionValue = $this->callAPISuccess('OptionValue', 'Get', [ - 'id' => $this->_optionValue['id'], + 'id' => $this->optionValue['id'], ]); $this->assertArrayHasKey('"Seamus Lee" ', $emails); - $this->assertEquals('"Seamus Lee" ', $optionValue['values'][$this->_optionValue['id']]['label']); + $this->assertEquals('"Seamus Lee" ', $optionValue['values'][$this->optionValue['id']]['label']); } /** -- 2.25.1