fix ProphecyTrait in AbstractFilter to use it with each filter

This commit is contained in:
Mathieu Jaumotte 2022-07-27 12:11:51 +02:00
parent 3dabd031f4
commit 8bbca12487
2 changed files with 6 additions and 5 deletions

View File

@ -13,6 +13,7 @@ namespace Chill\MainBundle\Test\Export;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Exception; use Exception;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use function count; use function count;
@ -27,14 +28,16 @@ use function is_string;
*/ */
abstract class AbstractFilterTest extends KernelTestCase abstract class AbstractFilterTest extends KernelTestCase
{ {
use ProphecyTrait;
/** /**
* @var \Prophecy\Prophet * @var \Prophecy\Prophet
*/ */
protected $prophet; private $prophet;
protected function setUp(): void protected function setUp(): void
{ {
$this->prepareProphet(); $$this->prophet = $this->getProphet();
} }
public function dataProviderAlterQuery() public function dataProviderAlterQuery()

View File

@ -14,11 +14,9 @@ class EmergencyFilterTest extends AbstractFilterTest
self::bootKernel(); self::bootKernel();
// add a fake request with a default locale (used in translatable string) // add a fake request with a default locale (used in translatable string)
$prophet = new \Prophecy\Prophet(); $request = $this->prophesize();
$request = $prophet->prophesize();
$request->willExtend(\Symfony\Component\HttpFoundation\Request::class); $request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn('fr'); $request->getLocale()->willReturn('fr');
$this->filter = self::$container->get('chill.person.export.filter_emergency'); $this->filter = self::$container->get('chill.person.export.filter_emergency');