2016-10-14 03:30:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Control\Tests\ControllerTest;
|
|
|
|
|
|
|
|
use SilverStripe\Control\Controller;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
|
|
|
|
class SubController extends Controller implements TestOnly
|
|
|
|
{
|
2017-03-02 03:24:38 +01:00
|
|
|
private static $url_segment = 'SubController';
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
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',
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
}
|