simplify test for better balance resilience / utility

This commit is contained in:
Julien Fastré 2021-08-17 17:52:40 +02:00
parent afb2a92997
commit 5224a26e57

View File

@ -27,7 +27,7 @@ use Doctrine\ORM\EntityManagerInterface;
use Chill\MainBundle\Test\PrepareClientTrait;
/**
* This class tests entries are shown for closing and opening
* This class tests entries are shown for closing and opening
* periods in timeline.
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
@ -40,22 +40,19 @@ class TimelineAccompanyingPeriodTest extends WebTestCase
/**
* @dataProvider provideDataPersonWithAccompanyingPeriod
*/
public function testEntriesAreShown($personId)
public function testEntriesAreShown($personId)
{
$client = $this->getClientAuthenticated();
$crawler = $client->request('GET', "/en/person/{$personId}/timeline");
$this->assertTrue($client->getResponse()->isSuccessful(),
"the timeline page loads sucessfully");
$this->assertGreaterThan(0, $crawler->filter('.timeline div')->count(),
"the timeline page contains multiple div inside a .timeline element");
$this->assertContains(" Une période d'accompagnement est ouverte",
$this->assertContains("est ouvert",
$crawler->filter('.timeline')->text(),
"the text 'une période d'accompagnement a été ouverte' is present");
$this->assertContains("Une periode d'accompagnement se clôture",
$crawler->Filter('.timeline')->text(),
"the text 'Une période d'accompagnement a été fermée' is present");
"the text 'est ouvert' is present");
}
public function provideDataPersonWithAccompanyingPeriod()
@ -71,8 +68,7 @@ class TimelineAccompanyingPeriodTest extends WebTestCase
->join('part.accompanyingPeriod', 'period')
->join('p.center', 'center')
->select('p.id')
->where($qb->expr()->isNotNull('period.closingDate'))
->andWhere($qb->expr()->eq('center.name', ':center'))
->where($qb->expr()->eq('center.name', ':center'))
->setParameter('center', 'Center A')
->setMaxResults(1000)
->getQuery()
@ -86,5 +82,5 @@ class TimelineAccompanyingPeriodTest extends WebTestCase
yield [ \array_pop($personIds)['id'] ];
}
}