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

@ -22,6 +22,6 @@ script:
after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover build/clover.xml
- php ocular.phar code-coverage:upload --format=php-clover build/unit-clover.xml
sudo: false

View file

@ -82,14 +82,15 @@
"scripts": {
"check": [
"@cs",
"@test"
"@test",
"@func-test"
],
"cs": "phpcs",
"cs-fix": "phpcbf",
"serve": "php -S 0.0.0.0:8000 -t public/",
"test": "phpunit --coverage-clover build/clover.xml",
"test": "phpunit --coverage-clover build/unit-clover.xml",
"pretty-test": "phpunit --coverage-html build/coverage",
"func-test": "phpunit -c phpunit-func.xml"
"func-test": "phpunit -c phpunit-func.xml --coverage-clover build/func-clover.xml"
},
"config": {
"process-timeout": 0,

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;
}