2016-10-14 03:30:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Control\Tests\ControllerTest;
|
|
|
|
|
|
|
|
use SilverStripe\Control\Controller;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Simple controller for testing
|
|
|
|
*/
|
|
|
|
class TestController extends Controller implements TestOnly
|
|
|
|
{
|
2017-06-22 12:50:45 +02:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
if (Controller::has_curr()) {
|
|
|
|
$this->setRequest(Controller::curr()->getRequest());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-02 03:24:38 +01:00
|
|
|
private static $url_segment = 'TestController';
|
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public $Content = "default content";
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
private static $allowed_actions = array(
|
|
|
|
'methodaction',
|
|
|
|
'stringaction',
|
|
|
|
'redirectbacktest',
|
|
|
|
'templateaction'
|
|
|
|
);
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function methodaction()
|
|
|
|
{
|
|
|
|
return array(
|
|
|
|
"Content" => "methodaction content"
|
|
|
|
);
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function stringaction()
|
|
|
|
{
|
|
|
|
return "stringaction was called.";
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function redirectbacktest()
|
|
|
|
{
|
|
|
|
return $this->redirectBack();
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
}
|