mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-22 08:56:42 -06:00
Fixed existing tests and coding styles
This commit is contained in:
parent
d7ffcd903d
commit
99fd5f937e
@ -29,16 +29,18 @@ class ShortUrlService implements ShortUrlServiceInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $page
|
||||
* @param string|null $searchQuery
|
||||
* @param string[] $tags
|
||||
* @param array|string|null $orderBy
|
||||
* @param DateRange|null $dateRange
|
||||
*
|
||||
* @return ShortUrl[]|Paginator
|
||||
*/
|
||||
public function listShortUrls(int $page = 1, ?string $searchQuery = null, array $tags = [], $orderBy = null, ?DateRange $dateRange = null)
|
||||
{
|
||||
public function listShortUrls(
|
||||
int $page = 1,
|
||||
?string $searchQuery = null,
|
||||
array $tags = [],
|
||||
$orderBy = null,
|
||||
?DateRange $dateRange = null
|
||||
) {
|
||||
/** @var ShortUrlRepository $repo */
|
||||
$repo = $this->em->getRepository(ShortUrl::class);
|
||||
$paginator = new Paginator(new ShortUrlRepositoryAdapter($repo, $searchQuery, $tags, $orderBy, $dateRange));
|
||||
|
@ -13,16 +13,18 @@ use Zend\Paginator\Paginator;
|
||||
interface ShortUrlServiceInterface
|
||||
{
|
||||
/**
|
||||
* @param int $page
|
||||
* @param string|null $searchQuery
|
||||
* @param string[] $tags
|
||||
* @param array|string|null $orderBy
|
||||
* @return ShortUrl[]|Paginator
|
||||
* @param DateRange|null $dateRange
|
||||
*
|
||||
* @return ShortUrl[]|Paginator
|
||||
*/
|
||||
public function listShortUrls(int $page = 1, ?string $searchQuery = null, array $tags = [], $orderBy = null, ?DateRange $dateRange = null);
|
||||
public function listShortUrls(
|
||||
int $page = 1,
|
||||
?string $searchQuery = null,
|
||||
array $tags = [],
|
||||
$orderBy = null,
|
||||
?DateRange $dateRange = null
|
||||
);
|
||||
|
||||
/**
|
||||
* @param string[] $tags
|
||||
|
@ -25,7 +25,7 @@ class ShortUrlRepositoryAdapterTest extends TestCase
|
||||
/** @test */
|
||||
public function getItemsFallbacksToFindList(): void
|
||||
{
|
||||
$this->repo->findList(10, 5, 'search', ['foo', 'bar'], 'order')->shouldBeCalledOnce();
|
||||
$this->repo->findList(10, 5, 'search', ['foo', 'bar'], 'order', null)->shouldBeCalledOnce();
|
||||
$this->adapter->getItems(5, 10);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ class ListShortUrlsAction extends AbstractRestAction
|
||||
$dateRange = null;
|
||||
$startDate = isset($query['startDate']) ? Chronos::parse($query['startDate']) : null;
|
||||
$endDate = isset($query['endDate']) ? Chronos::parse($query['endDate']) : null;
|
||||
if ($startDate != null || $endDate != null) {
|
||||
if ($startDate !== null || $endDate !== null) {
|
||||
$dateRange = new DateRange($startDate, $endDate);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,8 @@ class ListShortUrlsActionTest extends TestCase
|
||||
$expectedPage,
|
||||
$expectedSearchTerm,
|
||||
$expectedTags,
|
||||
$expectedOrderBy
|
||||
$expectedOrderBy,
|
||||
null
|
||||
)->willReturn(new Paginator(new ArrayAdapter()));
|
||||
|
||||
/** @var JsonResponse $response */
|
||||
|
Loading…
Reference in New Issue
Block a user