31 lines
764 B
Bash
31 lines
764 B
Bash
# shellcheck disable=SC2154,SC2034
|
|
|
|
testSessionDir='/tmp/exprash_test_sessions'
|
|
mkdir -p "$testSessionDir"
|
|
|
|
it "Should set session directory" "$({
|
|
_exprashInit
|
|
useSession "$testSessionDir"
|
|
[ "$_exprashSessionDir" == "$testSessionDir" ]
|
|
})"
|
|
|
|
it "Should save and load session" "$({
|
|
_exprashInit
|
|
useSession "$testSessionDir"
|
|
session 'data' 'value'
|
|
session_id=$_exprashSessionId
|
|
cookie_value=${_exprashSetCookies[$_exprashSessionCookieName]}
|
|
_exprashShutdown
|
|
|
|
# Forcibly clear session data just in case (but it should also get cleared by
|
|
# _exprashInit)
|
|
_exprashSession=()
|
|
_exprashSessionId=''
|
|
|
|
HTTP_COOKIE="${_exprashSessionCookieName}=$cookie_value"
|
|
_exprashInit
|
|
useSession "$testSessionDir"
|
|
[ "$(session 'data')" == "value" ]
|
|
})"
|
|
|