activity export export tests

This commit is contained in:
Mathieu Jaumotte 2022-09-29 20:00:45 +02:00
parent 2b8fe462ea
commit f5fb721ddd
4 changed files with 74 additions and 36 deletions

View File

@ -0,0 +1,51 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToACP;
use Chill\ActivityBundle\Export\Export\LinkedToACP\CountActivity;
use Chill\MainBundle\Test\Export\AbstractExportTest;
/**
* @internal
* @coversNothing
*/
final class CountActivityTest extends AbstractExportTest
{
private CountActivity $export;
protected function setUp(): void
{
self::bootKernel();
$this->export = self::$container->get('chill.activity.export.count_activity_linked_to_acp');
}
public function getExport()
{
return $this->export;
}
public function getFormData(): array
{
return [
[],
];
}
public function getModifiersCombination(): array
{
return [
['activity'],
['activity', 'accompanying_period'],
];
}
}

View File

@ -9,8 +9,9 @@
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Export\Export;
namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToPerson;
use Chill\ActivityBundle\Export\Export\LinkedToPerson\CountActivity;
use Chill\MainBundle\Test\Export\AbstractExportTest;
/**
@ -19,19 +20,13 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
*/
final class CountActivityTest extends AbstractExportTest
{
/**
* @var
*/
private $export;
private CountActivity $export;
protected function setUp(): void
{
self::bootKernel();
/** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */
$container = self::$kernel->getContainer();
$this->export = $container->get('chill.activity.export.count_activity');
$this->export = self::$container->get('chill.activity.export.count_activity_linked_to_person');
}
public function getExport()
@ -39,14 +34,14 @@ final class CountActivityTest extends AbstractExportTest
return $this->export;
}
public function getFormData()
public function getFormData(): array
{
return [
[],
];
}
public function getModifiersCombination()
public function getModifiersCombination(): array
{
return [
['activity'],

View File

@ -9,9 +9,11 @@
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Export\Export;
namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToPerson;
use Chill\ActivityBundle\Export\Export\LinkedToPerson\ListActivity;
use Chill\MainBundle\Test\Export\AbstractExportTest;
use Prophecy\PhpUnit\ProphecyTrait;
/**
* @internal
@ -19,27 +21,22 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
*/
final class ListActivityTest extends AbstractExportTest
{
/**
* @var \Chill\ActivityBundle\Export\Export\ListActivity
*/
private $export;
use ProphecyTrait;
private ListActivity $export;
protected function setUp(): void
{
self::bootKernel();
/** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */
$container = self::$kernel->getContainer();
$this->export = self::$container->get('chill.activity.export.list_activity_linked_to_person');
$this->export = $container->get('chill.activity.export.list_activity');
$request = $this->prophesize()
->willExtend(\Symfony\Component\HttpFoundation\Request::class);
// 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')
self::$container->get('request_stack')
->push($request->reveal());
}

View File

@ -9,8 +9,9 @@
declare(strict_types=1);
namespace Chill\ActivityBundle\Tests\Export\Export;
namespace Chill\ActivityBundle\Tests\Export\Export\LinkedToPerson;
use Chill\ActivityBundle\Export\Export\LinkedToPerson\StatActivityDuration;
use Chill\MainBundle\Test\Export\AbstractExportTest;
/**
@ -19,21 +20,15 @@ use Chill\MainBundle\Test\Export\AbstractExportTest;
* @internal
* @coversNothing
*/
final class StatActivityDurationSumTest extends AbstractExportTest
final class StatActivityDurationTest extends AbstractExportTest
{
/**
* @var \Chill\ActivityBundle\Export\Export\StatActivityDuration
*/
private $export;
private StatActivityDuration $export;
protected function setUp(): void
{
self::bootKernel();
/** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */
$container = self::$kernel->getContainer();
$this->export = $container->get('chill.activity.export.sum_activity_duration');
$this->export = self::$container->get('chill.activity.export.sum_activity_duration_linked_to_person');
}
public function getExport()
@ -41,14 +36,14 @@ final class StatActivityDurationSumTest extends AbstractExportTest
return $this->export;
}
public function getFormData()
public function getFormData(): array
{
return [
[],
];
}
public function getModifiersCombination()
public function getModifiersCombination(): array
{
return [
['activity'],