Plib_XH

FakeRequest extends Request
in package

FinalYes

A Request fake for automated testing

Tags
since
1.1

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
bool
public cookie(string $key) : string|null
Parameters
$key : string
Return values
string|null

current()

public static current() : self
Return values
self

edit()

Wraps $edit

public edit() : bool
Return values
bool

file()

Retrieves information about an uploaded file

public file(string $key) : UploadedFile|null

This is basically a wrapper over $_FILES. For now, only simple $keys 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|null

get()

public get(string $key) : string|null
Parameters
$key : string
Return values
string|null

getArray()

public getArray(string $key) : array<string|int, string>|null
Parameters
$key : string
Return values
array<string|int, string>|null

header()

Retrieves an HTTP request header

public header(string $key) : string|null
Parameters
$key : string
Return values
string|null

language()

public language() : string
Return values
string

post()

public post(string $key) : string|null
Parameters
$key : string
Return values
string|null

postArray()

public postArray(string $key) : array<string|int, string>|null
Parameters
$key : string
Return values
array<string|int, string>|null

remoteAddr()

public remoteAddr() : string
Tags
since
1.2
Return values
string

s()

The selected page ($s)

public s() : int
Return values
int

selected()

The selected URL ($su)

public selected() : string
Return values
string

username()

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.

Return values
string|null

        
On this page

Search results