-
-
Notifications
You must be signed in to change notification settings - Fork 827
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13978 from totten/master-phpcbf
(NFC) Update various files to pass current phpcs
- Loading branch information
Showing
18 changed files
with
219 additions
and
227 deletions.
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
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<?php | ||
|
||
/** | ||
* Class CRM_Contribute_Exception_CheckLineItemsException | ||
*/ | ||
class CRM_Contribute_Exception_CheckLineItemsException extends API_Exception { | ||
const LINE_ITEM_DIFFERRING_TOTAL_EXCEPTON_MSG = "Line item total doesn't match with total amount."; | ||
|
||
public function __construct($message = self::LINE_ITEM_DIFFERRING_TOTAL_EXCEPTON_MSG, $error_code = 0, array $extraParams = [], $previous = NULL) { | ||
parent::__construct($message, $error_code, $extraParams, $previous); | ||
} | ||
|
||
} | ||
<?php | ||
|
||
/** | ||
* Class CRM_Contribute_Exception_CheckLineItemsException | ||
*/ | ||
class CRM_Contribute_Exception_CheckLineItemsException extends API_Exception { | ||
const LINE_ITEM_DIFFERRING_TOTAL_EXCEPTON_MSG = "Line item total doesn't match with total amount."; | ||
|
||
public function __construct($message = self::LINE_ITEM_DIFFERRING_TOTAL_EXCEPTON_MSG, $error_code = 0, array $extraParams = [], $previous = NULL) { | ||
parent::__construct($message, $error_code, $extraParams, $previous); | ||
} | ||
|
||
} |
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
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 |
---|---|---|
|
@@ -51,4 +51,5 @@ public function __construct($object, $result) { | |
$this->object = $object; | ||
$this->result = $result; | ||
} | ||
|
||
} |
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
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
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
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
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 |
---|---|---|
@@ -1,85 +1,85 @@ | ||
<?php | ||
|
||
class CRM_Price_Form_FieldTest extends CiviUnitTestCase { | ||
|
||
protected $priceFieldValues; | ||
protected $visibilityOptionsKeys; | ||
protected $visibilityOptions; | ||
protected $publicFieldParams; | ||
protected $adminFieldParams; | ||
|
||
public function setUp() { | ||
parent::setUp(); | ||
|
||
$this->visibilityOptionsKeys = CRM_Price_BAO_PriceFieldValue::buildOptions('visibility_id', NULL, array( | ||
'labelColumn' => 'name', | ||
'flip' => TRUE, | ||
)); | ||
|
||
$this->publicFieldParams = $this->initializeFieldParameters(array( | ||
'label' => 'Public Price Field', | ||
'name' => 'public_price', | ||
'visibility_id' => $this->visibilityOptionsKeys['public'], | ||
)); | ||
|
||
$this->adminFieldParams = $this->initializeFieldParameters(array( | ||
'label' => 'Public Price Field', | ||
'name' => 'public_price', | ||
'visibility_id' => $this->visibilityOptionsKeys['admin'], | ||
)); | ||
} | ||
|
||
public function testPublicFieldWithOnlyAdminOptionsIsNotAllowed() { | ||
$this->publicFieldParams['option_label'][1] = 'Admin Price'; | ||
$this->publicFieldParams['option_amount'][1] = 10; | ||
$this->publicFieldParams['option_visibility_id'][1] = $this->visibilityOptionsKeys['admin']; | ||
|
||
$form = new CRM_Price_Form_Field(); | ||
$form->_action = CRM_Core_Action::ADD; | ||
$files = array(); | ||
|
||
$validationResult = $form->formRule($this->publicFieldParams, $files, $form); | ||
$this->assertType('array', $validationResult); | ||
$this->assertTrue(array_key_exists('visibility_id', $validationResult)); | ||
} | ||
|
||
public function testAdminFieldDoesNotAllowPublicOptions() { | ||
$this->adminFieldParams['option_label'][1] = 'Admin Price'; | ||
$this->adminFieldParams['option_amount'][1] = 10; | ||
$this->adminFieldParams['option_visibility_id'][1] = $this->visibilityOptionsKeys['public']; | ||
|
||
$form = new CRM_Price_Form_Field(); | ||
$form->_action = CRM_Core_Action::ADD; | ||
$files = array(); | ||
|
||
$validationResult = $form->formRule($this->adminFieldParams, $files, $form); | ||
$this->assertType('array', $validationResult); | ||
$this->assertTrue(array_key_exists('visibility_id', $validationResult)); | ||
} | ||
|
||
private function initializeFieldParameters($params) { | ||
$defaultParams = array( | ||
'label' => 'Price Field', | ||
'name' => CRM_Utils_String::titleToVar('Price Field'), | ||
'html_type' => 'Select', | ||
'is_display_amounts' => 1, | ||
'weight' => 1, | ||
'options_per_line' => 1, | ||
'is_enter_qty' => 1, | ||
'financial_type_id' => $this->getFinancialTypeId('Event Fee'), | ||
'visibility_id' => $this->visibilityOptionsKeys['public'], | ||
); | ||
|
||
for ($index = 1; $index <= CRM_Price_Form_Field::NUM_OPTION; $index++) { | ||
$defaultParams['option_label'][$index] = NULL; | ||
$defaultParams['option_value'][$index] = NULL; | ||
$defaultParams['option_name'][$index] = NULL; | ||
$defaultParams['option_weight'][$index] = NULL; | ||
$defaultParams['option_amount'][$index] = NULL; | ||
$defaultParams['option_visibility_id'][$index] = NULL; | ||
} | ||
|
||
return array_merge($defaultParams, $params); | ||
} | ||
|
||
} | ||
<?php | ||
|
||
class CRM_Price_Form_FieldTest extends CiviUnitTestCase { | ||
|
||
protected $priceFieldValues; | ||
protected $visibilityOptionsKeys; | ||
protected $visibilityOptions; | ||
protected $publicFieldParams; | ||
protected $adminFieldParams; | ||
|
||
public function setUp() { | ||
parent::setUp(); | ||
|
||
$this->visibilityOptionsKeys = CRM_Price_BAO_PriceFieldValue::buildOptions('visibility_id', NULL, array( | ||
'labelColumn' => 'name', | ||
'flip' => TRUE, | ||
)); | ||
|
||
$this->publicFieldParams = $this->initializeFieldParameters(array( | ||
'label' => 'Public Price Field', | ||
'name' => 'public_price', | ||
'visibility_id' => $this->visibilityOptionsKeys['public'], | ||
)); | ||
|
||
$this->adminFieldParams = $this->initializeFieldParameters(array( | ||
'label' => 'Public Price Field', | ||
'name' => 'public_price', | ||
'visibility_id' => $this->visibilityOptionsKeys['admin'], | ||
)); | ||
} | ||
|
||
public function testPublicFieldWithOnlyAdminOptionsIsNotAllowed() { | ||
$this->publicFieldParams['option_label'][1] = 'Admin Price'; | ||
$this->publicFieldParams['option_amount'][1] = 10; | ||
$this->publicFieldParams['option_visibility_id'][1] = $this->visibilityOptionsKeys['admin']; | ||
|
||
$form = new CRM_Price_Form_Field(); | ||
$form->_action = CRM_Core_Action::ADD; | ||
$files = array(); | ||
|
||
$validationResult = $form->formRule($this->publicFieldParams, $files, $form); | ||
$this->assertType('array', $validationResult); | ||
$this->assertTrue(array_key_exists('visibility_id', $validationResult)); | ||
} | ||
|
||
public function testAdminFieldDoesNotAllowPublicOptions() { | ||
$this->adminFieldParams['option_label'][1] = 'Admin Price'; | ||
$this->adminFieldParams['option_amount'][1] = 10; | ||
$this->adminFieldParams['option_visibility_id'][1] = $this->visibilityOptionsKeys['public']; | ||
|
||
$form = new CRM_Price_Form_Field(); | ||
$form->_action = CRM_Core_Action::ADD; | ||
$files = array(); | ||
|
||
$validationResult = $form->formRule($this->adminFieldParams, $files, $form); | ||
$this->assertType('array', $validationResult); | ||
$this->assertTrue(array_key_exists('visibility_id', $validationResult)); | ||
} | ||
|
||
private function initializeFieldParameters($params) { | ||
$defaultParams = array( | ||
'label' => 'Price Field', | ||
'name' => CRM_Utils_String::titleToVar('Price Field'), | ||
'html_type' => 'Select', | ||
'is_display_amounts' => 1, | ||
'weight' => 1, | ||
'options_per_line' => 1, | ||
'is_enter_qty' => 1, | ||
'financial_type_id' => $this->getFinancialTypeId('Event Fee'), | ||
'visibility_id' => $this->visibilityOptionsKeys['public'], | ||
); | ||
|
||
for ($index = 1; $index <= CRM_Price_Form_Field::NUM_OPTION; $index++) { | ||
$defaultParams['option_label'][$index] = NULL; | ||
$defaultParams['option_value'][$index] = NULL; | ||
$defaultParams['option_name'][$index] = NULL; | ||
$defaultParams['option_weight'][$index] = NULL; | ||
$defaultParams['option_amount'][$index] = NULL; | ||
$defaultParams['option_visibility_id'][$index] = NULL; | ||
} | ||
|
||
return array_merge($defaultParams, $params); | ||
} | ||
|
||
} |
Oops, something went wrong.