AccountControllerTest extends TestCase Uses TestDatabase, RefreshDatabase, withTestUser, withController
Tests AccountController
Table of Contents
Properties
$initialized
protected
static bool
$initialized
= false
$migrated
public
static bool
$migrated
= false
Methods
setUp()
Setup test database for controller tests
public
setUp(
)
: void
tearDown()
public
tearDown(
)
: void
testControllerConstructor()
public
testControllerConstructor(
)
: AccountController
Return values
AccountControllertestRegisterWithNoMasterUser()
N.B.: Must be first test, before any master user is created
public
testRegisterWithNoMasterUser(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestRegister()
N.B.: Run this register second, as it's easier if no test user is present.
public
testRegister(
)
: mixed
Tags
Return values
mixedtestRegisterWithNoEmailVerification()
public
testRegisterWithNoEmailVerification(
)
: mixed
Tags
Return values
mixedperformActualRegisterTest()
protected
performActualRegisterTest(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Return values
mixedtestcheckUsername()
public
testcheckUsername(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestcheckUsernameWithNoData()
public
testcheckUsernameWithNoData(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestcheckUsernameWithUsernameNotAvailable()
public
testcheckUsernameWithUsernameNotAvailable(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestcheckUsernameWithThrottler()
public
testcheckUsernameWithThrottler(
)
: mixed
Tags
Return values
mixedtestdenyResetPassword()
public
testdenyResetPassword(
)
: mixed
Tags
Return values
mixedtestdenyResetPasswordWithFailedPasswordReset()
public
testdenyResetPasswordWithFailedPasswordReset(
)
: mixed
Tags
Return values
mixedtestdenyResetPasswordWithFailedValidation()
public
testdenyResetPasswordWithFailedValidation(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestforgotPassword()
N.B.: This test is incomplete as it doesn't actually check if repoPasswordReset returns the correct info and the message contains the right content
public
testforgotPassword(
)
: mixed
Tags
Return values
mixedtestforgotPasswordWithFailedValidation()
public
testforgotPasswordWithFailedValidation(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestforgotPasswordWithThrottler()
public
testforgotPasswordWithThrottler(
)
: mixed
Tags
Return values
mixedtestgetModalAccountTos()
public
testgetModalAccountTos(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestimageCaptcha()
public
testimageCaptcha(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestlogin()
public
testlogin(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestloginWithEmail()
public
testloginWithEmail(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestloginWithLoggedInUser()
public
testloginWithLoggedInUser(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestloginWithFailledValidation()
public
testloginWithFailledValidation(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestloginWithThrottler()
public
testloginWithThrottler(
)
: mixed
Tags
Return values
mixedtestloginThrottlerCountsFailedLogins()
public
testloginThrottlerCountsFailedLogins(
)
: mixed
Tags
Return values
mixedtestloginThrottlerDoesntCountSuccessfulLogins()
public
testloginThrottlerDoesntCountSuccessfulLogins(
)
: mixed
Tags
Return values
mixedtestloginWithDisableEmail()
public
testloginWithDisableEmail(
)
: mixed
Tags
Return values
mixedtestlogoutWithLoggedInUser()
public
testlogoutWithLoggedInUser(
)
: mixed
Tags
Return values
mixedtestlogoutWithNoUser()
public
testlogoutWithNoUser(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestpageForgotPassword()
public
testpageForgotPassword(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestpageRegister()
public
testpageRegister(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestpageRegisterWithDisabledRegistration()
public
testpageRegisterWithDisabledRegistration(
)
: mixed
Tags
Return values
mixedtestpageRegisterWithNoLocales()
public
testpageRegisterWithNoLocales(
)
: mixed
Tags
Return values
mixedtestpageRegisterWithLoggedInUser()
public
testpageRegisterWithLoggedInUser(
)
: mixed
Tags
Return values
mixedtestpageResendVerification()
public
testpageResendVerification(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestpageResetPassword()
public
testpageResetPassword(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestpageSetPassword()
public
testpageSetPassword(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestpageSettings()
public
testpageSettings(
)
: mixed
Tags
Return values
mixedtestpageSettingsWithPartialPermissions()
public
testpageSettingsWithPartialPermissions(
)
: mixed
Tags
Return values
mixedactualpageSettings()
protected
actualpageSettings(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Return values
mixedtestpageSettingsWithNoPermissions()
public
testpageSettingsWithNoPermissions(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestpageSignIn()
public
testpageSignIn(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestpageSignInWithLoggedInUser()
public
testpageSignInWithLoggedInUser(
)
: mixed
Tags
Return values
mixedtestProfile()
public
testProfile(
)
: mixed
Tags
Return values
mixedtestProfileWithPartialPermissions()
public
testProfileWithPartialPermissions(
)
: mixed
Tags
Return values
mixedperformActualProfileTests()
protected
performActualProfileTests(
$controller :
AccountController
, $user :
UserInterface
)
: mixed
Parameters
- $controller : AccountController
- $user : UserInterface
Return values
mixedtestProfileWithNoPermissions()
public
testProfileWithNoPermissions(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestProfileWithFailedValidation()
public
testProfileWithFailedValidation(
)
: mixed
Tags
Return values
mixedtestProfileWithInvalidLocale()
public
testProfileWithInvalidLocale(
)
: mixed
Tags
Return values
mixedtestRegisterWithHoneypot()
public
testRegisterWithHoneypot(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestRegisterWithRegistrationDisabled()
public
testRegisterWithRegistrationDisabled(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestRegisterWithLoggedInUser()
public
testRegisterWithLoggedInUser(
)
: mixed
Tags
Return values
mixedtestRegisterWithFailedThrottle()
public
testRegisterWithFailedThrottle(
)
: mixed
Tags
Return values
mixedtestRegisterWithFailedCaptcha()
public
testRegisterWithFailedCaptcha(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestRegisterWithFailedValidation()
public
testRegisterWithFailedValidation(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestresendVerification()
public
testresendVerification(
)
: mixed
Tags
Return values
mixedtestresendVerificationWithVerifiedUser()
public
testresendVerificationWithVerifiedUser(
)
: mixed
Tags
Return values
mixedtestresendVerificationWithFailedThrottle()
public
testresendVerificationWithFailedThrottle(
)
: mixed
Tags
Return values
mixedtestresendVerificationWithFailedValidation()
public
testresendVerificationWithFailedValidation(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestSetPassword()
public
testSetPassword(
)
: mixed
Tags
Return values
mixedtestSetPasswordWithNoToken()
public
testSetPasswordWithNoToken(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestsetPasswordWithFailedValidation()
public
testsetPasswordWithFailedValidation(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestSettings()
public
testSettings(
)
: mixed
Tags
Return values
mixedtestSettingsOnlyEmailNoLocale()
public
testSettingsOnlyEmailNoLocale(
)
: mixed
Tags
Return values
mixedtestSettingsWithNoPermissions()
public
testSettingsWithNoPermissions(
)
: mixed
Tags
Return values
mixedtestSettingsWithFailedValidation()
public
testSettingsWithFailedValidation(
)
: mixed
Tags
Return values
mixedtestSettingsWithFailedPasswordCheck()
public
testSettingsWithFailedPasswordCheck(
)
: mixed
Tags
Return values
mixedtestSettingsWithEmailInUse()
public
testSettingsWithEmailInUse(
)
: mixed
Tags
Return values
mixedtestSuggestUsername()
public
testSuggestUsername(
$controller :
AccountController
)
: mixed
Parameters
- $controller : AccountController
Tags
Return values
mixedtestVerify()
public
testVerify(
)
: mixed
Tags
Return values
mixedtestVerifyWithFailedVerification()
public
testVerifyWithFailedVerification(
)
: mixed
Tags
Return values
mixedtestVerifyWithFailedValidation()
public
testVerifyWithFailedValidation(
)
: mixed
Tags
Return values
mixedgetController()
private
getController(
)
: AccountController
Return values
AccountControllersetupTestDatabase()
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
getRequest()
protected
getRequest(
[ $args :
array
= [] ]
)
: Request
Parameters
- $args : array = []
Request arguments
Return values
RequestgetResponse()
protected
getResponse(
)
: Response