mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
40 lines
946 B
PHP
40 lines
946 B
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 = [
|
|
'subaction',
|
|
'subvieweraction',
|
|
];
|
|
|
|
private static $url_handlers = [
|
|
'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 'Hope this works';
|
|
}
|
|
}
|