* * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ namespace Chill\ActivityBundle\Tests\Aggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; /** * * * @author Julien Fastré */ class ReasonAggregatorTest extends AbstractAggregatorTest { /** * * @var \Chill\ActivityBundle\Export\Aggregator\ReasonAggregator */ private $aggregator; public function setUp() { static::bootKernel(); $container = static::$kernel->getContainer(); $this->aggregator = $container->get('chill.activity.export.reason_aggregator'); // add a fake request with a default locale (used in translatable string) $prophet = new \Prophecy\Prophet; $request = $prophet->prophesize(); $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); $request->getLocale()->willReturn('fr'); $container->get('request_stack') ->push($request->reveal()); } public function getAggregator() { return $this->aggregator; } public function getFormData() { return array( array('level' => 'reasons'), array('level' => 'categories') ); } public function getQueryBuilders() { if (static::$kernel === null) { static::bootKernel(); } $em = static::$kernel->getContainer() ->get('doctrine.orm.entity_manager'); return array( $em->createQueryBuilder() ->select('count(activity.id)') ->from('ChillActivityBundle:Activity', 'activity'), $em->createQueryBuilder() ->select('count(activity.id)') ->from('ChillActivityBundle:Activity', 'activity') ->join('activity.reasons', 'reasons'), $em->createQueryBuilder() ->select('count(activity.id)') ->from('ChillActivityBundle:Activity', 'activity') ->join('activity.reasons', 'reasons') ->join('reasons.category', 'category') ); } }