2012-04-30 15:04:59 +02:00
|
|
|
<?php
|
|
|
|
// Fake a current controller. Way harder than it should be
|
|
|
|
class FakeController extends Controller {
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-09-19 12:07:39 +02:00
|
|
|
public function __construct() {
|
2012-04-30 15:04:59 +02:00
|
|
|
parent::__construct();
|
|
|
|
|
2014-06-19 00:38:26 +02:00
|
|
|
$session = Injector::inst()->create('Session', isset($_SESSION) ? $_SESSION : array());
|
2012-04-30 15:04:59 +02:00
|
|
|
$this->setSession($session);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-04-30 15:04:59 +02:00
|
|
|
$this->pushCurrent();
|
|
|
|
|
2015-04-30 01:04:08 +02:00
|
|
|
$request = new SS_HTTPRequest(
|
2014-08-15 08:53:05 +02:00
|
|
|
(isset($_SERVER['X-HTTP-Method-Override']))
|
|
|
|
? $_SERVER['X-HTTP-Method-Override']
|
2012-09-26 23:34:00 +02:00
|
|
|
: $_SERVER['REQUEST_METHOD'],
|
2012-04-30 15:04:59 +02:00
|
|
|
'/'
|
|
|
|
);
|
2015-04-30 01:04:08 +02:00
|
|
|
$this->setRequest($request);
|
2015-08-14 02:39:33 +02:00
|
|
|
|
|
|
|
$this->setResponse(new SS_HTTPResponse());
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2012-04-30 15:04:59 +02:00
|
|
|
$this->init();
|
|
|
|
}
|
2014-06-19 00:38:26 +02:00
|
|
|
}
|