UserFrosting API

UserControllerTest extends TestCase Uses TestDatabase, RefreshDatabase, withTestUser, withController

Tests UserController

Table of Contents

$initialized bool
$migrated bool
setUp() Setup test database for controller tests void
tearDown() void
testControllerConstructor() mixed
testControllerConstructorWithUser() UserController
testCreateWithNoUsername() mixed
testCreateWithNoEmail() mixed
testCreateWithDuplicateUsername() mixed
testCreateWithDuplicateEmail() mixed
testCreatePasswordReset() mixed
testCreatePasswordResetWithNotExistingUser() mixed
testDelete() mixed
testDeleteWithNotExistingUser() mixed
testDeleteWithReservedIds() mixed
testGetActivities() mixed
testGetActivitiesWithBadUser() mixed
testGetInfo() mixed
testGetInfoWithBadUser() mixed
testGetList() mixed
testGetModalConfirmDelete() mixed
testGetModalConfirmDeleteWithNoUser() mixed
testGetModalConfirmDeleteWithNonExistingUser() mixed
testGetModalConfirmDeleteWithReservedId() mixed
testGetModalCreate() mixed
testGetModalCreateWithNoLocale() mixed
testGetModalEdit() mixed
testGetModalEditWithNoLocale() mixed
testGetModalEditWithNoUser() mixed
testGetModalEditPassword() mixed
testGetModalEditPasswordWithNoUser() mixed
testGetModalEditRoles() mixed
testGetModalEditRolesWithNoUser() mixed
testGetPermissions() mixed
testGetPermissionsWithNoUser() mixed
testGetRoles() mixed
testGetRolesWithNoUser() mixed
testPageInfo() mixed
testPageInfoWithNoLocale() mixed
testPageInfoWithNoUser() mixed
testPageList() mixed
testUpdateInfo() mixed
testUpdateInfoWithNoUser() mixed
testUpdateInfoWithValidationError() mixed
testUpdateInfoWithDuplicateEmail() mixed
testUpdateInfoForMasterUser() mixed
testUpdateField() mixed
testUpdateFieldWithDeprecatedSupport() mixed
testUpdateFieldWithNoUser() mixed
testUpdateFieldWithNoUserWithNoValue() mixed
testUpdateFieldWithMasterUser() mixed
testUpdateFieldWithValidationError() mixed
testUpdateFieldForFlagEnabled() mixed
testUpdateFieldForFlagEnabledDisabled() mixed
testUpdateFieldForFlagVerified() mixed
testUpdateFieldForFlagEnabledWithMasterUser() mixed
testUpdateFieldForPassword() mixed
testUpdateFieldForRoles() mixed
getController() UserController
setupUser() mixed
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
getRequest() Request
getResponse() Response

Properties

Methods

testControllerConstructor()

public testControllerConstructor( ) : mixed
Return values
mixed

testCreateWithDuplicateUsername()

public testCreateWithDuplicateUsername( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

Return values
mixed

testCreatePasswordReset()

public testCreatePasswordReset( ) : mixed
Tags
depends

testControllerConstructorWithUser

Return values
mixed

testCreatePasswordResetWithNotExistingUser()

public testCreatePasswordResetWithNotExistingUser( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

Return values
mixed

testDeleteWithNotExistingUser()

public testDeleteWithNotExistingUser( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testDelete

Return values
mixed

testDeleteWithReservedIds()

public testDeleteWithReservedIds( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testDelete

Return values
mixed

testGetActivitiesWithBadUser()

public testGetActivitiesWithBadUser( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testGetActivities

Return values
mixed

testGetInfoWithBadUser()

public testGetInfoWithBadUser( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testGetInfo

Return values
mixed

testGetModalConfirmDeleteWithNoUser()

public testGetModalConfirmDeleteWithNoUser( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testGetModalConfirmDelete

Return values
mixed

testGetModalConfirmDeleteWithNonExistingUser()

public testGetModalConfirmDeleteWithNonExistingUser( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testGetModalConfirmDelete

Return values
mixed

testGetModalConfirmDeleteWithReservedId()

public testGetModalConfirmDeleteWithReservedId( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testGetModalConfirmDelete

Return values
mixed

testGetModalCreateWithNoLocale()

public testGetModalCreateWithNoLocale( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testGetModalCreate

Return values
mixed

testGetModalEditWithNoLocale()

public testGetModalEditWithNoLocale( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testGetModalEdit

Return values
mixed

testGetModalEditPasswordWithNoUser()

public testGetModalEditPasswordWithNoUser( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

Return values
mixed

testGetModalEditRolesWithNoUser()

public testGetModalEditRolesWithNoUser( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

Return values
mixed

testUpdateInfoWithNoUser()

public testUpdateInfoWithNoUser( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateInfo

Return values
mixed

testUpdateInfoWithValidationError()

public testUpdateInfoWithValidationError( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateInfo

Return values
mixed

testUpdateInfoWithDuplicateEmail()

public testUpdateInfoWithDuplicateEmail( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateInfo

Return values
mixed

testUpdateInfoForMasterUser()

public testUpdateInfoForMasterUser( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateInfo

Return values
mixed

testUpdateFieldWithDeprecatedSupport()

public testUpdateFieldWithDeprecatedSupport( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateField

Return values
mixed

testUpdateFieldWithNoUser()

public testUpdateFieldWithNoUser( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateField

Return values
mixed

testUpdateFieldWithNoUserWithNoValue()

public testUpdateFieldWithNoUserWithNoValue( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateField

Return values
mixed

testUpdateFieldWithMasterUser()

public testUpdateFieldWithMasterUser( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateField

Return values
mixed

testUpdateFieldWithValidationError()

public testUpdateFieldWithValidationError( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateField

Return values
mixed

testUpdateFieldForFlagEnabled()

public testUpdateFieldForFlagEnabled( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateField

Return values
mixed

testUpdateFieldForFlagEnabledDisabled()

public testUpdateFieldForFlagEnabledDisabled( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateFieldForFlagEnabled

Return values
mixed

testUpdateFieldForFlagVerified()

public testUpdateFieldForFlagVerified( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateField

Return values
mixed

testUpdateFieldForFlagEnabledWithMasterUser()

public testUpdateFieldForFlagEnabledWithMasterUser( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateField

Return values
mixed

testUpdateFieldForPassword()

public testUpdateFieldForPassword( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateField

Return values
mixed

testUpdateFieldForRoles()

public testUpdateFieldForRoles( $controller : UserController ) : mixed
Parameters
$controller : UserController
Tags
depends

testControllerConstructorWithUser

depends

testUpdateField

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

getRequest()

protected getRequest( [ $args : array = [] ] ) : Request
Parameters
$args : array = []

Request arguments

Return values
Request

getResponse()

protected getResponse( ) : Response
Return values
Response

Search results