Commit 332bec6e authored by Julien Fastré's avatar Julien Fastré
Browse files

fix gitlab tests

parent 5a3f3608
Pipeline #17745 failed with stages
in 3 minutes and 31 seconds
......@@ -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
......
......@@ -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
'reports' => $reports,
'person' => $person,
'paginator' => $paginator
));
}
......
......@@ -64,6 +64,10 @@
</tbody>
</table>
{% if reports|length < paginator.getTotalItems %}
{{ chill_pagination(paginator) }}
{% endif %}
{% endif %}
<ul class="record_actions">
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment