Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #103 from MitchelAwesome/3.x
Browse files Browse the repository at this point in the history
MalformedContentException throws 500 instead of 400
  • Loading branch information
kleijnweb committed Nov 10, 2017
2 parents 2699d15 + e039fb4 commit 0cafe60
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Exception/MalformedContentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@
*/
class MalformedContentException extends \Exception
{
public function __construct($message = "", $code = 400, $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
25 changes: 25 additions & 0 deletions src/Tests/Exception/MalformedContentExceptionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php declare(strict_types = 1);
/*
* This file is part of the KleijnWeb\SwaggerBundle package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace KleijnWeb\SwaggerBundle\Tests\Exception;

use KleijnWeb\SwaggerBundle\Exception\MalformedContentException;
use PHPUnit_Framework_TestCase;

class MalformedContentExceptionTest extends PHPUnit_Framework_TestCase
{
/**
* @test
*/
public function malformedContentWillThrow400()
{
$exception = new MalformedContentException();

$this->assertEquals('400', $exception->getCode());
}
}

0 comments on commit 0cafe60

Please sign in to comment.