/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
{
// phpCAS::setDebug(dirname(__FILE__).'/../test.log');
// error_reporting(E_ALL);
CAS_GracefullTerminationException::throwInsteadOfExiting();
$_SERVER['SERVER_NAME'] = 'www.clientapp.com';
$_SERVER['SERVER_PORT'] = '80';
$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
$_SERVER['SERVER_ADMIN'] = 'root@localhost';
$_SERVER['REQUEST_URI'] = '/';
$_SERVER['SCRIPT_NAME'] = '/index.php';
$_SERVER['PHP_SELF'] = '/index.php';
$_SESSION = array();
$this->object = new CAS_Client(CAS_VERSION_2_0, true, 'cas.example.edu', 443, '/cas/', false);
$this->object->setRequestImplementation('CAS_TestHarness_DummyRequest');
$this->object->setCasServerCACert('/path/to/ca_cert.crt');
/*********************************************************
* Enumerate our responses
*********************************************************/
// Set up our response.
$response = new CAS_TestHarness_BasicResponse('https', 'cas.example.edu', '/cas/serviceValidate');
$response->setResponseHeaders(array('HTTP/1.1 200 OK', 'Date: Wed, 29 Sep 2010 19:20:57 GMT', 'Server: Apache-Coyote/1.1', 'Pragma: no-cache', 'Expires: Thu, 01 Jan 1970 00:00:00 GMT', 'Cache-Control: no-cache, no-store', 'Content-Type: text/html;charset=UTF-8', 'Content-Language: en-US', 'Via: 1.1 cas.example.edu', 'Connection: close', 'Transfer-Encoding: chunked'));
$response->setResponseBody("<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>\n <cas:authenticationSuccess>\n <cas:user>jsmith</cas:user>\n </cas:authenticationSuccess>\n</cas:serviceResponse>\n");
CAS_TestHarness_DummyRequest::addResponse($response);
}