PDOStorageTest extends TestCase Uses TestDatabase, RefreshDatabase, withTestUser
Tags
Table of Contents
Properties
$storage
protected
PDOStorage
$storage
$testUser
protected
UserInterface
$testUser
$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'
$expire
protected
mixed
$expire
= '2022-12-21 21:21:00'
$migrated
public
static bool
$migrated
= false
Methods
setUp()
protected
setUp(
)
: void
testFindTripletReturnsFoundIfDataMatches()
public
testFindTripletReturnsFoundIfDataMatches(
)
: mixed
Return values
mixedtestFindTripletReturnsNotFoundIfNoDataMatches()
public
testFindTripletReturnsNotFoundIfNoDataMatches(
)
: mixed
Return values
mixedtestFindTripletReturnsInvalidTokenIfTokenIsInvalid()
public
testFindTripletReturnsInvalidTokenIfTokenIsInvalid(
)
: mixed
Return values
mixedtestStoreTripletSavesValuesIntoDatabase()
public
testStoreTripletSavesValuesIntoDatabase(
)
: mixed
Return values
mixedtestCleanTripletRemovesEntryFromDatabase()
public
testCleanTripletRemovesEntryFromDatabase(
)
: mixed
Return values
mixedtestCleanAllTripletsRemovesAllEntriesWithMatchingCredentialsFromDatabase()
public
testCleanAllTripletsRemovesAllEntriesWithMatchingCredentialsFromDatabase(
)
: mixed
Return values
mixedtestReplaceTripletRemovesAndSavesEntryFromDatabase()
public
testReplaceTripletRemovesAndSavesEntryFromDatabase(
)
: mixed
Return values
mixedtestCleanExpiredTokens()
public
testCleanExpiredTokens(
)
: mixed
Return values
mixedinsertTestData()
Insert test dataset
protected
insertTestData(
)
: Persistence
Return values
PersistencesetupTestDatabase()
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