X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FCRM%2FUtils%2FMail%2FEmailProcessorTest.php;h=89354b9783ced0957af790fe966e552efab89f39;hb=c67a59391d975837bfe40d1d6014b1ed91b72b73;hp=8abebc844a12cfd1a8dd70bfe238d0c1b835b77f;hpb=850d8c7cf555cdb11176418b2d1ecd035eddcb14;p=civicrm-core.git diff --git a/tests/phpunit/CRM/Utils/Mail/EmailProcessorTest.php b/tests/phpunit/CRM/Utils/Mail/EmailProcessorTest.php index 8abebc844a..89354b9783 100644 --- a/tests/phpunit/CRM/Utils/Mail/EmailProcessorTest.php +++ b/tests/phpunit/CRM/Utils/Mail/EmailProcessorTest.php @@ -11,7 +11,7 @@ class CRM_Utils_Mail_EmailProcessorTest extends CiviUnitTestCase { * * @var array */ - protected $eventQueue = array(); + protected $eventQueue = []; /** * ID of our sample contact. @@ -24,20 +24,20 @@ class CRM_Utils_Mail_EmailProcessorTest extends CiviUnitTestCase { parent::setUp(); CRM_Utils_File::cleanDir(__DIR__ . '/data/mail'); mkdir(__DIR__ . '/data/mail'); - $this->callAPISuccess('MailSettings', 'get', array( - 'api.MailSettings.create' => array( + $this->callAPISuccess('MailSettings', 'get', [ + 'api.MailSettings.create' => [ 'name' => 'local', 'protocol' => 'Localdir', 'source' => __DIR__ . '/data/mail', 'domain' => 'example.com', - ), - )); + ], + ]); } public function tearDown() { CRM_Utils_File::cleanDir(__DIR__ . '/data/mail'); parent::tearDown(); - $this->quickCleanup(array('civicrm_group', 'civicrm_group_contact', 'civicrm_mailing', 'civicrm_mailing_job', 'civicrm_mailing_event_bounce', 'civicrm_mailing_event_queue', 'civicrm_mailing_group', 'civicrm_mailing_recipients', 'civicrm_contact', 'civicrm_email')); + $this->quickCleanup(['civicrm_group', 'civicrm_group_contact', 'civicrm_mailing', 'civicrm_mailing_job', 'civicrm_mailing_event_bounce', 'civicrm_mailing_event_queue', 'civicrm_mailing_group', 'civicrm_mailing_recipients', 'civicrm_contact', 'civicrm_email']); } /** @@ -48,7 +48,7 @@ class CRM_Utils_Mail_EmailProcessorTest extends CiviUnitTestCase { copy(__DIR__ . '/data/bounces/bounce_no_verp.txt', __DIR__ . '/data/mail/bounce_no_verp.txt'); $this->assertTrue(file_exists(__DIR__ . '/data/mail/bounce_no_verp.txt')); - $this->callAPISuccess('job', 'fetch_bounces', array()); + $this->callAPISuccess('job', 'fetch_bounces', []); $this->assertFalse(file_exists(__DIR__ . '/data/mail/bounce_no_verp.txt')); $this->checkMailingBounces(1); } @@ -61,7 +61,7 @@ class CRM_Utils_Mail_EmailProcessorTest extends CiviUnitTestCase { $mail = 'test_invalid_character.eml'; copy(__DIR__ . '/data/bounces/' . $mail, __DIR__ . '/data/mail/' . $mail); - $this->callAPISuccess('job', 'fetch_bounces', array()); + $this->callAPISuccess('job', 'fetch_bounces', []); $this->assertFalse(file_exists(__DIR__ . '/data/mail/' . $mail)); $this->checkMailingBounces(1); } @@ -74,7 +74,7 @@ class CRM_Utils_Mail_EmailProcessorTest extends CiviUnitTestCase { $mail = 'test_utf8mb4_character.txt'; copy(__DIR__ . '/data/bounces/' . $mail, __DIR__ . '/data/mail/' . $mail); - $this->callAPISuccess('job', 'fetch_bounces', array()); + $this->callAPISuccess('job', 'fetch_bounces', []); $this->assertFalse(file_exists(__DIR__ . '/data/mail/' . $mail)); $this->checkMailingBounces(1); } @@ -89,7 +89,7 @@ class CRM_Utils_Mail_EmailProcessorTest extends CiviUnitTestCase { $mail = 'test_sample_message.eml'; copy(__DIR__ . '/data/bounces/' . $mail, __DIR__ . '/data/mail/' . $mail); - $this->callAPISuccess('job', 'fetch_bounces', array()); + $this->callAPISuccess('job', 'fetch_bounces', []); $this->assertFalse(file_exists(__DIR__ . '/data/mail/' . $mail)); $this->checkMailingBounces(1); } @@ -104,7 +104,7 @@ class CRM_Utils_Mail_EmailProcessorTest extends CiviUnitTestCase { $mail = 'test_nested_message.eml'; copy(__DIR__ . '/data/bounces/' . $mail, __DIR__ . '/data/mail/' . $mail); - $this->callAPISuccess('job', 'fetch_bounces', array()); + $this->callAPISuccess('job', 'fetch_bounces', []); $this->assertFalse(file_exists(__DIR__ . '/data/mail/' . $mail)); $this->checkMailingBounces(1); } @@ -126,14 +126,14 @@ class CRM_Utils_Mail_EmailProcessorTest extends CiviUnitTestCase { */ public function testBounceProcessingDeletedEmail() { $this->setUpMailing(); - $this->callAPISuccess('Email', 'get', array( + $this->callAPISuccess('Email', 'get', [ 'contact_id' => $this->contactID, 'api.email.delete' => 1, - )); + ]); copy(__DIR__ . '/data/bounces/bounce_no_verp.txt', __DIR__ . '/data/mail/bounce_no_verp.txt'); $this->assertTrue(file_exists(__DIR__ . '/data/mail/bounce_no_verp.txt')); - $this->callAPISuccess('job', 'fetch_bounces', array()); + $this->callAPISuccess('job', 'fetch_bounces', []); $this->assertFalse(file_exists(__DIR__ . '/data/mail/bounce_no_verp.txt')); $this->checkMailingBounces(1); } @@ -157,16 +157,16 @@ class CRM_Utils_Mail_EmailProcessorTest extends CiviUnitTestCase { * Set up a mailing. */ public function setUpMailing() { - $this->contactID = $this->individualCreate(array('email' => 'undeliverable@example.com')); - $groupID = $this->callAPISuccess('Group', 'create', array( + $this->contactID = $this->individualCreate(['email' => 'undeliverable@example.com']); + $groupID = $this->callAPISuccess('Group', 'create', [ 'title' => 'Mailing group', - 'api.GroupContact.create' => array( + 'api.GroupContact.create' => [ 'contact_id' => $this->contactID, - ), - )); - $this->createMailing(array('scheduled_date' => 'now', 'groups' => array('include' => array($groupID)))); - $this->callAPISuccess('job', 'process_mailing', array()); - $this->eventQueue = $this->callAPISuccess('MailingEventQueue', 'get', array('api.MailingEventQueue.create' => array('hash' => 'aaaaaaaaaaaaaaaa'))); + ], + ]); + $this->createMailing(['scheduled_date' => 'now', 'groups' => ['include' => [$groupID]]]); + $this->callAPISuccess('job', 'process_mailing', []); + $this->eventQueue = $this->callAPISuccess('MailingEventQueue', 'get', ['api.MailingEventQueue.create' => ['hash' => 'aaaaaaaaaaaaaaaa']]); } }