SecurityTest
extends TestCase
in package
implements
EndToEndInterface, TransactionalInterface
Test Security flows in Standalone
Tips:
- With HookInterface, you may implement CiviCRM hooks directly in the test class. Simply create corresponding functions (e.g. "hook_civicrm_post(...)" or similar).
- With TransactionalInterface, any data changes made by setUp() or test****() functions will rollback automatically -- as long as you don't manipulate schema or truncate tables. If this test needs to manipulate schema or truncate tables, then either: a. Do all that using setupHeadless() and Civi\Test. b. Disable TransactionalInterface, and handle all setup/teardown yourself.
Fun fact: Running E2E tests with TransactionalInterface is usually prohibitive because of the split DB. However, with Standalone, there's a single DB, so it may work some of the time. (It only becomes prohibitive if you actually use HTTP.)
Tags
Table of Contents
Interfaces
- EndToEndInterface
- Interface EndToEndInterface
- TransactionalInterface
- Interface HeadlessInterface
Constants
- ADMIN_ROLE_ID = 1
Properties
- $contactID : mixed
- $userID : mixed
Methods
- createFixtureContactAndUser() : array<string|int, mixed>
- dumpUFMatch() : mixed
- Temporary debugging function
- ensureStaffRoleExists() : mixed
- setUp() : void
- setUpBeforeClass() : void
- storeFakePasswordResetToken() : string
- tearDown() : void
- testCheckPassword() : void
- testForgottenPassword() : mixed
- testPerms() : mixed
- deleteStuffWeMade() : mixed
- loginUser() : mixed
Constants
ADMIN_ROLE_ID
public
mixed
ADMIN_ROLE_ID
= 1
Properties
$contactID
protected
mixed
$contactID
$userID
protected
mixed
$userID
Methods
createFixtureContactAndUser()
public
createFixtureContactAndUser() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>dumpUFMatch()
Temporary debugging function
public
dumpUFMatch([string $s = '' ]) : mixed
Parameters
- $s : string = ''
ensureStaffRoleExists()
public
ensureStaffRoleExists() : mixed
setUp()
public
setUp() : void
setUpBeforeClass()
public
static setUpBeforeClass() : void
storeFakePasswordResetToken()
public
static storeFakePasswordResetToken(int $userID, int $expires) : string
Parameters
- $userID : int
- $expires : int
Return values
stringtearDown()
public
tearDown() : void
testCheckPassword()
public
testCheckPassword() : void
testForgottenPassword()
public
testForgottenPassword() : mixed
testPerms()
public
testPerms() : mixed
deleteStuffWeMade()
protected
deleteStuffWeMade() : mixed
loginUser()
protected
loginUser(mixed $userID) : mixed
Parameters
- $userID : mixed