3 +--------------------------------------------------------------------+
4 | CiviCRM version 5 | |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2020 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
28 * Test class for CRM_Contact_Form_Task_EmailCommon.
31 class CRM_Mailing_Form_Task_AdhocMailingTest
extends CiviUnitTestCase
{
36 protected function setUp() {
38 $this->_contactIds
= [
39 $this->individualCreate(['first_name' => 'Antonia', 'last_name' => 'D`souza']),
40 $this->individualCreate(['first_name' => 'Anthony', 'last_name' => 'Collins']),
42 $this->_optionValue
= $this->callAPISuccess('optionValue', 'create', [
43 'label' => '"Seamus Lee" <seamus@example.com>',
44 'option_group_id' => 'from_email_address',
49 * Test creating a hidden smart group from a search builder search.
51 * A hidden smart group is a group used for sending emails.
53 * @throws \CRM_Core_Exception
56 public function testCreateHiddenGroupFromSearchBuilder() {
57 $this->createLoggedInUser();
59 'qfKey' => 'dde96a85ddebb90fb66de44859404aeb_2077',
60 'entryURL' => 'http://dmaster.local/civicrm/contact/search/builder?reset=1',
61 'mapper' => [1 => [['Individual']]],
62 'operator' => [1 => ['=']],
63 'value' => [1 => [0 => 'erwr']],
64 '_qf_default' => 'Builder:refresh',
65 '_qf_Builder_refresh' => 'Search',
68 $form = $this->getFormObject('CRM_Mailing_Form_Task_AdhocMailing', $formValues, 'Builder');
69 $form->setAction(CRM_Core_Action
::PROFILE
);
70 $form->set('formValues', $formValues);
71 $form->set('isSearchBuilder', 1);
72 $form->set('context', 'builder');
76 catch (CRM_Core_Exception_PrematureExitException
$e) {
77 // Nothing to see here.
79 $savedSearch = $this->callAPISuccessGetSingle('SavedSearch', []);
80 $this->assertEquals($formValues, $savedSearch['form_values']);