function testPullRegionWithRenderContext() { // this is a dirty dirty mess. sorry. $req = new SS_HTTPRequest('GET', '/test1'); $req->addHeader(AjaxHTTPResponse::PULL_HEADER, 'TestProductGroupItem:BUYABLE'); $req->addHeader('X-Requested-With', 'XMLHttpRequest'); $ctrl = new Controller(); $ctrl->pushCurrent(); $ctrl->setRequest($req); $ctrl->setDataModel(DataModel::inst()); $ctrl->setURLParams(array()); $ctrl->init(); $response = $ctrl->getAjaxResponse(); $response->addRenderContext('BUYABLE', new ArrayData(array('Title' => 'Test Product', 'Link' => '/test-product', 'Price' => 29.99))); $data = json_decode($response->getBody(), true); $ctrl->popCurrent(); $this->assertNotEmpty($data[AjaxHTTPResponse::REGIONS_KEY]['TestProductGroupItem']); }