Converted InvalidUrlException into a problem details exception

This commit is contained in:
Alejandro Celaya
2019-11-24 23:24:53 +01:00
parent 2f1de4a162
commit 0d7d53ab5b
5 changed files with 23 additions and 29 deletions

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\Core\Exception;
use Exception;
use Fig\Http\Message\StatusCodeInterface;
use PHPUnit\Framework\TestCase;
use Shlinkio\Shlink\Core\Exception\InvalidUrlException;
use Throwable;
@@ -19,8 +20,8 @@ class InvalidUrlExceptionTest extends TestCase
{
$e = InvalidUrlException::fromUrl('http://the_url.com', $prev);
$this->assertEquals('Provided URL "http://the_url.com" is not an existing and valid URL', $e->getMessage());
$this->assertEquals($prev !== null ? $prev->getCode() : -1, $e->getCode());
$this->assertEquals('Provided URL http://the_url.com is invalid. Try with a different one.', $e->getMessage());
$this->assertEquals(StatusCodeInterface::STATUS_BAD_REQUEST, $e->getCode());
$this->assertEquals($prev, $e->getPrevious());
}