AuthenticatorTest extends TestCase Uses TestDatabase, RefreshDatabase, withTestUser, withDatabaseSessionHandler
Integration tests for the Authenticator.
Integration, cause use the real $ci. We hope classmapper, session, config and cache services are working properly !
Table of Contents
Properties
$migrated
public
static bool
$migrated
= false
Methods
setUp()
Setup the test database.
public
setUp(
)
: void
testConstructor()
public
testConstructor(
)
: Authenticator
Return values
AuthenticatortestLogin()
public
testLogin(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestLoginWithSessionDatabase()
public
testLoginWithSessionDatabase(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestValidateUserAccountThrowAccountInvalidException()
public
testValidateUserAccountThrowAccountInvalidException(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestValidateUserAccountRetunNullOnFalseArgument()
public
testValidateUserAccountRetunNullOnFalseArgument(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestValidateUserAccountThrowExceptionArgumentNotInt()
public
testValidateUserAccountThrowExceptionArgumentNotInt(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestValidateUserAccount()
public
testValidateUserAccount(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestValidateUserAccountWithAccountDisabledException()
public
testValidateUserAccountWithAccountDisabledException(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestLoginWithRememberMe()
public
testLoginWithRememberMe(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestAttempt_withUserName()
public
testAttempt_withUserName(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestAttempt_withEmail()
public
testAttempt_withEmail(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestAttempt_withNoUser()
public
testAttempt_withNoUser(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestAttempt_withNoPassword()
public
testAttempt_withNoPassword(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestAttempt_withFlagEnabledFalse()
public
testAttempt_withFlagEnabledFalse(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestAttempt_withFlagVerifiedFalse()
public
testAttempt_withFlagVerifiedFalse(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestAttempt_withFlagVerifiedFalseNoEmailVerification()
public
testAttempt_withFlagVerifiedFalseNoEmailVerification(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestAttempt_withBadPassword()
public
testAttempt_withBadPassword(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestCheckWithNoUser()
public
testCheckWithNoUser(
$authenticator :
Authenticator
)
: mixed
Parameters
- $authenticator : Authenticator
Tags
Return values
mixedtestCheckWithLoggedInUser()
public
testCheckWithLoggedInUser(
)
: mixed
Tags
Return values
mixedgetAuthenticator()
protected
getAuthenticator(
)
: Authenticator
Return values
AuthenticatorsetupTestDatabase()
Define the test_integration database connection the default one
public
setupTestDatabase(
)
: mixed
Return values
mixedrefreshDatabase()
Define hooks to migrate the database before and after each test.
public
refreshDatabase(
)
: mixed
Return values
mixedusingInMemoryDatabase()
Determine if an in-memory database is being used.
public
usingInMemoryDatabase(
)
: bool
Return values
boolrefreshInMemoryDatabase()
Refresh the in-memory database.
protected
refreshInMemoryDatabase(
)
: mixed
Return values
mixedrefreshTestDatabase()
Refresh a conventional test database.
protected
refreshTestDatabase(
)
: mixed
Return values
mixedbeginDatabaseTransaction()
Handle database transactions on the specified connections.
protected
beginDatabaseTransaction(
)
: mixed
Return values
mixedconnectionsToTransact()
The database connections that should have transactions.
protected
connectionsToTransact(
)
: array
Return values
arrayloginUser()
protected
loginUser(
$user :
UserInterface
)
: mixed
Parameters
- $user : UserInterface
Return values
mixedlogoutCurrentUser()
Logout
protected
logoutCurrentUser(
)
: mixed
Return values
mixedcreateTestUser()
Create a test user with no settings/permissions for a controller test
protected
createTestUser(
[ $isMaster :
bool
= false ]
[, $login :
bool
= false ]
[, $params :
array
= [] ]
)
: User
Parameters
- $isMaster : bool = false
Does this user have root access? Will bypass all permissions
- $login : bool = false
Login this user, setting him as the currentUser
- $params : array = []
User account params
Return values
UsergetRandomUserId()
Returns a random user id, exclusing th master id
protected
getRandomUserId(
$masterId :
int
)
: int
Parameters
- $masterId : int
Return values
intgiveUserTestPermission()
Gives a user a new test permission
protected
giveUserTestPermission(
$user :
UserInterface
, $slug :
string
[, $conditions :
string
= 'always()' ]
)
: Permission
Parameters
- $user : UserInterface
- $slug : string
- $conditions : string = 'always()'
Return values
PermissiongiveUserPermission()
Add the test permission to a Role, then the role to the user
protected
giveUserPermission(
$user :
UserInterface
, $permission :
Permission
)
: Role
Parameters
- $user : UserInterface
- $permission : Permission
Return values
Role —The intermidiate role
useDatabaseSessionHandler()
Reset CI with database session handler
public
useDatabaseSessionHandler(
)
: mixed