add test for choose languages

fix #409
This commit is contained in:
Julien Fastré 2015-01-30 18:14:27 +01:00
parent 72182a8c77
commit aa8d211e55

View File

@ -134,6 +134,30 @@ class PersonControllerUpdateTest extends WebTestCase
'the value '.$field.' is updated in db');
}
public function testEditLanguages()
{
$crawler = $this->client->request('GET', $this->editUrl);
$selectedLanguages = array('en', 'an', 'bbj');
$form = $crawler->selectButton('Submit')
->form();
$form->get('chill_personbundle_person[spokenLanguages]')
->setValue($selectedLanguages);
$this->client->submit($form);
$this->em->refresh($this->person);
$this->assertTrue($this->client->getResponse()->isRedirect($this->seeUrl),
'the page is redirected to /general view');
//retrieve languages codes present in person
foreach($this->person->getSpokenLanguages() as $lang){
$languagesCodesPresents[] = $lang->getId();
}
$this->assertEquals(asort($selectedLanguages), asort($languagesCodesPresents),
'the person speaks the expected languages');
}
/**
*