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 - build-doc
- deploy-doc - deploy-doc
test:php-5.6: test:php-7.1:
stage: test stage: test
image: chill/ci-image:php-5.6 image: chill/ci-image:php-7.1
<<: *test_definition <<: *test_definition
script: phpunit script: phpunit
test:php-7: test:php-7:
stage: test stage: test
image: chill/ci-image:php-7 image: chill/ci-image:php-7

View File

@ -52,12 +52,32 @@ class ReportController extends Controller
$reachableScopes = $this->get('chill.main.security.authorization.helper') $reachableScopes = $this->get('chill.main.security.authorization.helper')
->getReachableScopes($this->getUser(), new Role('CHILL_REPORT_SEE'), ->getReachableScopes($this->getUser(), new Role('CHILL_REPORT_SEE'),
$person->getCenter()); $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( return $this->render('ChillReportBundle:Report:list.html.twig', array(
'reports' => $reports, 'reports' => $reports,
'person' => $person 'person' => $person,
'paginator' => $paginator
)); ));
} }

View File

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

View File

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