Merge pull request #19800 from eileenmcnaughton/gettypes
[civicrm-core.git] / ext / flexmailer / tests / phpunit / Civi / FlexMailer / ConcurrentDeliveryTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11 namespace Civi\FlexMailer;
12
13 /**
14 *
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 * @version $Id: Job.php 30879 2010-11-22 15:45:55Z shot $
17 *
18 */
19
20 // For compat w/v4.6 phpunit
21 require_once 'tests/phpunit/api/v3/JobProcessMailingTest.php';
22
23 /**
24 * Class ConcurrentDeliveryTest
25 *
26 * Check that CiviMail batching and concurrency features work as expected.
27 * This is a variation on api_v3_JobProcessMailingTest -- but this uses
28 * FlexMailer instead of BAO delivery.
29 *
30 * @group headless
31 * @group civimail
32 * @see \api_v3_JobProcessMailingTest
33 */
34 class ConcurrentDeliveryTest extends \api_v3_JobProcessMailingTest {
35
36 public function setUp(): void {
37 // Activate before transactions are setup.
38 $manager = \CRM_Extension_System::singleton()->getManager();
39 if ($manager->getStatus('org.civicrm.flexmailer') !== \CRM_Extension_Manager::STATUS_INSTALLED) {
40 $manager->install(array('org.civicrm.flexmailer'));
41 }
42
43 parent::setUp();
44
45 \Civi::settings()->set('flexmailer_traditional', 'flexmailer');
46 }
47
48 public function tearDown(): void {
49 // We're building on someone else's test and don't fully trust them to
50 // protect our settings. Make sure they did.
51 $ok = ('flexmailer' == \Civi::settings()->get('flexmailer_traditional'))
52 && ('s:10:"flexmailer";' === \CRM_Core_DAO::singleValueQuery('SELECT value FROM civicrm_setting WHERE name ="flexmailer_traditional"'));
53
54 parent::tearDown();
55
56 $this->assertTrue($ok, 'FlexMailer remained active during testing');
57 }
58
59 // ---- Boilerplate ----
60
61 // The remainder of this class contains dummy stubs which make it easier to
62 // work with the tests in an IDE.
63
64 /**
65 * @dataProvider concurrencyExamples
66 * @see _testConcurrencyCommon
67 */
68 public function testConcurrency($settings, $expectedTallies, $expectedTotal): void {
69 parent::testConcurrency($settings, $expectedTallies, $expectedTotal);
70 }
71
72 public function testBasic(): void {
73 parent::testBasic();
74 }
75
76 }