This commit is contained in:
2025-06-20 17:31:13 +02:00
parent 9158e33854
commit a38116cca4
65 changed files with 2298 additions and 2298 deletions

View File

@@ -31,6 +31,22 @@ final class AgeTest extends KernelTestCase
$this->entityManager = self::getContainer()->get(EntityManagerInterface::class);
}
/**
* @dataProvider generateQueries
*/
public function testWorking(string $dql, array $args)
{
$dql = $this->entityManager->createQuery($dql)->setMaxResults(3);
foreach ($args as $key => $value) {
$dql->setParameter($key, $value);
}
$results = $dql->getResult();
$this->assertIsArray($results);
}
public static function generateQueries(): iterable
{
yield [
@@ -60,20 +76,4 @@ final class AgeTest extends KernelTestCase
],
];
}
/**
* @dataProvider generateQueries
*/
public function testWorking(string $dql, array $args)
{
$dql = $this->entityManager->createQuery($dql)->setMaxResults(3);
foreach ($args as $key => $value) {
$dql->setParameter($key, $value);
}
$results = $dql->getResult();
$this->assertIsArray($results);
}
}

View File

@@ -31,13 +31,6 @@ final class JsonExtractTest extends KernelTestCase
$this->em = self::getContainer()->get(EntityManagerInterface::class);
}
public static function dataGenerateDql(): iterable
{
yield ['SELECT JSON_EXTRACT(c.name, \'fr\') FROM '.Country::class.' c', []];
yield ['SELECT JSON_EXTRACT(c.name, :lang) FROM '.Country::class.' c', ['lang' => 'fr']];
}
/**
* @dataProvider dataGenerateDql
*/
@@ -50,4 +43,11 @@ final class JsonExtractTest extends KernelTestCase
$this->assertIsArray($results, 'simply test that the query return a result');
}
public static function dataGenerateDql(): iterable
{
yield ['SELECT JSON_EXTRACT(c.name, \'fr\') FROM '.Country::class.' c', []];
yield ['SELECT JSON_EXTRACT(c.name, :lang) FROM '.Country::class.' c', ['lang' => 'fr']];
}
}