UserFrosting API

PDOStorageTest extends TestCase Uses TestDatabase, RefreshDatabase, withTestUser

Tags
author

Louis Charette

Table of Contents

$storage PDOStorage
$testUser UserInterface
$validToken
$validPersistentToken
$invalidToken
$validDBToken
$validDBPersistentToken
$invalidDBToken
$expire
$migrated bool
setUp() void
testFindTripletReturnsFoundIfDataMatches() mixed
testFindTripletReturnsNotFoundIfNoDataMatches() mixed
testFindTripletReturnsInvalidTokenIfTokenIsInvalid() mixed
testStoreTripletSavesValuesIntoDatabase() mixed
testCleanTripletRemovesEntryFromDatabase() mixed
testCleanAllTripletsRemovesAllEntriesWithMatchingCredentialsFromDatabase() mixed
testReplaceTripletRemovesAndSavesEntryFromDatabase() mixed
testCleanExpiredTokens() mixed
insertTestData() Insert test dataset Persistence
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

Properties

$validToken

protected mixed $validToken = '78b1e6d775cec5260001af137a79dbd5'

$validPersistentToken

protected mixed $validPersistentToken = '0e0530c1430da76495955eb06eb99d95'

$invalidToken

protected mixed $invalidToken = '7ae7c7caa0c7b880cb247bb281d527de'

$validDBToken

protected mixed $validDBToken = 'e0e6d29addce0fbdd0f845799be7d0395ed087c3'

$validDBPersistentToken

protected mixed $validDBPersistentToken = 'd27d330764ef61e99adf5d16f90b95a2a63c209a'

$invalidDBToken

protected mixed $invalidDBToken = 'ec15fbc40cdff6a2050a1bcbbc1b2196222f13f4'

Methods

testFindTripletReturnsFoundIfDataMatches()

public testFindTripletReturnsFoundIfDataMatches( ) : mixed
Return values
mixed

testFindTripletReturnsNotFoundIfNoDataMatches()

public testFindTripletReturnsNotFoundIfNoDataMatches( ) : mixed
Return values
mixed

testFindTripletReturnsInvalidTokenIfTokenIsInvalid()

public testFindTripletReturnsInvalidTokenIfTokenIsInvalid( ) : mixed
Return values
mixed

testStoreTripletSavesValuesIntoDatabase()

public testStoreTripletSavesValuesIntoDatabase( ) : mixed
Return values
mixed

testCleanTripletRemovesEntryFromDatabase()

public testCleanTripletRemovesEntryFromDatabase( ) : mixed
Return values
mixed

testCleanAllTripletsRemovesAllEntriesWithMatchingCredentialsFromDatabase()

public testCleanAllTripletsRemovesAllEntriesWithMatchingCredentialsFromDatabase( ) : mixed
Return values
mixed

testReplaceTripletRemovesAndSavesEntryFromDatabase()

public testReplaceTripletRemovesAndSavesEntryFromDatabase( ) : mixed
Return values
mixed

testCleanExpiredTokens()

public testCleanExpiredTokens( ) : mixed
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

Search results