PHP Class Neos\Flow\Tests\Unit\Session\SessionTest

Inheritance: extends Neos\Flow\Tests\UnitTestCase
Show file Open project: neos/flow-development-collection

Protected Properties

Property Type Description
$httpRequest Neos\Flow\Http\Request
$httpResponse Neos\Flow\Http\Response
$mockBootstrap Neos\Flow\Core\Bootstrap
$mockObjectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
$mockSecurityContext Neos\Flow\Security\Context | PHPUnit_Framework_MockObject_MockObject
$settings array

Public Methods

Method Description
aSessionCanBeTaggedAndBeRetrievedAgainByTheseTags ( )
addTagThrowsExceptionIfCalledOnNonStartedSession ( )
addTagThrowsExceptionIfTagIsNotValid ( )
autoExpireRemovesAllSessionDataOfTheExpiredSession ( )
autoExpireTriggersGarbageCollectionForExpiredSessions ( )
canBeResumedReturnsFalseIfNoSessionCookieExists ( )
canBeResumedReturnsFalseIfSessionIsExpiredAndExpiresASessionIfLastActivityIsOverTheLimit ( )
canBeResumedReturnsFalseIfTheSessionHasAlreadyBeenStarted ( )
closeAndShutdownObjectDoNotCloseARemoteSession ( )
closeFlagsTheSessionAsClosed ( )
constructCreatesARemoteSessionIfSessionIfIdentifierIsSpecified ( )
constructRequiresAStorageIdentifierIfASessionIdentifierWasGiven ( )
destroyRemovesAllSessionDataFromARemoteSession ( )
destroyRemovesAllSessionDataFromTheCurrentSessionButNotFromOtherSessions ( )
destroyThrowsExceptionIfSessionIsNotStarted ( )
garbageCollectionIsOmittedIfAnotherProcessIsAlreadyRunning ( )
garbageCollectionIsOmittedIfInactivityTimeoutIsSetToZero ( )
garbageCollectionOnlyRemovesTheDefinedMaximumNumberOfSessions ( )
getActiveSessionsReturnsAllActiveSessions ( )
getDataReturnsDataPreviouslySetWithPutData ( )
getDataThrowsExceptionIfSessionIsNotStarted ( )
getIdReturnsTheCurrentSessionIdentifier ( )
getLastActivityTimestampThrowsExceptionIfCalledOnNonStartedSession ( )
getTagsOnAResumedSessionReturnsTheTagsSetWithAddTag ( )
getTagsThrowsExceptionIfCalledOnNonStartedSession ( )
hasKeyThrowsExceptionIfCalledOnNonStartedSession ( )
isStartedReturnsFalseByDefault ( )
isStartedReturnsTrueAfterSessionHasBeenStarted ( )
lastActivityTimestampOfNewSessionIsSetAndStoredCorrectlyAndCanBeRetrieved ( )
putDataThrowsExceptionIfSessionIsNotStarted ( )
putDataThrowsExceptionIfTryingToPersistAResource ( )
remoteSessionUsesStorageIdentifierPassedToConstructor ( )
removeTagRemovesAPreviouslySetTag ( )
removeTagThrowsExceptionIfCalledOnNonStartedSession ( )
renewIdSetsANewSessionIdentifier ( )
renewIdThrowsExceptionIfCalledOnNonStartedSession ( )
renewIdThrowsExceptionIfCalledOnRemoteSession ( )
resumeOnAStartedSessionDoesNotDoAnyHarm ( ) Assures that no exception is thrown if a session is resumed.
resumeSetsSessionCookieInTheResponse ( )
sessionDataCanBeRetrievedEvenAfterSessionIdHasBeenRenewed ( )
sessionOnlyReusesTheSessionIdFromIncomingCookies ( ) This test asserts that the session cookie sent in the response doesn't just copy the data from the received session cookie (that is, domain, httponly etc) but creates a fresh Cookie object using the parameters derived from the settings.
setUp ( ) : void
shutdownChecksIfSessionStillExistsInStorageCacheBeforeWritingData ( )
shutdownCreatesSpecialDataEntryForSessionWithAuthenticatedAccounts ( )
startPutsACookieIntoTheHttpResponse ( )
startThrowsAnExceptionIfIncompatibleRequestHandlerIsUsed ( )
touchThrowsExceptionIfCalledOnNonStartedSession ( )
touchUpdatesLastActivityTimestampOfRemoteSession ( )
twoSessionsDontConflictIfUsingSameEntryIdentifiers ( )

Protected Methods

Method Description
createCache ( string $name ) : Neos\Cache\Frontend\VariableFrontend Creates a cache for testing

Method Details

aSessionCanBeTaggedAndBeRetrievedAgainByTheseTags() public method

addTagThrowsExceptionIfCalledOnNonStartedSession() public method

addTagThrowsExceptionIfTagIsNotValid() public method

autoExpireRemovesAllSessionDataOfTheExpiredSession() public method

autoExpireTriggersGarbageCollectionForExpiredSessions() public method

canBeResumedReturnsFalseIfNoSessionCookieExists() public method

canBeResumedReturnsFalseIfSessionIsExpiredAndExpiresASessionIfLastActivityIsOverTheLimit() public method

canBeResumedReturnsFalseIfTheSessionHasAlreadyBeenStarted() public method

closeAndShutdownObjectDoNotCloseARemoteSession() public method

closeFlagsTheSessionAsClosed() public method

constructCreatesARemoteSessionIfSessionIfIdentifierIsSpecified() public method

constructRequiresAStorageIdentifierIfASessionIdentifierWasGiven() public method

createCache() protected method

Creates a cache for testing
protected createCache ( string $name ) : Neos\Cache\Frontend\VariableFrontend
$name string
return Neos\Cache\Frontend\VariableFrontend

destroyRemovesAllSessionDataFromARemoteSession() public method

destroyRemovesAllSessionDataFromTheCurrentSessionButNotFromOtherSessions() public method

destroyThrowsExceptionIfSessionIsNotStarted() public method

garbageCollectionIsOmittedIfAnotherProcessIsAlreadyRunning() public method

garbageCollectionIsOmittedIfInactivityTimeoutIsSetToZero() public method

garbageCollectionOnlyRemovesTheDefinedMaximumNumberOfSessions() public method

getActiveSessionsReturnsAllActiveSessions() public method

getDataReturnsDataPreviouslySetWithPutData() public method

getDataThrowsExceptionIfSessionIsNotStarted() public method

getIdReturnsTheCurrentSessionIdentifier() public method

getLastActivityTimestampThrowsExceptionIfCalledOnNonStartedSession() public method

getTagsOnAResumedSessionReturnsTheTagsSetWithAddTag() public method

getTagsThrowsExceptionIfCalledOnNonStartedSession() public method

hasKeyThrowsExceptionIfCalledOnNonStartedSession() public method

isStartedReturnsFalseByDefault() public method

isStartedReturnsTrueAfterSessionHasBeenStarted() public method

lastActivityTimestampOfNewSessionIsSetAndStoredCorrectlyAndCanBeRetrieved() public method

putDataThrowsExceptionIfSessionIsNotStarted() public method

putDataThrowsExceptionIfTryingToPersistAResource() public method

remoteSessionUsesStorageIdentifierPassedToConstructor() public method

removeTagRemovesAPreviouslySetTag() public method

removeTagThrowsExceptionIfCalledOnNonStartedSession() public method

renewIdSetsANewSessionIdentifier() public method

renewIdThrowsExceptionIfCalledOnNonStartedSession() public method

renewIdThrowsExceptionIfCalledOnRemoteSession() public method

resumeOnAStartedSessionDoesNotDoAnyHarm() public method

Assures that no exception is thrown if a session is resumed.

resumeSetsSessionCookieInTheResponse() public method

sessionDataCanBeRetrievedEvenAfterSessionIdHasBeenRenewed() public method

sessionOnlyReusesTheSessionIdFromIncomingCookies() public method

This test asserts that the session cookie sent in the response doesn't just copy the data from the received session cookie (that is, domain, httponly etc) but creates a fresh Cookie object using the parameters derived from the settings.

setUp() public method

public setUp ( ) : void
return void

shutdownChecksIfSessionStillExistsInStorageCacheBeforeWritingData() public method

shutdownCreatesSpecialDataEntryForSessionWithAuthenticatedAccounts() public method

startPutsACookieIntoTheHttpResponse() public method

startThrowsAnExceptionIfIncompatibleRequestHandlerIsUsed() public method

touchThrowsExceptionIfCalledOnNonStartedSession() public method

touchUpdatesLastActivityTimestampOfRemoteSession() public method

twoSessionsDontConflictIfUsingSameEntryIdentifiers() public method

Property Details

$httpRequest protected property

protected Request,Neos\Flow\Http $httpRequest
return Neos\Flow\Http\Request

$httpResponse protected property

protected Response,Neos\Flow\Http $httpResponse
return Neos\Flow\Http\Response

$mockBootstrap protected property

protected Bootstrap,Neos\Flow\Core $mockBootstrap
return Neos\Flow\Core\Bootstrap

$mockObjectManager protected property

protected ObjectManagerInterface,Neos\Flow\ObjectManagement $mockObjectManager
return Neos\Flow\ObjectManagement\ObjectManagerInterface

$mockSecurityContext protected property

protected Context,Neos\Flow\Security|PHPUnit_Framework_MockObject_MockObject $mockSecurityContext
return Neos\Flow\Security\Context | PHPUnit_Framework_MockObject_MockObject

$settings protected property

protected array $settings
return array