Version: current

# Class TestSession

Represents a test usage session of a web-app It will maintain session-state from request to request

Package: sapphire\testing
Located at sapphire/dev/TestSession.php

## Methods summary

`public` | # `__construct( )`
`public` | # `__destruct( )`
`public` | # `get( mixed $url, mixed $session = null, mixed $headers = null, mixed $cookies = null )` Submit a get request Submit a get request #### Uses ``Director::test()``
`public` | # `post( mixed $url, mixed $data, mixed $headers = null, mixed $session = null, mixed $body = null, mixed $cookies = null )` Submit a post request Submit a post request #### Uses ``Director::test()``
`public` | # `submitForm( mixed $formID, mixed $button = null, mixed $data = array() )` Submit the form with the given HTML ID, filling it out with the given data. Acts on the most recent response Submit the form with the given HTML ID, filling it out with the given data. Acts on the most recent response
`public` | # `followRedirection( )` If the last request was a 3xx response, then follow the redirection If the last request was a 3xx response, then follow the redirection
`public` | # `wasRedirected( )` Returns true if the last response was a 3xx redirection Returns true if the last response was a 3xx redirection
`public` | # `lastResponse( )` Get the most recent response, as an SS_HTTPResponse object Get the most recent response, as an SS_HTTPResponse object
`public` | # `lastContent( )` Get the most recent response's content Get the most recent response's content
`public` | # `cssParser( )`
`public` | # `lastPage( )` Get the last response as a SimplePage object Get the last response as a SimplePage object
`public` | # `session( )` Get the current session, as a Session object Get the current session, as a Session object

### Magic methods summary

## Properties summary

`protected mixed` | $controller | # #### Param Controller $controller Necessary to use the mock session created in `TestSession::session()` in the normal controller stack, e.g. to overwrite Member::currentUser() with custom login data.

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -