Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
a213f310
Commit
a213f310
authored
Nov 01, 2012
by
Angie Byron
Browse files
Issue
#1816582
by klausi, Crell: Fixed Fatal error in exception handler on 405 HTML responses.
parent
3e790105
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/ExceptionController.php
View file @
a213f310
...
...
@@ -86,7 +86,7 @@ public function execute(FlattenException $exception, Request $request) {
* The request object that triggered this exception.
*/
public
function
on405Html
(
FlattenException
$exception
,
Request
$request
)
{
$event
->
setResponse
(
new
Response
(
'Method Not Allowed'
,
405
)
)
;
return
new
Response
(
'Method Not Allowed'
,
405
);
}
/**
...
...
core/modules/system/lib/Drupal/system/Tests/System/ExceptionControllerTest.php
0 → 100644
View file @
a213f310
<?php
/**
* Definition of Drupal\system\Tests\System\ExceptionControllerTest.
*/
namespace
Drupal\system\Tests\System
;
use
\
Drupal\Core\ContentNegotiation
;
use
\
Drupal\Core\ExceptionController
;
use
\
Drupal\simpletest\UnitTestBase
;
use
\
Symfony\Component\HttpFoundation\Request
;
use
\
Symfony\Component\HttpKernel\Exception\FlattenException
;
/**
* Tests exception controller.
*/
class
ExceptionControllerTest
extends
UnitTestBase
{
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'Exception controller'
,
'description'
=>
'Performs tests on the exception handler controller class.'
,
'group'
=>
'System'
,
);
}
/**
* Ensure the execute() method returns a valid response on 405 exceptions.
*/
public
function
test405HTML
()
{
$exception
=
new
\
Exception
(
'Test exception'
);
$flat_exception
=
FlattenException
::
create
(
$exception
,
405
);
$exception_controller
=
new
ExceptionController
(
new
ContentNegotiation
());
$response
=
$exception_controller
->
execute
(
$flat_exception
,
new
Request
());
$this
->
assertEqual
(
$response
->
getStatusCode
(),
405
,
'HTTP status of response is correct.'
);
$this
->
assertEqual
(
$response
->
getContent
(),
'Method Not Allowed'
,
'HTTP response body is correct.'
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment