Added zend problem details to the project

This commit is contained in:
Alejandro Celaya
2019-11-22 19:49:14 +01:00
parent 4e5ab21a47
commit 74854b3dac
6 changed files with 49 additions and 46 deletions

View File

@@ -13,7 +13,6 @@ use Shlinkio\Shlink\Core\Action\RedirectAction;
use Shlinkio\Shlink\Core\Options\NotFoundRedirectOptions;
use Shlinkio\Shlink\Core\Response\NotFoundHandler;
use Zend\Diactoros\Response;
use Zend\Diactoros\ServerRequest;
use Zend\Diactoros\ServerRequestFactory;
use Zend\Diactoros\Uri;
use Zend\Expressive\Router\Route;
@@ -37,29 +36,6 @@ class NotFoundHandlerTest extends TestCase
$this->delegate = new NotFoundHandler($this->renderer->reveal(), $this->redirectOptions, '');
}
/**
* @test
* @dataProvider provideResponses
*/
public function properResponseTypeIsReturned(string $expectedResponse, string $accept, int $renderCalls): void
{
$request = (new ServerRequest())->withHeader('Accept', $accept);
$render = $this->renderer->render(Argument::cetera())->willReturn('');
$resp = $this->delegate->handle($request);
$this->assertInstanceOf($expectedResponse, $resp);
$render->shouldHaveBeenCalledTimes($renderCalls);
}
public function provideResponses(): iterable
{
yield 'application/json' => [Response\JsonResponse::class, 'application/json', 0];
yield 'text/json' => [Response\JsonResponse::class, 'text/json', 0];
yield 'application/x-json' => [Response\JsonResponse::class, 'application/x-json', 0];
yield 'text/html' => [Response\HtmlResponse::class, 'text/html', 1];
}
/**
* @test
* @dataProvider provideRedirects