FileAccess Orion

MockArraySessionStorage
in package
implements SessionStorageInterface

MockArraySessionStorage mocks the session for unit tests.

No PHP session is actually started since a session can be initialized and shutdown only once per PHP execution cycle.

When doing functional testing, you should use MockFileSessionStorage instead.

Tags
author

Fabien Potencier fabien@symfony.com

author

Bulat Shakirzyanov mallluhuct@gmail.com

author

Drak drak@zikula.org

Interfaces, Classes, Traits and Enums

SessionStorageInterface
StorageInterface.

Table of Contents

$bags  : array<string|int, mixed>|array<string|int, SessionBagInterface>
$closed  : bool
$data  : array<string|int, mixed>
$id  : string
$metadataBag  : MetadataBag
$name  : string
$started  : bool
__construct()  : mixed
clear()  : mixed
Clear all session data in memory.
getBag()  : SessionBagInterface
Gets a SessionBagInterface by name.
getId()  : string
Returns the session ID.
getMetadataBag()  : MetadataBag
Gets the MetadataBag.
getName()  : mixed
Returns the session name.
isStarted()  : bool
Checks if the session is started.
regenerate()  : bool
Regenerates id that represents this storage.
registerBag()  : mixed
Registers a SessionBagInterface for use.
save()  : mixed
Force the session to be saved and closed.
setId()  : mixed
Sets the session ID.
setMetadataBag()  : mixed
setName()  : mixed
Sets the session name.
setSessionData()  : mixed
start()  : bool
Starts the session.
generateId()  : string
Generates a session ID.
loadSession()  : mixed

Properties

Methods

getId()

Returns the session ID.

public getId() : string
Return values
string

The session ID or empty

getName()

Returns the session name.

public getName() : mixed
Return values
mixed

The session name

isStarted()

Checks if the session is started.

public isStarted() : bool
Return values
bool

True if started, false otherwise

regenerate()

Regenerates id that represents this storage.

public regenerate([mixed $destroy = false ][, mixed $lifetime = null ]) : bool
Parameters
$destroy : mixed = false

Destroy session when regenerating?

$lifetime : mixed = null

Sets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.

Return values
bool

True if session regenerated, false if error

setId()

Sets the session ID.

public setId(mixed $id) : mixed
Parameters
$id : mixed
Return values
mixed

setName()

Sets the session name.

public setName(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

setSessionData()

public setSessionData(array<string|int, mixed> $array) : mixed
Parameters
$array : array<string|int, mixed>
Return values
mixed

generateId()

Generates a session ID.

protected generateId() : string

This doesn't need to be particularly cryptographically secure since this is just a mock.

Return values
string

Search results