Blame view

framework/tests/FakeController.php 561 Bytes
0084d336   Administrator   Importers CRUD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  <?php
  // Fake a current controller. Way harder than it should be
  class FakeController extends Controller {
  	
  	public function __construct() {
  		parent::__construct();
  
  		$session = Injector::inst()->create('Session', isset($_SESSION) ? $_SESSION : array());
  		$this->setSession($session);
  		
  		$this->pushCurrent();
  
  		$this->request = new SS_HTTPRequest(
  			(isset($_SERVER['X-HTTP-Method-Override'])) 
  				? $_SERVER['X-HTTP-Method-Override'] 
  				: $_SERVER['REQUEST_METHOD'],
  			'/'
  		);
  
  		$this->response = new SS_HTTPResponse();
  		
  		$this->init();
  	}
  }