fix gitlab tests

This commit is contained in:
Julien Fastré 2017-06-22 23:05:19 +02:00
parent 5a3f360822
commit 332bec6e83
4 changed files with 41 additions and 12 deletions

View File

@ -16,11 +16,12 @@ stages:
- build-doc
- deploy-doc
test:php-5.6:
test:php-7.1:
stage: test
image: chill/ci-image:php-5.6
image: chill/ci-image:php-7.1
<<: *test_definition
script: phpunit
test:php-7:
stage: test
image: chill/ci-image:php-7

View File

@ -52,12 +52,32 @@ class ReportController extends Controller
$reachableScopes = $this->get('chill.main.security.authorization.helper')
->getReachableScopes($this->getUser(), new Role('CHILL_REPORT_SEE'),
$person->getCenter());
$reports = $em->getRepository('ChillReportBundle:Report')
->findBy(array('person' => $person, 'scope' => $reachableScopes));
$total = $em
->createQuery("SELECT COUNT(r.id) FROM ChillReportBundle:Report r "
. "WHERE r.person = :person AND r.scope IN (:scopes) ")
->setParameter('person', $person)
->setParameter('scopes', $reachableScopes)
->getSingleScalarResult();
// get the PaginatorFactory
$paginator = $this->get('chill_main.paginator_factory')->create($total);
$reports = $em->createQuery('SELECT r
FROM ChillReportBundle:Report r
WHERE r.person = :person AND r.scope IN (:scopes)
ORDER BY r.date DESC')
->setParameter('person', $person)
->setParameter('scopes', $reachableScopes)
->setFirstResult($paginator->getCurrentPage()->getFirstItemNumber())
->setMaxResults($paginator->getItemsPerPage())
->getResult()
;
return $this->render('ChillReportBundle:Report:list.html.twig', array(
'reports' => $reports,
'person' => $person
'person' => $person,
'paginator' => $paginator
));
}

View File

@ -64,6 +64,10 @@
</tbody>
</table>
{% if reports|length < paginator.getTotalItems %}
{{ chill_pagination(paginator) }}
{% endif %}
{% endif %}
<ul class="record_actions">

View File

@ -30,24 +30,28 @@
"chill-project/person": "dev-master",
"champs-libres/composer-bundle-migration": "~1.0",
"doctrine/doctrine-migrations-bundle": "~1.1",
"doctrine/migrations": "~1.0@dev"
"doctrine/migrations": "~1.0"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "~2.2",
"fzaninotto/faker": "~1",
"monolog/monolog": "^1.14",
"symfony/monolog-bundle": "^2.7"
"symfony/monolog-bundle": "^2.7",
"phpunit/phpunit": "~5.0"
},
"scripts": {
"post-install-cmd": [
"ComposerBundleMigration\\Composer\\Migrations::synchronizeMigrations"
"ComposerBundleMigration\\Composer\\Migrations::synchronizeMigrations",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap"
],
"post-update-cmd": [
"ComposerBundleMigration\\Composer\\Migrations::synchronizeMigrations"
"ComposerBundleMigration\\Composer\\Migrations::synchronizeMigrations",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap"
]
},
"extra": {
"app-migrations-dir": "Tests/Fixtures/App/app/DoctrineMigrations"
"app-migrations-dir": "Tests/Fixtures/App/app/DoctrineMigrations",
"symfony-app-dir": "Tests/Fixtures/App/app"
},
"minimum-stability": "dev",
"prefer-stable": true