TestSession
class TestSession (View source)
Represents a test usage session of a web-app It will maintain session-state from request to request
Properties
| protected | Controller | $controller | Necessary to use the mock session created in session in the normal controller stack, e.g. to overwrite Member::currentUser() with custom login data.  | 
                
Methods
Submit the form with the given HTML ID, filling it out with the given data.
If the last request was a 3xx response, then follow the redirection
Details
        
                            
    __construct()
        
    
    No description
        
                            
    __destruct()
        
    
    No description
        
                            SS_HTTPResponse
    get(string $url, Session $session = null, array $headers = null, array $cookies = null)
        
    
    Submit a get request
        
                            SS_HTTPResponse
    post(string $url, array $data, array $headers = null, Session $session = null, string $body = null, array $cookies = null)
        
    
    Submit a post request
        
                            SS_HTTPResponse
    submitForm(string $formID, string $button = null, array $data = array())
        
    
    Submit the form with the given HTML ID, filling it out with the given data.
Acts on the most recent response.
Any data parameters have to be present in the form, with exact form field name and values, otherwise they are removed from the submission.
Caution: Parameter names have to be formatted as they are in the form submission, not as they are interpreted by PHP. Wrong: array('mycheckboxvalues' => array(1 => 'one', 2 => 'two')) Right: array('mycheckboxvalues[1]' => 'one', 'mycheckboxvalues[2]' => 'two')
        
                            SS_HTTPResponse
    followRedirection()
        
    
    If the last request was a 3xx response, then follow the redirection
        
                            bool
    wasRedirected()
        
    
    Returns true if the last response was a 3xx redirection
        
                            SS_HTTPResponse
    lastResponse()
        
    
    Get the most recent response
        
                            string
    lastUrl()
        
    
    Return the fake HTTP_REFERER; set each time get() or post() is called.
        
                            string
    lastContent()
        
    
    Get the most recent response's content
        
                            CSSContentParser
    cssParser()
        
    
    Return a CSSContentParser containing the most recent response
        
                            SimplePage
    lastPage()
        
    
    Get the last response as a SimplePage object
        
                            Session
    session()
        
    
    Get the current session, as a Session object