[ Index ] |
PHP Cross Reference of DokuWiki |
[Source view] [Print] [Project Stats]
Simulates a full DokuWiki HTTP Request and allows runtime inspection.
File Size: | 282 lines (7 kb) |
Included or required: | 1 time |
Referenced: | 0 times |
Includes or requires: | 0 files |
TestRequest:: (16 methods):
getServer()
getSession()
getGet()
getPost()
getScript()
setServer()
setSession()
setGet()
setPost()
execute()
setUri()
post()
get()
ob_start_callback()
getRunning()
addData()
Class: TestRequest - X-Ref
Helper class to execute a fake requestgetServer($key) X-Ref |
Get a $_SERVER var return: mixed param: string $key |
getSession($key) X-Ref |
Get a $_SESSION var return: mixed param: string $key |
getGet($key) X-Ref |
Get a $_GET var return: mixed param: string $key |
getPost($key) X-Ref |
Get a $_POST var return: mixed param: string $key |
getScript() X-Ref |
Get the script that will execute the request return: string |
setServer($key, $value) X-Ref |
Set a $_SERVER var param: string $key param: mixed $value |
setSession($key, $value) X-Ref |
Set a $_SESSION var param: string $key param: mixed $value |
setGet($key, $value) X-Ref |
Set a $_GET var param: string $key param: mixed $value |
setPost($key, $value) X-Ref |
Set a $_POST var param: string $key param: mixed $value |
execute($uri = '/doku.php') X-Ref |
Executes the request return: TestResponse the resulting output of the request param: string $uri end URL to simulate, needs to be one of the testable scripts |
setUri($uri) X-Ref |
Set the virtual URI the request works against This parses the given URI and sets any contained GET variables but will not overwrite any previously set ones (eg. set via setGet()). It initializes the $_SERVER['REQUEST_URI'] and $_SERVER['QUERY_STRING'] with all set GET variables. param: string $uri end URL to simulate |
post($post = array() X-Ref |
Simulate a POST request with the given variables return: TestResponse param: array $post all the POST parameters to use param: string $uri end URL to simulate |
get($get = array() X-Ref |
Simulate a GET request with the given variables return: TestResponse param: array $get all the GET parameters to use param: string $uri end URL to simulate |
ob_start_callback($buffer) X-Ref |
Callback for ob_start This continues to fill our own buffer, even when some part of the code askes for flushing the buffers param: string $buffer |
getRunning() X-Ref |
Access the TestRequest from the executed code This allows certain functions to access the TestRequest that is accessing them to add additional info. return: null|TestRequest the currently executed request if any |
addData($key, $value) X-Ref |
Store data to be read in the response later When called multiple times with the same key, the data is appended to this key's array param: string $key the identifier for this information param: mixed $value arbitrary data to store |