-
-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9411af
commit 2fb1811
Showing
2 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
/* | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC. All rights reserved. | | ||
| | | ||
| This work is published under the GNU AGPLv3 license with some | | ||
| permitted exceptions and without any warranty. For full license | | ||
| and copyright information, see https://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
|
||
/** | ||
* @package CiviCRM_APIv3 | ||
* @subpackage API_Contribution | ||
* @group headless | ||
*/ | ||
class CRM_Member_Form_Task_LabelTest extends CiviUnitTestCase { | ||
|
||
/** | ||
* Test print label. | ||
* | ||
* This is a 'no error' test to support refactoring. It ensures no fatal is hit & lays | ||
* the basis for more tests later. | ||
*/ | ||
public function testMembershipTokenReplacementInPDF() { | ||
// First check tasks are there is some weird static caching that could mess us up. | ||
$tasks = CRM_Member_Task::tasks(); | ||
$this->assertArrayHasKey(201, $tasks); | ||
$tasks = CRM_Member_Task::permissionedTaskTitles(CRM_Core_Permission::EDIT); | ||
$this->assertArrayHasKey(201, $tasks); | ||
$membershipID = $this->contactMembershipCreate(['contact_id' => $this->individualCreate()]); | ||
/* @var CRM_Member_Form_Task_Label $form */ | ||
$form = $this->getFormObject('CRM_Member_Form_Task_Label', [ | ||
'task' => 201, | ||
'radio_ts' => 'ts_sel', | ||
], 'Search'); | ||
|
||
$_SESSION['_' . $form->controller->_name . '_container']['values']['Label'] = [ | ||
'location_type_id' => NULL, | ||
'label_name' => 3475, | ||
]; | ||
$form->preProcess(); | ||
$form->ids = [$membershipID => $membershipID]; | ||
$form->buildForm(); | ||
try { | ||
$form->postProcess(); | ||
} | ||
catch (CRM_Core_Exception_PrematureExitException $e) { | ||
$this->assertEquals(3475, $e->errorData['format']); | ||
} | ||
} | ||
|
||
} |