Migrated rest actions to psr-15 middleware

This commit is contained in:
Alejandro Celaya
2017-03-25 10:04:48 +01:00
parent 288249d0b8
commit 2e5a7d76df
13 changed files with 93 additions and 100 deletions

View File

@@ -5,13 +5,13 @@ use PHPUnit\Framework\TestCase;
use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\Core\Service\ShortUrlService;
use Shlinkio\Shlink\Rest\Action\ListShortcodesAction;
use Zend\Diactoros\Response;
use ShlinkioTest\Shlink\Common\Util\TestUtils;
use Zend\Diactoros\ServerRequestFactory;
use Zend\I18n\Translator\Translator;
use Zend\Paginator\Adapter\ArrayAdapter;
use Zend\Paginator\Paginator;
class ListShortcodesActionTest extends TestCase
class ListShortCodesActionTest extends TestCase
{
/**
* @var ListShortcodesAction
@@ -37,11 +37,11 @@ class ListShortcodesActionTest extends TestCase
$this->service->listShortUrls($page, null, [], null)->willReturn(new Paginator(new ArrayAdapter()))
->shouldBeCalledTimes(1);
$response = $this->action->__invoke(
$response = $this->action->process(
ServerRequestFactory::fromGlobals()->withQueryParams([
'page' => $page,
]),
new Response()
TestUtils::createDelegateMock()->reveal()
);
$this->assertEquals(200, $response->getStatusCode());
}
@@ -55,11 +55,11 @@ class ListShortcodesActionTest extends TestCase
$this->service->listShortUrls($page, null, [], null)->willThrow(\Exception::class)
->shouldBeCalledTimes(1);
$response = $this->action->__invoke(
$response = $this->action->process(
ServerRequestFactory::fromGlobals()->withQueryParams([
'page' => $page,
]),
new Response()
TestUtils::createDelegateMock()->reveal()
);
$this->assertEquals(500, $response->getStatusCode());
}