silverstripe-framework/tests/php/Control/ControllerTest/SubController.php
Damian Mooyman 0c41a97a8b API Refactor Form request handling into FormRequestHandler
API Add HasRequestHandler interface
API Refactor Link() and url handling behaviour from Controller into RequestHandler
API RequestHandler classes now must define url_segment to have a default Link()
API Clean up redirectBack()
2017-03-10 15:04:33 +13:00

44 lines
1.0 KiB
PHP

<?php
namespace SilverStripe\Control\Tests\ControllerTest;
use SilverStripe\Control\Controller;
use SilverStripe\Dev\TestOnly;
class SubController extends Controller implements TestOnly
{
private static $url_segment = 'SubController';
private static $allowed_actions = array(
'subaction',
'subvieweraction',
);
private static $url_handlers = array(
'substring/subvieweraction' => 'subvieweraction',
);
public function subaction()
{
return $this->getAction();
}
/* This is messy, but Controller->handleRequest is a hard to test method which warrants such measures... */
public function getViewer($action)
{
if (empty($action)) {
throw new SubController_Exception("Null action passed, getViewer will break");
}
return parent::getViewer($action);
}
public function subvieweraction()
{
return $this->customise(
array(
'Thoughts' => 'Hope this works',
)
);
}
}