Merge branch 'fix-person-tests' into 139_demandeur

This commit is contained in:
Julien Fastré 2021-05-13 21:44:22 +02:00
commit 0e53a081c7
12 changed files with 20 additions and 39 deletions

View File

@ -18,11 +18,10 @@
<testsuite name="MainBundle">
<directory suffix="Test.php">src/Bundle/ChillMainBundle/Tests/</directory>
</testsuite>
<!--
<testsuite name="PersonBundle">
<directory suffix="Test.php">src/Bundle/ChillPersonBundle/Tests/</directory>
<exclude>src/Bundle/ChillPersonBundle/Tests/Export/*</exclude>
</testsuite>
-->
</testsuites>
<listeners>

View File

@ -172,6 +172,7 @@ abstract class AbstractExportTest extends WebTestCase
*/
public function testInitiateQuery($modifiers, $acl, $data)
{
var_dump($data);
$query = $this->getExport()->initiateQuery($modifiers, $acl, $data);
$this->assertTrue($query instanceof QueryBuilder || $query instanceof NativeQuery,

View File

@ -11,7 +11,7 @@ class PersonDuplicateControllerViewTest extends WebTestCase
{
static::bootKernel();
$this->em = static::$kernel->getContainer()
$this->em = static::$container
->get('doctrine.orm.entity_manager');
$center = $this->em->getRepository('ChillMainBundle:Center')

View File

@ -38,9 +38,7 @@ class AgeAggregatorTest extends AbstractAggregatorTest
{
static::bootKernel();
$container = static::$kernel->getContainer();
$this->aggregator = $container->get('chill.person.export.aggregator_age');
$this->aggregator = static::$container->get('chill.person.export.aggregator_age');
}
public function getAggregator()
@ -63,7 +61,7 @@ class AgeAggregatorTest extends AbstractAggregatorTest
static::bootKernel();
}
$em = static::$kernel->getContainer()
$em = static::$container
->get('doctrine.orm.entity_manager');
return array(

View File

@ -37,9 +37,7 @@ class GenderAggregatorTest extends AbstractAggregatorTest
{
static::bootKernel();
$container = static::$kernel->getContainer();
$this->aggregator = $container->get('chill.person.export.aggregator_gender');
$this->aggregator = static::$container->get('chill.person.export.aggregator_gender');
}
public function getAggregator()
@ -60,7 +58,7 @@ class GenderAggregatorTest extends AbstractAggregatorTest
static::bootKernel();
}
$em = static::$kernel->getContainer()
$em = static::$container
->get('doctrine.orm.entity_manager');
return array(

View File

@ -17,7 +17,6 @@
*/
namespace Chill\PersonBundle\Tests\Export\Aggregator;
require_once '/home/julien/dev/chill-dev/vendor/chill-project/main/Test/Export/AbstractAggregatorTest.php';
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
/**
@ -25,7 +24,7 @@ use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class NationalityAggregator extends AbstractAggregatorTest
class NationalityAggregatorTest extends AbstractAggregatorTest
{
/**
*
@ -37,9 +36,7 @@ class NationalityAggregator extends AbstractAggregatorTest
{
static::bootKernel();
$container = static::$kernel->getContainer();
$this->aggregator = $container->get('chill.person.export.aggregator_nationality');
$this->aggregator = static::$container->get('chill.person.export.aggregator_nationality');
}
public function getAggregator()
@ -61,7 +58,7 @@ class NationalityAggregator extends AbstractAggregatorTest
static::bootKernel();
}
$em = static::$kernel->getContainer()
$em = static::$container
->get('doctrine.orm.entity_manager');
return array(

View File

@ -36,10 +36,7 @@ class CountPersonTest extends AbstractExportTest
{
static::bootKernel();
/* @var $container \Symfony\Component\DependencyInjection\ContainerInterface */
$container = self::$kernel->getContainer();
$this->export = $container->get('chill.person.export.export_count_person');
$this->export = static::$container->get('chill.person.export.export_count_person');
}

View File

@ -40,10 +40,7 @@ class ListPersonTest extends AbstractExportTest
{
static::bootKernel();
/* @var $container \Symfony\Component\DependencyInjection\ContainerInterface */
$container = self::$kernel->getContainer();
$this->export = $container->get('chill.person.export.list_person');
$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;
@ -51,7 +48,7 @@ class ListPersonTest extends AbstractExportTest
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn('fr');
$container->get('request_stack')
static::$container->get('request_stack')
->push($request->reveal());
}

View File

@ -36,10 +36,8 @@ class AccompanyingPeriodFilterTest extends AbstractFilterTest
{
static::bootKernel();
$container = static::$kernel->getContainer();
try {
$this->filter = $container->get('chill.person.export.filter_accompanying_period');
$this->filter = static::$container->get('chill.person.export.filter_accompanying_period');
} catch (ServiceNotFoundException $e) {
$this->markTestSkipped("The current configuration does not use accompanying_periods");
}
@ -67,7 +65,7 @@ class AccompanyingPeriodFilterTest extends AbstractFilterTest
static::bootKernel();
}
$em = static::$kernel->getContainer()
$em = static::$container
->get('doctrine.orm.entity_manager');
return array(

View File

@ -36,9 +36,7 @@ class BirthdayFilterTest extends AbstractFilterTest
{
static::bootKernel();
$container = static::$kernel->getContainer();
$this->filter = $container->get('chill.person.export.filter_birthdate');
$this->filter = static::$container->get('chill.person.export.filter_birthdate');
}
@ -63,7 +61,7 @@ class BirthdayFilterTest extends AbstractFilterTest
static::bootKernel();
}
$em = static::$kernel->getContainer()
$em = static::$container
->get('doctrine.orm.entity_manager');
return array(

View File

@ -43,9 +43,7 @@ class GenderFilterTest extends AbstractFilterTest
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn('fr');
$container = static::$kernel->getContainer();
$this->filter = $container->get('chill.person.export.filter_gender');
$this->filter = static::$container->get('chill.person.export.filter_gender');
}
@ -75,7 +73,7 @@ class GenderFilterTest extends AbstractFilterTest
static::bootKernel();
}
$em = static::$kernel->getContainer()
$em = static::$container
->get('doctrine.orm.entity_manager');
return array(

View File

@ -60,7 +60,7 @@ class PersonVoterTest extends KernelTestCase
public function setUp()
{
static::bootKernel();
$this->voter = static::$kernel->getContainer()
$this->voter = static::$container
->get('chill.person.security.authorization.person');
$this->prophet = new \Prophecy\Prophet();
}