mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,74 +1,62 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2017 Champs-Libres <info@champs-libres.coop>
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class AgeAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var \Chill\PersonBundle\Export\Aggregator\AgeAggregator
|
||||
*/
|
||||
private $aggregator;
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
static::bootKernel();
|
||||
|
||||
$this->aggregator = static::$container->get('chill.person.export.aggregator_age');
|
||||
|
||||
$this->aggregator = static::$container->get('chill.person.export.aggregator_age');
|
||||
}
|
||||
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'date_age_calculation' => \DateTime::createFromFormat('Y-m-d','2016-06-16')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getQueryBuilders()
|
||||
{
|
||||
if (static::$kernel === null) {
|
||||
static::bootKernel();
|
||||
}
|
||||
|
||||
$em = static::$container
|
||||
->get('doctrine.orm.entity_manager');
|
||||
|
||||
return array(
|
||||
$em->createQueryBuilder()
|
||||
->select('count(person.id)')
|
||||
->from('ChillPersonBundle:Person', 'person')
|
||||
);
|
||||
return [
|
||||
[
|
||||
'date_age_calculation' => DateTime::createFromFormat('Y-m-d', '2016-06-16'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders()
|
||||
{
|
||||
if (null === static::$kernel) {
|
||||
static::bootKernel();
|
||||
}
|
||||
|
||||
$em = static::$container
|
||||
->get('doctrine.orm.entity_manager');
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(person.id)')
|
||||
->from('ChillPersonBundle:Person', 'person'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -1,70 +1,59 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2017 Champs Libres Cooperative <info@champs-libres.coop>
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class GenderAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var \Chill\PersonBundle\Export\Aggregator\GenderAggregator
|
||||
*/
|
||||
private $aggregator;
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
static::bootKernel();
|
||||
|
||||
$this->aggregator = static::$container->get('chill.person.export.aggregator_gender');
|
||||
|
||||
$this->aggregator = static::$container->get('chill.person.export.aggregator_gender');
|
||||
}
|
||||
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
return array(
|
||||
array()
|
||||
);
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function getQueryBuilders()
|
||||
{
|
||||
if (static::$kernel === null) {
|
||||
if (null === static::$kernel) {
|
||||
static::bootKernel();
|
||||
}
|
||||
|
||||
|
||||
$em = static::$container
|
||||
->get('doctrine.orm.entity_manager');
|
||||
|
||||
return array(
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(person.id)')
|
||||
->from('ChillPersonBundle:Person', 'person')
|
||||
);
|
||||
->from('ChillPersonBundle:Person', 'person'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -1,70 +1,60 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2017 Champs Libres Cooperative <info@champs-libres.coop>
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Aggregator;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class NationalityAggregatorTest extends AbstractAggregatorTest
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var \Chill\PersonBundle\Export\Aggregator\NationalityAggregator
|
||||
*/
|
||||
private $aggregator;
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
static::bootKernel();
|
||||
|
||||
$this->aggregator = static::$container->get('chill.person.export.aggregator_nationality');
|
||||
|
||||
$this->aggregator = static::$container->get('chill.person.export.aggregator_nationality');
|
||||
}
|
||||
|
||||
|
||||
public function getAggregator()
|
||||
{
|
||||
return $this->aggregator;
|
||||
}
|
||||
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
return array(
|
||||
array('group_by_level' => 'country'),
|
||||
array('group_by_level' => 'continent')
|
||||
);
|
||||
return [
|
||||
['group_by_level' => 'country'],
|
||||
['group_by_level' => 'continent'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function getQueryBuilders()
|
||||
{
|
||||
if (static::$kernel === null) {
|
||||
if (null === static::$kernel) {
|
||||
static::bootKernel();
|
||||
}
|
||||
|
||||
|
||||
$em = static::$container
|
||||
->get('doctrine.orm.entity_manager');
|
||||
|
||||
return array(
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('count(person.id)')
|
||||
->from('ChillPersonBundle:Person', 'person')
|
||||
);
|
||||
->from('ChillPersonBundle:Person', 'person'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -1,45 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2016 Champs Libres Cooperative <info@champs-libres.coop>
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Export;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||
|
||||
/**
|
||||
* Test CountPerson export
|
||||
* Test CountPerson export.
|
||||
*
|
||||
* @author julien.fastre@champs-libres.coop
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class CountPersonTest extends AbstractExportTest
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var
|
||||
* @var
|
||||
*/
|
||||
private $export;
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
static::bootKernel();
|
||||
|
||||
|
||||
$this->export = static::$container->get('chill.person.export.export_count_person');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getExport()
|
||||
{
|
||||
return $this->export;
|
||||
@@ -47,13 +38,13 @@ class CountPersonTest extends AbstractExportTest
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
return array(
|
||||
array()
|
||||
);
|
||||
return [
|
||||
[],
|
||||
];
|
||||
}
|
||||
|
||||
public function getModifiersCombination()
|
||||
{
|
||||
return array( [ 'person' ] );
|
||||
return [['person']];
|
||||
}
|
||||
}
|
||||
|
@@ -1,61 +1,47 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2016 Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Export;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||
use Chill\PersonBundle\Export\Export\ListPerson;
|
||||
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* Test the export "ListPerson"
|
||||
* Test the export "ListPerson".
|
||||
*
|
||||
* @author julien.fastre@champs-libres.coop
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class ListPersonTest extends AbstractExportTest
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var ListPerson
|
||||
* @var ListPerson
|
||||
*/
|
||||
private $export;
|
||||
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
static::bootKernel();
|
||||
|
||||
static::bootKernel();
|
||||
|
||||
$this->export = static::$container->get('chill.person.export.list_person');
|
||||
|
||||
|
||||
// add a fake request with a default locale (used in translatable string)
|
||||
$prophet = new \Prophecy\Prophet;
|
||||
$prophet = new \Prophecy\Prophet();
|
||||
$request = $prophet->prophesize();
|
||||
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||
$request->getLocale()->willReturn('fr');
|
||||
|
||||
|
||||
static::$container->get('request_stack')
|
||||
->push($request->reveal());
|
||||
->push($request->reveal());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
public function getExport()
|
||||
{
|
||||
return $this->export;
|
||||
@@ -63,26 +49,24 @@ class ListPersonTest extends AbstractExportTest
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
return array(
|
||||
array('fields' => ['id', 'firstName', 'lastName']),
|
||||
array('fields' => ['id', 'birthdate', 'gender', 'memo', 'email', 'phonenumber']),
|
||||
array('fields' => ['firstName', 'lastName', 'phonenumber']),
|
||||
array('fields' => ['id', 'nationality']),
|
||||
array('fields' => ['id', 'countryOfBirth']),
|
||||
array('fields' => ['id', 'address_street_address_1',
|
||||
'address_street_address_2', 'address_valid_from',
|
||||
'address_postcode_label', 'address_postcode_code',
|
||||
'address_country_name', 'address_country_code'],
|
||||
'address_date' => \DateTime::createFromFormat('Y-m-d', '2016-06-12'))
|
||||
);
|
||||
return [
|
||||
['fields' => ['id', 'firstName', 'lastName']],
|
||||
['fields' => ['id', 'birthdate', 'gender', 'memo', 'email', 'phonenumber']],
|
||||
['fields' => ['firstName', 'lastName', 'phonenumber']],
|
||||
['fields' => ['id', 'nationality']],
|
||||
['fields' => ['id', 'countryOfBirth']],
|
||||
['fields' => ['id', 'address_street_address_1',
|
||||
'address_street_address_2', 'address_valid_from',
|
||||
'address_postcode_label', 'address_postcode_code',
|
||||
'address_country_name', 'address_country_code', ],
|
||||
'address_date' => DateTime::createFromFormat('Y-m-d', '2016-06-12'), ],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function getModifiersCombination()
|
||||
{
|
||||
return array(
|
||||
array('person')
|
||||
);
|
||||
return [
|
||||
['person'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,49 +1,40 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2017 Champs Libres Cooperative <info@champs-libres.coop>
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use DateTime;
|
||||
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class AccompanyingPeriodFilterTest extends AbstractFilterTest
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var \Chill\PersonBundle\Export\Filter\BirthdateFilter
|
||||
*/
|
||||
private $filter;
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
static::bootKernel();
|
||||
|
||||
|
||||
try {
|
||||
$this->filter = static::$container->get('chill.person.export.filter_accompanying_period');
|
||||
} catch (ServiceNotFoundException $e) {
|
||||
$this->markTestSkipped("The current configuration does not use accompanying_periods");
|
||||
} catch (ServiceNotFoundException $e) {
|
||||
$this->markTestSkipped('The current configuration does not use accompanying_periods');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
@@ -51,24 +42,24 @@ class AccompanyingPeriodFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'date_from' => \DateTime::createFromFormat('Y-m-d', '2000-01-01'),
|
||||
'date_to' => \DateTime::createFromFormat('Y-m-d', '2010-01-01')
|
||||
)
|
||||
);
|
||||
return [
|
||||
[
|
||||
'date_from' => DateTime::createFromFormat('Y-m-d', '2000-01-01'),
|
||||
'date_to' => DateTime::createFromFormat('Y-m-d', '2010-01-01'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders()
|
||||
{
|
||||
if (static::$kernel === null) {
|
||||
if (null === static::$kernel) {
|
||||
static::bootKernel();
|
||||
}
|
||||
|
||||
|
||||
$em = static::$container
|
||||
->get('doctrine.orm.entity_manager');
|
||||
|
||||
return array(
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('person.firstName')
|
||||
->from('ChillPersonBundle:Person', 'person'),
|
||||
@@ -91,9 +82,9 @@ class AccompanyingPeriodFilterTest extends AbstractFilterTest
|
||||
$em->createQueryBuilder()
|
||||
->select('activity.date AS date')
|
||||
->select('activity.attendee as attendee')
|
||||
->from("ChillActivityBundle:Activity", 'activity')
|
||||
->from('ChillActivityBundle:Activity', 'activity')
|
||||
->join('activity.person', 'person')
|
||||
->join('person.center', 'center')
|
||||
);
|
||||
->join('person.center', 'center'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -1,45 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2017 Champs Libres Cooperative <info@champs-libres.coop>
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class BirthdayFilterTest extends AbstractFilterTest
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var \Chill\PersonBundle\Export\Filter\BirthdateFilter
|
||||
*/
|
||||
private $filter;
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
static::bootKernel();
|
||||
|
||||
$this->filter = static::$container->get('chill.person.export.filter_birthdate');
|
||||
|
||||
$this->filter = static::$container->get('chill.person.export.filter_birthdate');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
@@ -47,24 +37,24 @@ class BirthdayFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'date_from' => \DateTime::createFromFormat('Y-m-d', '2000-01-01'),
|
||||
'date_to' => \DateTime::createFromFormat('Y-m-d', '2010-01-01')
|
||||
)
|
||||
);
|
||||
return [
|
||||
[
|
||||
'date_from' => DateTime::createFromFormat('Y-m-d', '2000-01-01'),
|
||||
'date_to' => DateTime::createFromFormat('Y-m-d', '2010-01-01'),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders()
|
||||
{
|
||||
if (static::$kernel === null) {
|
||||
if (null === static::$kernel) {
|
||||
static::bootKernel();
|
||||
}
|
||||
|
||||
|
||||
$em = static::$container
|
||||
->get('doctrine.orm.entity_manager');
|
||||
|
||||
return array(
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('p.firstName')
|
||||
->from('ChillPersonBundle:Person', 'p'),
|
||||
@@ -77,7 +67,7 @@ class BirthdayFilterTest extends AbstractFilterTest
|
||||
->select('count(IDENTITY(p))')
|
||||
->from('ChillPersonBundle:Person', 'p')
|
||||
// add a dummy where clause
|
||||
->where('p.firstname IS NOT NULL')
|
||||
);
|
||||
->where('p.firstname IS NOT NULL'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -1,52 +1,41 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2016 Champs Libres Cooperative <info@champs-libres.coop>
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Filter;
|
||||
|
||||
use Chill\MainBundle\Test\Export\AbstractFilterTest;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class GenderFilterTest extends AbstractFilterTest
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var \Chill\PersonBundle\Export\Filter\GenderFilter
|
||||
*/
|
||||
private $filter;
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
static::bootKernel();
|
||||
|
||||
|
||||
// add a fake request with a default locale (used in translatable string)
|
||||
$prophet = new \Prophecy\Prophet;
|
||||
$prophet = new \Prophecy\Prophet();
|
||||
$request = $prophet->prophesize();
|
||||
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
|
||||
$request->getLocale()->willReturn('fr');
|
||||
|
||||
$this->filter = static::$container->get('chill.person.export.filter_gender');
|
||||
|
||||
$this->filter = static::$container->get('chill.person.export.filter_gender');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
@@ -54,32 +43,32 @@ class GenderFilterTest extends AbstractFilterTest
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'accepted_genders' => [ Person::FEMALE_GENDER ]
|
||||
),
|
||||
array(
|
||||
'accepted_genders' => [ Person::MALE_GENDER ]
|
||||
),
|
||||
array(
|
||||
'accepted_genders' => [ Person::MALE_GENDER, Person::BOTH_GENDER ]
|
||||
)
|
||||
);
|
||||
return [
|
||||
[
|
||||
'accepted_genders' => [Person::FEMALE_GENDER],
|
||||
],
|
||||
[
|
||||
'accepted_genders' => [Person::MALE_GENDER],
|
||||
],
|
||||
[
|
||||
'accepted_genders' => [Person::MALE_GENDER, Person::BOTH_GENDER],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders()
|
||||
{
|
||||
if (static::$kernel === null) {
|
||||
if (null === static::$kernel) {
|
||||
static::bootKernel();
|
||||
}
|
||||
|
||||
|
||||
$em = static::$container
|
||||
->get('doctrine.orm.entity_manager');
|
||||
|
||||
return array(
|
||||
|
||||
return [
|
||||
$em->createQueryBuilder()
|
||||
->select('p.firstName')
|
||||
->from('ChillPersonBundle:Person', 'p')
|
||||
);
|
||||
->from('ChillPersonBundle:Person', 'p'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user