FakeRequest
extends Request
in package
FinalYes
A Request fake for automated testing
Tags
Table of Contents
Methods
- __construct() : mixed
- admin() : bool
- Whether the user is logged in as administrator
- cookie() : string|null
- current() : self
- edit() : bool
- Wraps $edit
- file() : UploadedFile|null
- Retrieves information about an uploaded file
- get() : string|null
- getArray() : array<string|int, string>|null
- header() : string|null
- Retrieves an HTTP request header
- language() : string
- post() : string|null
- postArray() : array<string|int, string>|null
- remoteAddr() : string
- s() : int
- The selected page ($s)
- selected() : string
- The selected URL ($su)
- time() : int
- url() : Url
- username() : string|null
- The name of the currently logged in user
Methods
__construct()
public
__construct([UploadedFile>, time?: int, username?: string, admin?: bool, s?: int, language?: string, edit?: bool} $opts = [] ]) : mixed
Parameters
- $opts : UploadedFile>, time?: int, username?: string, admin?: bool, s?: int, language?: string, edit?: bool} = []
admin()
Whether the user is logged in as administrator
public
admin() : bool
Return values
boolcookie()
public
cookie(string $key) : string|null
Parameters
- $key : string
Return values
string|nullcurrent()
public
static current() : self
Return values
selfedit()
Wraps $edit
public
edit() : bool
Return values
boolfile()
Retrieves information about an uploaded file
public
file(string $key) : UploadedFile|null
This is basically a wrapper over $_FILES
.
For now, only simple $key
s are supported, i.e. no arrays.
If the file referred to by $key
has been uploaded,
an UploadedFile
instance is returned.
Otherwise null
is returned.
Parameters
- $key : string
Return values
UploadedFile|nullget()
public
get(string $key) : string|null
Parameters
- $key : string
Return values
string|nullgetArray()
public
getArray(string $key) : array<string|int, string>|null
Parameters
- $key : string
Return values
array<string|int, string>|nullheader()
Retrieves an HTTP request header
public
header(string $key) : string|null
Parameters
- $key : string
Return values
string|nulllanguage()
public
language() : string
Return values
stringpost()
public
post(string $key) : string|null
Parameters
- $key : string
Return values
string|nullpostArray()
public
postArray(string $key) : array<string|int, string>|null
Parameters
- $key : string
Return values
array<string|int, string>|nullremoteAddr()
public
remoteAddr() : string
Tags
Return values
strings()
The selected page ($s)
public
s() : int
Return values
intselected()
The selected URL ($su)
public
selected() : string
Return values
stringtime()
public
time() : int
Return values
inturl()
public
url() : Url
Return values
Urlusername()
The name of the currently logged in user
public
username() : string|null
This currently supports Register_XH and Memberpages.
If no user is logged in, null
is returned.
This method is completely orthogonal to Request::admin();
a user may be logged in simultaneously as member and admin.