2012-04-30 15:04:59 +02:00
|
|
|
<?php
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2016-10-14 03:30:05 +02:00
|
|
|
namespace SilverStripe\Control\Tests;
|
|
|
|
|
|
|
|
use SilverStripe\Control\Session;
|
2016-08-19 00:51:35 +02:00
|
|
|
use SilverStripe\Core\Injector\Injector;
|
2016-09-09 08:43:05 +02:00
|
|
|
use SilverStripe\Control\HTTPRequest;
|
|
|
|
use SilverStripe\Control\HTTPResponse;
|
2016-08-19 00:51:35 +02:00
|
|
|
use SilverStripe\Control\Controller;
|
|
|
|
|
2012-04-30 15:04:59 +02:00
|
|
|
// Fake a current controller. Way harder than it should be
|
2016-12-16 05:34:21 +01:00
|
|
|
class FakeController extends Controller
|
|
|
|
{
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
2012-04-30 15:04:59 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
$session = Injector::inst()->create(Session::class, isset($_SESSION) ? $_SESSION : array());
|
|
|
|
$this->setSession($session);
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
$this->pushCurrent();
|
2012-04-30 15:04:59 +02:00
|
|
|
|
2017-02-27 03:59:54 +01:00
|
|
|
$request = new HTTPRequest('GET', '/');
|
2016-12-16 05:34:21 +01:00
|
|
|
$this->setRequest($request);
|
2015-08-14 02:39:33 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
$this->setResponse(new HTTPResponse());
|
2014-08-15 08:53:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
$this->doInit();
|
|
|
|
}
|
2014-06-19 00:38:26 +02:00
|
|
|
}
|