Updated composer check to ru functional tests too

This commit is contained in:
Alejandro Celaya
2017-10-23 11:29:37 +02:00
parent c2feffa50c
commit c522879c64
4 changed files with 20 additions and 14 deletions

View File

@@ -13,7 +13,7 @@ class VisitRepository extends EntityRepository implements VisitRepositoryInterfa
/**
* @return Visit[]
*/
public function findUnlocatedVisits()
public function findUnlocatedVisits(): array
{
$qb = $this->createQueryBuilder('v');
$qb->where($qb->expr()->isNull('v.visitLocation'));
@@ -22,15 +22,20 @@ class VisitRepository extends EntityRepository implements VisitRepositoryInterfa
}
/**
* @param ShortUrl|int $shortUrl
* @param ShortUrl|int $shortUrlOrId
* @param DateRange|null $dateRange
* @return Visit[]
*/
public function findVisitsByShortUrl($shortUrl, DateRange $dateRange = null)
public function findVisitsByShortUrl($shortUrlOrId, DateRange $dateRange = null): array
{
$shortUrl = $shortUrl instanceof ShortUrl
? $shortUrl
: $this->getEntityManager()->find(ShortUrl::class, $shortUrl);
/** @var ShortUrl|null $shortUrl */
$shortUrl = $shortUrlOrId instanceof ShortUrl
? $shortUrlOrId
: $this->getEntityManager()->find(ShortUrl::class, $shortUrlOrId);
if ($shortUrl === null) {
return [];
}
$qb = $this->createQueryBuilder('v');
$qb->where($qb->expr()->eq('v.shortUrl', ':shortUrl'))
@@ -38,11 +43,11 @@ class VisitRepository extends EntityRepository implements VisitRepositoryInterfa
->orderBy('v.date', 'DESC') ;
// Apply date range filtering
if (! empty($dateRange->getStartDate())) {
if ($dateRange !== null && $dateRange->getStartDate() !== null) {
$qb->andWhere($qb->expr()->gte('v.date', ':startDate'))
->setParameter('startDate', $dateRange->getStartDate());
}
if (! empty($dateRange->getEndDate())) {
if ($dateRange !== null && $dateRange->getEndDate() !== null) {
$qb->andWhere($qb->expr()->lte('v.date', ':endDate'))
->setParameter('endDate', $dateRange->getEndDate());
}

View File

@@ -13,12 +13,12 @@ interface VisitRepositoryInterface extends ObjectRepository
/**
* @return Visit[]
*/
public function findUnlocatedVisits();
public function findUnlocatedVisits(): array;
/**
* @param ShortUrl|int $shortUrl
* @param DateRange|null $dateRange
* @return Visit[]
*/
public function findVisitsByShortUrl($shortUrl, DateRange $dateRange = null);
public function findVisitsByShortUrl($shortUrl, DateRange $dateRange = null): array;
}