2016-10-14 03:30:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Control\Tests\RequestHandlingTest;
|
|
|
|
|
|
|
|
use SilverStripe\Core\Extension;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Simple extension for the test controller
|
|
|
|
*/
|
|
|
|
class ControllerExtension extends Extension implements TestOnly
|
|
|
|
{
|
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public static $called_error = false;
|
|
|
|
|
|
|
|
public static $called_404_error = false;
|
|
|
|
|
2020-04-20 19:58:09 +02:00
|
|
|
private static $allowed_actions = ['extendedMethod'];
|
2016-12-16 05:34:21 +01:00
|
|
|
|
|
|
|
public function extendedMethod()
|
|
|
|
{
|
|
|
|
return "extendedMethod";
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called whenever there is an HTTP error
|
|
|
|
*/
|
|
|
|
public function onBeforeHTTPError()
|
|
|
|
{
|
|
|
|
self::$called_error = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called whenever there is an 404 error
|
|
|
|
*/
|
|
|
|
public function onBeforeHTTPError404()
|
|
|
|
{
|
|
|
|
self::$called_404_error = true;
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
}
|