mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 09:43:13 +08:00
Migrated rest actions to psr-15 middleware
This commit is contained in:
@@ -8,7 +8,7 @@ use Shlinkio\Shlink\Common\Exception\InvalidArgumentException;
|
||||
use Shlinkio\Shlink\Common\Util\DateRange;
|
||||
use Shlinkio\Shlink\Core\Service\VisitsTracker;
|
||||
use Shlinkio\Shlink\Rest\Action\GetVisitsAction;
|
||||
use Zend\Diactoros\Response;
|
||||
use ShlinkioTest\Shlink\Common\Util\TestUtils;
|
||||
use Zend\Diactoros\ServerRequestFactory;
|
||||
use Zend\I18n\Translator\Translator;
|
||||
|
||||
@@ -38,9 +38,9 @@ class GetVisitsActionTest extends TestCase
|
||||
$this->visitsTracker->info($shortCode, Argument::type(DateRange::class))->willReturn([])
|
||||
->shouldBeCalledTimes(1);
|
||||
|
||||
$response = $this->action->__invoke(
|
||||
$response = $this->action->process(
|
||||
ServerRequestFactory::fromGlobals()->withAttribute('shortCode', $shortCode),
|
||||
new Response()
|
||||
TestUtils::createDelegateMock()->reveal()
|
||||
);
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
}
|
||||
@@ -55,9 +55,9 @@ class GetVisitsActionTest extends TestCase
|
||||
InvalidArgumentException::class
|
||||
)->shouldBeCalledTimes(1);
|
||||
|
||||
$response = $this->action->__invoke(
|
||||
$response = $this->action->process(
|
||||
ServerRequestFactory::fromGlobals()->withAttribute('shortCode', $shortCode),
|
||||
new Response()
|
||||
TestUtils::createDelegateMock()->reveal()
|
||||
);
|
||||
$this->assertEquals(404, $response->getStatusCode());
|
||||
}
|
||||
@@ -72,9 +72,9 @@ class GetVisitsActionTest extends TestCase
|
||||
\Exception::class
|
||||
)->shouldBeCalledTimes(1);
|
||||
|
||||
$response = $this->action->__invoke(
|
||||
$response = $this->action->process(
|
||||
ServerRequestFactory::fromGlobals()->withAttribute('shortCode', $shortCode),
|
||||
new Response()
|
||||
TestUtils::createDelegateMock()->reveal()
|
||||
);
|
||||
$this->assertEquals(500, $response->getStatusCode());
|
||||
}
|
||||
@@ -89,10 +89,10 @@ class GetVisitsActionTest extends TestCase
|
||||
->willReturn([])
|
||||
->shouldBeCalledTimes(1);
|
||||
|
||||
$response = $this->action->__invoke(
|
||||
$response = $this->action->process(
|
||||
ServerRequestFactory::fromGlobals()->withAttribute('shortCode', $shortCode)
|
||||
->withQueryParams(['endDate' => '2016-01-01 00:00:00']),
|
||||
new Response()
|
||||
TestUtils::createDelegateMock()->reveal()
|
||||
);
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user