Skip to content

Commit

Permalink
Mark DetailTest as having invalid financials
Browse files Browse the repository at this point in the history
This class sets up in a weird way it will never pass financial checks
  • Loading branch information
eileenmcnaughton committed Jun 8, 2021
1 parent a6f6f86 commit d67494f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
1 change: 0 additions & 1 deletion CRM/Core/Payment/PayPalImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,6 @@ public function doPaymentRedirectToPayPal(&$params, $component = 'contribute') {

// Allow each CMS to do a pre-flight check before redirecting to PayPal.
CRM_Core_Config::singleton()->userSystem->prePostRedirect();

CRM_Utils_System::redirect($paypalURL);
}

Expand Down
22 changes: 12 additions & 10 deletions CRM/Utils/Hook/UnitTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ class CRM_Utils_Hook_UnitTests extends CRM_Utils_Hook {
* @var array
*/
protected $adhocHooks;
protected $civiModules = NULL;
protected $civiModules;

/**
* Call this in CiviUnitTestCase::setUp()
*/
public function reset() {
public function reset(): void {
$this->mockObject = NULL;
$this->adhocHooks = [];
}
Expand All @@ -36,23 +36,24 @@ public function reset() {
* Use a unit-testing mock object to handle hook invocations.
*
* e.g. hook_civicrm_foo === $mockObject->foo()
* Mocks with a magic `__call()` method are called for every hook invokation.
* Mocks with a magic `__call()` method are called for every hook invocation.
*
* @param object $mockObject
* @param PHPUnit\Framework\MockObject\MockBuilder $mockObject
*/
public function setMock($mockObject) {
public function setMock(PHPUnit\Framework\MockObject\MockBuilder $mockObject): void {
$this->mockObject = $mockObject;
}

/**
* Register a function to run when invoking a specific hook.
*
* @param string $hook
* Hook name, e.g civicrm_pre.
* @param array $callable
* @param callable $callable
* Function to call ie array(class, method).
* eg. array($this, mymethod)
* eg. array($this, myMethod)
*/
public function setHook($hook, $callable) {
public function setHook(string $hook, callable $callable): void {
$this->adhocHooks[$hook] = $callable;
}

Expand All @@ -76,15 +77,16 @@ public function setHook($hook, $callable) {
* @param string $fnSuffix
* Function suffix, this is effectively the hook name.
*
* @return mixed
* @return array|bool
* @throws \CRM_Core_Exception
*/
public function invokeViaUF(
$numParams,
&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
$fnSuffix) {
$params = array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6);

$fResult1 = $fResult2 = $fResult3 = NULL;
$fResult2 = $fResult3 = NULL;

// run standard hooks
if ($this->civiModules === NULL) {
Expand Down
9 changes: 8 additions & 1 deletion tests/phpunit/CRM/Report/Form/Contribute/DetailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@ class CRM_Report_Form_Contribute_DetailTest extends CiviReportTestCase {
'civicrm_contribution',
];

/**
* Skip validating financials as the financial data is not correct in the csvs.
*
* @var bool
*/
protected $isValidateFinancialsOnPostAssert = FALSE;

/**
* @return array
*/
public function dataProvider() {
public function dataProvider(): array {
return [
[
'CRM_Report_Form_Contribute_Detail',
Expand Down

0 comments on commit d67494f

Please sign in to comment.