mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Make data providers static on AbstractExportTest.php and Write a rector rule to adapt existing
This commit is contained in:
@@ -31,9 +31,9 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
{
|
||||
use PrepareClientTrait;
|
||||
|
||||
public function dataProviderGetQueryKeys()
|
||||
public static function dataProviderGetQueryKeys()
|
||||
{
|
||||
foreach ($this->getFormData() as $data) {
|
||||
foreach (static::getFormData() as $data) {
|
||||
yield [$data];
|
||||
}
|
||||
}
|
||||
@@ -41,12 +41,12 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
/**
|
||||
* create data for `ìnitiateQuery` method.
|
||||
*/
|
||||
public function dataProviderInitiateQuery()
|
||||
public static function dataProviderInitiateQuery()
|
||||
{
|
||||
$acl = $this->getAcl();
|
||||
$acl = static::getAcl();
|
||||
|
||||
foreach ($this->getModifiersCombination() as $modifiers) {
|
||||
foreach ($this->getFormData() as $data) {
|
||||
foreach (static::getModifiersCombination() as $modifiers) {
|
||||
foreach (static::getFormData() as $data) {
|
||||
yield [$modifiers, $acl, $data];
|
||||
}
|
||||
}
|
||||
@@ -67,13 +67,13 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
public function getACL()
|
||||
public static function getACL()
|
||||
{
|
||||
if (null === static::$kernel) {
|
||||
static::bootKernel();
|
||||
}
|
||||
|
||||
$em = static::$container->get(EntityManagerInterface::class);
|
||||
$em = static::getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$centers = $em->getRepository(\Chill\MainBundle\Entity\Center::class)
|
||||
->findAll();
|
||||
@@ -109,16 +109,16 @@ abstract class AbstractExportTest extends WebTestCase
|
||||
*
|
||||
* @return array an array of data. Example : `array( array(), array('fields' => array(1,2,3), ...)` where an empty array and `array(1,2,3)` are possible values
|
||||
*/
|
||||
abstract public function getFormData();
|
||||
abstract public static function getFormData(): array;
|
||||
|
||||
/**
|
||||
* get the possible modifiers which could apply in combination to this
|
||||
* export.
|
||||
* .
|
||||
*
|
||||
* @return array of string[] an array which contains an array of possible modifiers. Example : `array( array('modifier_1', 'modifier_2'), array('modifier_1'), ...)`
|
||||
* @return list<list<string>> of string[] an array which contains an array of possible modifiers. Example : `array( array('modifier_1', 'modifier_2'), array('modifier_1'), ...)`
|
||||
*/
|
||||
abstract public function getModifiersCombination();
|
||||
abstract public static function getModifiersCombination(): array;
|
||||
|
||||
protected function getParameters(bool $filterStatsByCenter): ParameterBagInterface
|
||||
{
|
||||
|
Reference in New Issue
Block a user