|
|
@@ -43,6 +43,7 @@ use Cake\View\Exception\MissingLayoutException;
|
|
|
use Cake\View\Exception\MissingTemplateException;
|
|
|
use Exception;
|
|
|
use RuntimeException;
|
|
|
+use TestApp\Controller\Admin\ErrorController;
|
|
|
|
|
|
/**
|
|
|
* BlueberryComponent class
|
|
|
@@ -184,6 +185,22 @@ class ExceptionRendererTest extends TestCase
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public function testControllerInstanceForPrefixedRequest()
|
|
|
+ {
|
|
|
+ $namespace = Configure::read('App.namespace');
|
|
|
+ Configure::write('App.namespace', 'TestApp');
|
|
|
+
|
|
|
+ $exception = new NotFoundException('Page not found');
|
|
|
+ $request = new ServerRequest();
|
|
|
+ $request = $request->withParam('prefix', 'admin');
|
|
|
+
|
|
|
+ $ExceptionRenderer = new MyCustomExceptionRenderer($exception, $request);
|
|
|
+
|
|
|
+ $this->assertInstanceOf(ErrorController::class, $ExceptionRenderer->controller);
|
|
|
+
|
|
|
+ Configure::write('App.namespace', $namespace);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* test that methods declared in an ExceptionRenderer subclass are not converted
|
|
|
* into error400 when debug > 0
|