mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
tests written and working
This commit is contained in:
parent
d58c0efae9
commit
d248d7e8af
@ -4,6 +4,8 @@ namespace Chill\AsideActivityBundle\Tests\Controller;
|
||||
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Chill\AsideActivityBundle\Entity\AsideActivity;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
|
||||
class AccompanyingCourseControllerTest extends WebTestCase
|
||||
@ -17,11 +19,55 @@ class AccompanyingCourseControllerTest extends WebTestCase
|
||||
$this->client = $this->getClientAuthenticated();
|
||||
}
|
||||
|
||||
public function testNewWithoutUsers()
|
||||
public function testIndexWithoutUsers()
|
||||
{
|
||||
$this->client->request('GET', '/fr/asideactivity');
|
||||
|
||||
$this->assertResponseSuccessful();
|
||||
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
public function testNewWithoutUsers()
|
||||
{
|
||||
$this->client->request('GET', '/fr/asideactivity/new');
|
||||
|
||||
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider generateAsideActivityId
|
||||
*/
|
||||
|
||||
public function testEditWithoutUsers(int $asideActivityId)
|
||||
{
|
||||
$this->client->request('GET', "/fr/asideactivity/{$asideActivityId}/edit");
|
||||
|
||||
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
public function generateAsideActivityId()
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$qb = self::$container->get(EntityManagerInterface::class)
|
||||
->createQueryBuilder();
|
||||
|
||||
$asideActivityIds = $qb
|
||||
->select('DISTINCT asideactivity.id')
|
||||
->from(AsideActivity::class, 'asideactivity')
|
||||
->innerJoin('asideactivity.agent', 'agent')
|
||||
->where($qb->expr()->eq('agent.username', ':center_name'))
|
||||
->setParameter('center_name', 'center a_social')
|
||||
->setMaxResults(100)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
|
||||
\shuffle($asideActivityIds);
|
||||
|
||||
yield [ \array_pop($asideActivityIds)['id'] ];
|
||||
yield [ \array_pop($asideActivityIds)['id'] ];
|
||||
yield [ \array_pop($asideActivityIds)['id'] ];
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user