mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-04-04 20:13:42 +00:00
fix cs
This commit is contained in:
@@ -40,6 +40,19 @@ final class RelationshipApiControllerTest extends WebTestCase
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider personProvider
|
||||
*/
|
||||
public function testGetRelationshipByPerson(int $personId)
|
||||
{
|
||||
self::ensureKernelShutdown();
|
||||
$client = $this->getClientAuthenticated();
|
||||
$client->request(Request::METHOD_GET, sprintf('/api/1.0/relations/relationship/by-person/%d.json', $personId));
|
||||
|
||||
$response = $client->getResponse();
|
||||
$this->assertEquals(200, $response->getStatusCode(), 'Test to see that API response returns a status code 200');
|
||||
}
|
||||
|
||||
public static function personProvider(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
@@ -75,42 +88,6 @@ final class RelationshipApiControllerTest extends WebTestCase
|
||||
];
|
||||
}
|
||||
|
||||
public static function relationProvider(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
$personIdWithoutRelations = $em->createQueryBuilder()
|
||||
->select('p.id')
|
||||
->from(Person::class, 'p')
|
||||
->join('p.centerCurrent', 'center_current')
|
||||
->join('center_current.center', 'c')
|
||||
->where('c.name LIKE :name')
|
||||
->andWhere('NOT EXISTS (SELECT 1 FROM '.Relationship::class.' r WHERE r.fromPerson = p OR r.toPerson = p)')
|
||||
->setParameter('name', 'Center A')
|
||||
->getQuery()
|
||||
->setMaxResults(2)
|
||||
->getResult();
|
||||
|
||||
self::ensureKernelShutdown();
|
||||
|
||||
return [
|
||||
[$personIdWithoutRelations[0]['id'], $personIdWithoutRelations[1]['id'], self::getRandomRelation($em)->getId(), true],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider personProvider
|
||||
*/
|
||||
public function testGetRelationshipByPerson(int $personId)
|
||||
{
|
||||
self::ensureKernelShutdown();
|
||||
$client = $this->getClientAuthenticated();
|
||||
$client->request(Request::METHOD_GET, sprintf('/api/1.0/relations/relationship/by-person/%d.json', $personId));
|
||||
|
||||
$response = $client->getResponse();
|
||||
$this->assertEquals(200, $response->getStatusCode(), 'Test to see that API response returns a status code 200');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider relationProvider
|
||||
*/
|
||||
@@ -137,6 +114,29 @@ final class RelationshipApiControllerTest extends WebTestCase
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
}
|
||||
|
||||
public static function relationProvider(): array
|
||||
{
|
||||
self::bootKernel();
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
$personIdWithoutRelations = $em->createQueryBuilder()
|
||||
->select('p.id')
|
||||
->from(Person::class, 'p')
|
||||
->join('p.centerCurrent', 'center_current')
|
||||
->join('center_current.center', 'c')
|
||||
->where('c.name LIKE :name')
|
||||
->andWhere('NOT EXISTS (SELECT 1 FROM '.Relationship::class.' r WHERE r.fromPerson = p OR r.toPerson = p)')
|
||||
->setParameter('name', 'Center A')
|
||||
->getQuery()
|
||||
->setMaxResults(2)
|
||||
->getResult();
|
||||
|
||||
self::ensureKernelShutdown();
|
||||
|
||||
return [
|
||||
[$personIdWithoutRelations[0]['id'], $personIdWithoutRelations[1]['id'], self::getRandomRelation($em)->getId(), true],
|
||||
];
|
||||
}
|
||||
|
||||
private static function getRandomRelation(EntityManagerInterface $em): Relation
|
||||
{
|
||||
if (null === self::$relations) {
|
||||
|
||||
Reference in New Issue
Block a user