Removed generic error handling from action that will usually be handled by ErrorHandler middleware

This commit is contained in:
Alejandro Celaya
2019-11-20 20:21:02 +01:00
parent 84c4631124
commit 98b6dba05d
2 changed files with 0 additions and 23 deletions

View File

@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace ShlinkioTest\Shlink\Rest\Action\ShortUrl;
use Exception;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;
@@ -124,19 +123,4 @@ class CreateShortUrlActionTest extends TestCase
$this->assertEquals(400, $response->getStatusCode());
$this->assertStringContainsString(RestUtils::INVALID_SLUG_ERROR, (string) $response->getBody());
}
/** @test */
public function aGenericExceptionWillReturnError(): void
{
$this->urlShortener->urlToShortCode(Argument::type(Uri::class), Argument::type('array'), Argument::cetera())
->willThrow(Exception::class)
->shouldBeCalledOnce();
$request = (new ServerRequest())->withParsedBody([
'longUrl' => 'http://www.domain.com/foo/bar',
]);
$response = $this->action->handle($request);
$this->assertEquals(500, $response->getStatusCode());
$this->assertTrue(strpos($response->getBody()->getContents(), RestUtils::UNKNOWN_ERROR) > 0);
}
}