mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
Update test methods to static in AbstractFilterTest
The methods getFormData() and getQueryBuilders() across multiple test classes have been updated to static methods. This refactoring is part of a broader effort to improve code structure and readability. A rector rule has been employed to assist in the systematic update of these existing methods.
This commit is contained in:
@@ -51,39 +51,32 @@ final class AgentFilterTest extends AbstractFilterTest
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): iterable
|
||||
public static function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(User::class, 'u')
|
||||
->select('u')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($array as $a) {
|
||||
yield [
|
||||
'accepted_agents' => $a,
|
||||
];
|
||||
}
|
||||
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): iterable
|
||||
public static function getQueryBuilders(): iterable
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
yield $em->createQueryBuilder()
|
||||
->select('cal.id')
|
||||
->from(Calendar::class, 'cal')
|
||||
;
|
||||
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ final class BetweenDatesFilterTest extends AbstractFilterTest
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
public static function getFormData(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
@@ -61,10 +61,9 @@ final class BetweenDatesFilterTest extends AbstractFilterTest
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
public static function getQueryBuilders(): iterable
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
|
@@ -52,11 +52,10 @@ final class JobFilterTest extends AbstractFilterTest
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): iterable
|
||||
public static function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(UserJob::class, 'uj')
|
||||
->select('uj')
|
||||
@@ -71,10 +70,9 @@ final class JobFilterTest extends AbstractFilterTest
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
public static function getQueryBuilders(): iterable
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
|
@@ -52,11 +52,10 @@ final class ScopeFilterTest extends AbstractFilterTest
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
public function getFormData(): array
|
||||
public static function getFormData(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
$array = $em->createQueryBuilder()
|
||||
->from(Scope::class, 's')
|
||||
->select('s')
|
||||
@@ -71,10 +70,9 @@ final class ScopeFilterTest extends AbstractFilterTest
|
||||
];
|
||||
}
|
||||
|
||||
public function getQueryBuilders(): array
|
||||
public static function getQueryBuilders(): iterable
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
|
||||
return [
|
||||
|
Reference in New Issue
Block a user