-
-
Notifications
You must be signed in to change notification settings - Fork 814
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move financial acl warning from FinancialType BAO to extension.
It turns out this is not currently triggered by the api as the api passes in the key FinancialType in ids and it is looking for financialType. Regardless I think this makes sense in the extension and setting in the session as currently sometimes works makes sense (at least enough to move rather than remove)
- Loading branch information
1 parent
e4e20a1
commit 8e36f40
Showing
4 changed files
with
70 additions
and
15 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
34 changes: 34 additions & 0 deletions
34
ext/financialacls/tests/phpunit/Civi/Financialacls/FinancialTypeTest.php
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,34 @@ | ||
<?php | ||
|
||
namespace Civi\Financialacls; | ||
|
||
use Civi\Api4\MembershipType; | ||
|
||
// I fought the Autoloader and the autoloader won. | ||
require_once 'BaseTestClass.php'; | ||
|
||
/** | ||
* @group headless | ||
*/ | ||
class FinancialTypeTest extends BaseTestClass { | ||
|
||
/** | ||
* Test that a message is put in session when changing the name of a | ||
* financial type. | ||
* | ||
* @throws \CRM_Core_Exception | ||
*/ | ||
public function testChangeFinancialTypeName(): void { | ||
\Civi::settings()->set('acl_financial_type', TRUE); | ||
$type = $this->callAPISuccess('FinancialType', 'create', [ | ||
'name' => 'my test', | ||
]); | ||
$this->callAPISuccess('FinancialType', 'create', [ | ||
'name' => 'your test', | ||
'id' => $type['id'], | ||
]); | ||
$status = \CRM_Core_Session::singleton()->getStatus(TRUE); | ||
$this->assertEquals('Changing the name', substr($status[0]['text'], 0, 17)); | ||
} | ||
|
||
} |
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