UserFrosting API

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

$migrated bool
setUp() Setup the test database. void
testConstructor() Authenticator
testLogin() mixed
testLoginWithSessionDatabase() mixed
testValidateUserAccountThrowAccountInvalidException() mixed
testValidateUserAccountRetunNullOnFalseArgument() mixed
testValidateUserAccountThrowExceptionArgumentNotInt() mixed
testValidateUserAccount() mixed
testValidateUserAccountWithAccountDisabledException() mixed
testLoginWithRememberMe() mixed
testAttempt_withUserName() mixed
testAttempt_withEmail() mixed
testAttempt_withNoUser() mixed
testAttempt_withNoPassword() mixed
testAttempt_withFlagEnabledFalse() mixed
testAttempt_withFlagVerifiedFalse() mixed
testAttempt_withFlagVerifiedFalseNoEmailVerification() mixed
testAttempt_withBadPassword() mixed
testCheckWithNoUser() mixed
testCheckWithLoggedInUser() mixed
getAuthenticator() Authenticator
setupTestDatabase() Define the test_integration database connection the default one mixed
refreshDatabase() Define hooks to migrate the database before and after each test. mixed
usingInMemoryDatabase() Determine if an in-memory database is being used. bool
refreshInMemoryDatabase() Refresh the in-memory database. mixed
refreshTestDatabase() Refresh a conventional test database. mixed
beginDatabaseTransaction() Handle database transactions on the specified connections. mixed
connectionsToTransact() The database connections that should have transactions. array
loginUser() mixed
logoutCurrentUser() Logout mixed
createTestUser() Create a test user with no settings/permissions for a controller test User
getRandomUserId() Returns a random user id, exclusing th master id int
giveUserTestPermission() Gives a user a new test permission Permission
giveUserPermission() Add the test permission to a Role, then the role to the user Role
useDatabaseSessionHandler() Reset CI with database session handler mixed

Properties

Methods

testValidateUserAccountThrowAccountInvalidException()

public testValidateUserAccountThrowAccountInvalidException( $authenticator : Authenticator ) : mixed
Parameters
$authenticator : Authenticator
Tags
depends

testConstructor

Return values
mixed

testValidateUserAccountRetunNullOnFalseArgument()

public testValidateUserAccountRetunNullOnFalseArgument( $authenticator : Authenticator ) : mixed
Parameters
$authenticator : Authenticator
Tags
depends

testConstructor

Return values
mixed

testValidateUserAccountThrowExceptionArgumentNotInt()

public testValidateUserAccountThrowExceptionArgumentNotInt( $authenticator : Authenticator ) : mixed
Parameters
$authenticator : Authenticator
Tags
depends

testConstructor

Return values
mixed

testValidateUserAccountWithAccountDisabledException()

public testValidateUserAccountWithAccountDisabledException( $authenticator : Authenticator ) : mixed
Parameters
$authenticator : Authenticator
Tags
depends

testConstructor

Return values
mixed

testAttempt_withUserName()

public testAttempt_withUserName( $authenticator : Authenticator ) : mixed
Parameters
$authenticator : Authenticator
Tags
depends

testConstructor

depends

testLogin

Return values
mixed

testAttempt_withEmail()

public testAttempt_withEmail( $authenticator : Authenticator ) : mixed
Parameters
$authenticator : Authenticator
Tags
depends

testConstructor

depends

testAttempt_withUserName

Return values
mixed

testAttempt_withNoUser()

public testAttempt_withNoUser( $authenticator : Authenticator ) : mixed
Parameters
$authenticator : Authenticator
Tags
depends

testConstructor

depends

testAttempt_withUserName

Return values
mixed

testAttempt_withNoPassword()

public testAttempt_withNoPassword( $authenticator : Authenticator ) : mixed
Parameters
$authenticator : Authenticator
Tags
depends

testConstructor

depends

testAttempt_withUserName

Return values
mixed

testAttempt_withFlagEnabledFalse()

public testAttempt_withFlagEnabledFalse( $authenticator : Authenticator ) : mixed
Parameters
$authenticator : Authenticator
Tags
depends

testConstructor

depends

testAttempt_withUserName

Return values
mixed

testAttempt_withFlagVerifiedFalse()

public testAttempt_withFlagVerifiedFalse( $authenticator : Authenticator ) : mixed
Parameters
$authenticator : Authenticator
Tags
depends

testConstructor

depends

testAttempt_withUserName

Return values
mixed

testAttempt_withFlagVerifiedFalseNoEmailVerification()

public testAttempt_withFlagVerifiedFalseNoEmailVerification( $authenticator : Authenticator ) : mixed
Parameters
$authenticator : Authenticator
Tags
depends

testConstructor

depends

testAttempt_withUserName

Return values
mixed

testAttempt_withBadPassword()

public testAttempt_withBadPassword( $authenticator : Authenticator ) : mixed
Parameters
$authenticator : Authenticator
Tags
depends

testConstructor

depends

testAttempt_withUserName

Return values
mixed

testCheckWithLoggedInUser()

public testCheckWithLoggedInUser( ) : mixed
Tags
depends

testConstructor

Return values
mixed

setupTestDatabase()

Define the test_integration database connection the default one

public setupTestDatabase( ) : mixed
Return values
mixed

refreshDatabase()

Define hooks to migrate the database before and after each test.

public refreshDatabase( ) : mixed
Return values
mixed

usingInMemoryDatabase()

Determine if an in-memory database is being used.

public usingInMemoryDatabase( ) : bool
Return values
bool

refreshInMemoryDatabase()

Refresh the in-memory database.

protected refreshInMemoryDatabase( ) : mixed
Return values
mixed

refreshTestDatabase()

Refresh a conventional test database.

protected refreshTestDatabase( ) : mixed
Return values
mixed

beginDatabaseTransaction()

Handle database transactions on the specified connections.

protected beginDatabaseTransaction( ) : mixed
Return values
mixed

connectionsToTransact()

The database connections that should have transactions.

protected connectionsToTransact( ) : array
Return values
array

logoutCurrentUser()

Logout

protected logoutCurrentUser( ) : mixed
Return values
mixed

createTestUser()

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
User

getRandomUserId()

Returns a random user id, exclusing th master id

protected getRandomUserId( $masterId : int ) : int
Parameters
$masterId : int
Return values
int

giveUserTestPermission()

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
Permission

useDatabaseSessionHandler()

Reset CI with database session handler

public useDatabaseSessionHandler( ) : mixed
Return values
mixed

Search results