From 07615192c67e2bd6d47e69069ae8d407301ac084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sun, 7 Dec 2014 00:19:50 +0100 Subject: [PATCH] first test for "add a person" page (to be continued) --- Tests/Controller/PersonControllerTest.php | 32 +++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/Tests/Controller/PersonControllerTest.php b/Tests/Controller/PersonControllerTest.php index 0154ce5d8..9a79911d5 100644 --- a/Tests/Controller/PersonControllerTest.php +++ b/Tests/Controller/PersonControllerTest.php @@ -4,11 +4,39 @@ namespace Chill\PersonBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +/** + * Test creation and deletion for persons + */ class PersonControllerTest extends WebTestCase { - public function testFoo() + /** + * Test the "add a person" page + * + * see https://redmine.champs-libres.coop/projects/chillperson/wiki/Test_plan_for_page_%22add_a_person%22 + */ + public function testAddAPersonPage() { - + $client = static::createClient(array(), array( + 'PHP_AUTH_USER' => 'center a_social', + 'PHP_AUTH_PW' => 'password', + )); + + $crawler = $client->request('GET', '/fr/person/new'); + + $this->assertTrue($client->getResponse()->isSuccessful(), + "The page is accessible at the URL /{_locale}/person/new"); + $form = $crawler->selectButton("Ajouter la personne")->form(); + + $this->assertTrue($form->has('chill_personbundle_person_creation[firstName]'), + 'The page contains a "firstname" input'); + $this->assertTRue($form->has("chill_personbundle_person_creation[lastName]"), + 'The page contains a "lastname" input'); + $this->assertTrue($form->has("chill_personbundle_person_creation[genre]"), + 'The page contains a "gender" input'); + $this->assertTrue($form->has("chill_personbundle_person_creation[dateOfBirth]"), + 'The page has a "date of birth" input'); + + } }