[feature] allow to edit multiple participations at once

ref #7
This commit is contained in:
2016-04-12 22:40:11 +02:00
parent c1b9069138
commit 78c53fe7b0
6 changed files with 220 additions and 3 deletions

View File

@@ -341,7 +341,7 @@ class ParticipationControllerTest extends WebTestCase
$this->assertEquals($nbParticipations + 2, $event->getParticipations()->count());
}
public function testMultipleWithAllPeopleParticipating()
public function testNewMultipleWithAllPeopleParticipating()
{
$event = $this->getRandomEventWithMultipleParticipations();
@@ -359,7 +359,7 @@ class ParticipationControllerTest extends WebTestCase
"test that /fr/event/participation/new is redirecting");
}
public function testMultipleWithSomePeopleParticipating()
public function testNewMultipleWithSomePeopleParticipating()
{
$event = $this->getRandomEventWithMultipleParticipations();
// record the number of participation for the event (used later in this test)
@@ -419,5 +419,30 @@ class ParticipationControllerTest extends WebTestCase
"Test we have persisted a new participation associated to the test");
}
public function testEditMultipleAction()
{
/* @var $event \Chill\EventBundle\Entity\Event */
$event = $this->getRandomEventWithMultipleParticipations();
$crawler = $this->client->request('GET', '/fr/event/participation/'.$event->getId().
'/edit_multiple');
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
$button = $crawler->selectButton('Mettre à jour');
$this->assertEquals(1, $button->count(), "test the form with button 'mettre à jour' exists ");
$this->client->submit($button->form(), array(
'form[participations][0][role]' => $event->getType()->getRoles()->first()->getId(),
'form[participations][0][status]' => $event->getType()->getStatuses()->first()->getId(),
'form[participations][1][role]' => $event->getType()->getRoles()->last()->getId(),
'form[participations][1][status]' => $event->getType()->getStatuses()->last()->getId(),
));
$this->assertTrue($this->client->getResponse()
->isRedirect('/fr/event/event/'.$event->getId().'/show'));
}
}