The session as code outside the session package sees it: Laravel's
Illuminate\Contracts\Session\Session, reduced to what the testing
toolkit reads and writes.
package:daravel_session's Session implements it and puts the
session of a request in request.attributes[SessionStore.attribute], so
package:daravel_test asserts on a response's session
(assertSessionHas) and seeds one (withSession) without depending on
the session package.
Properties
-
all
→ Map<
String, Object?> -
Every attribute, including the framework's
_token,_flashand_previousentries.no setter -
errors
→ Map<
String, Object?> -
The validation errors flashed by a failed request, by field.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
The session id (the cookie value).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- token → String?
-
The CSRF token (
csrf_token()).no setter
Methods
-
exists(
String key) → bool -
Whether
keyis set, even to null. -
get<
T> (String key, [T? fallback]) → T? -
The value of
key(dotted), orfallback. -
has(
String key) → bool -
Whether
key(dotted) holds a non-null value. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
old<
T> (String key, [T? fallback]) → T? -
old('name'): the flashed input of a failed request. -
put(
String key, Object? value) → void -
Sets
keytovalue. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- attribute → const String
-
The key of a request's session in
Request.attributes. - seedAttribute → const String
-
The key of a map of attributes the session middleware puts into the
session when it starts it (
TestClient.withSession). It is set in process only: nothing a client sends reachesRequest.attributes.