From ee9026f607953913a612a8b713c21d1e80d2cf8c Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@git-test.afi-sa.fr> Date: Wed, 25 Apr 2012 16:06:17 +0000 Subject: [PATCH] Users: ajout colonnes adresse, code postal, ville --- .../admin/controllers/UsersController.php | 5 +- .../admin/views/scripts/users/_form.phtml | 12 ++++ library/Class/Users.php | 5 +- .../admin/controllers/UsersControllerTest.php | 63 +++++++++++++++++-- 4 files changed, 77 insertions(+), 8 deletions(-) diff --git a/application/modules/admin/controllers/UsersController.php b/application/modules/admin/controllers/UsersController.php index dfdd908f834..86532b36ebb 100644 --- a/application/modules/admin/controllers/UsersController.php +++ b/application/modules/admin/controllers/UsersController.php @@ -129,7 +129,10 @@ class Admin_UsersController extends Zend_Controller_Action ->setIdSite($data['bib']) ->setIdabon($data['id_abon']) ->setOrdreabon($data['ordre']) - ->setTelephone($data['telephone']); + ->setTelephone($data['telephone']) + ->setAdresse($data['adresse']) + ->setVille($data['ville']) + ->setCodePostal($data['code_postal']); try { if ($user->save()) diff --git a/application/modules/admin/views/scripts/users/_form.phtml b/application/modules/admin/views/scripts/users/_form.phtml index 2ef753491b5..f4f62cf249a 100644 --- a/application/modules/admin/views/scripts/users/_form.phtml +++ b/application/modules/admin/views/scripts/users/_form.phtml @@ -66,6 +66,18 @@ <td class="droite">Téléphone </td> <td class="gauche"><input type="text" name="telephone" size="50" value="<?php echo $this->escape($this->user->getTelephone());?>"/></td> </tr> + <tr> + <td class="droite">Adresse </td> + <td class="gauche"><textarea name="adresse" rows="5"><?php echo $this->escape($this->user->getAdresse());?></textarea></td> + </tr> + <tr> + <td class="droite">Code postal </td> + <td class="gauche"><input type="text" name="code_postal" size="10" value="<?php echo $this->escape($this->user->getCodePostal());?>"/></td> + </tr> + <tr> + <td class="droite">Ville </td> + <td class="gauche"><input type="text" name="ville" size="50" value="<?php echo $this->escape($this->user->getVille());?>"/></td> + </tr> </table> </fieldset> diff --git a/library/Class/Users.php b/library/Class/Users.php index 7012967ab48..1a3b2084923 100644 --- a/library/Class/Users.php +++ b/library/Class/Users.php @@ -165,7 +165,10 @@ class Class_Users extends Storm_Model_Abstract { 'telephone' => '', 'mail' => '', 'nom' => '', - 'prenom' => '' + 'prenom' => '', + 'adresse' => '', + 'code_postal' => '', + 'ville' => '' ); protected $_translate; diff --git a/tests/application/modules/admin/controllers/UsersControllerTest.php b/tests/application/modules/admin/controllers/UsersControllerTest.php index 83b839e38b1..868fc779d0f 100644 --- a/tests/application/modules/admin/controllers/UsersControllerTest.php +++ b/tests/application/modules/admin/controllers/UsersControllerTest.php @@ -38,7 +38,11 @@ abstract class UsersControllerWithMarcusTestCase extends AbstractControllerTestC ->setIdabon('00123') ->setOrdreabon(1) ->setDateDebut('19-07-2009') - ->setDateFin('19-07-2010'); + ->setDateFin('19-07-2010') + ->setTelephone('01 23 45 67 89') + ->setAdresse('34 avenue Funk') + ->setCodePostal('99000') + ->setVille('Jazz City'); $this->assertTrue($this->marcus->isValid()); @@ -93,6 +97,22 @@ class UsersControllerEditMarcusTest extends UsersControllerWithMarcusTestCase { $this->assertXPath("//input[@name='mail'][@value='marcus@gmail.com']"); } + public function testTelephoneIs0123456789() { + $this->assertXPath("//input[@name='telephone'][@value='01 23 45 67 89']"); + } + + public function testAdresseIs34avenueFunk() { + $this->assertXPathContentContains("//textarea[@name='adresse']", '34 avenue Funk'); + } + + public function testCodePostalIs99000() { + $this->assertXPath("//input[@name='code_postal'][@value='99000']"); + } + + public function testVilleIsJazzCity() { + $this->assertXPath("//input[@name='ville'][@value='Jazz City']"); + } + public function testNumeroCarteIs00123() { $this->assertXPath("//input[@name='id_abon'][@value='00123']"); } @@ -153,7 +173,10 @@ class UsersControllerPostMarcusDataTest extends UsersControllerWithMarcusTestCas 'bib' => '1', 'id_abon' => '2341', 'ordre' => '2', - 'telephone' => '')); + 'telephone' => '09 87 76 54 32 12', + 'adresse' => '12 rue miles', + 'code_postal' => '75000', + 'ville' => 'Paris')); $this->assertRedirectTo('/admin/users'); } @@ -179,6 +202,22 @@ class UsersControllerPostMarcusDataTest extends UsersControllerWithMarcusTestCas $this->assertEquals('Miles', $this->marcus->getPrenom()); } + public function testTelephoneIs09_87_76_54_32_12() { + $this->assertEquals('09 87 76 54 32 12', $this->marcus->getTelephone()); + } + + public function testAdresseIs12RueMiles() { + $this->assertEquals('12 rue miles', $this->marcus->getAdresse()); + } + + public function testCodePostalIs75000() { + $this->assertEquals('75000', $this->marcus->getCodePostal()); + } + + public function testVilleIsParis() { + $this->assertEquals('Paris', $this->marcus->getVille()); + } + public function testMailIsMDavisAtFreeDotFr() { $this->assertEquals('mdavis@free.fr', $this->marcus->getMail()); } @@ -212,7 +251,10 @@ class UsersControllerPostMarcusInvalidDataTest extends UsersControllerWithMarcus 'bib' => '0', 'id_abon' => '2341', 'ordre' => '2', - 'telephone' => '')); + 'telephone' => '', + 'adresse' => '', + 'code_postal' => '', + 'ville' => '')); $this->assertAction('edit'); $this->assertQueryContentContains('span#abonne_erreur', "Vous devez compléter le champ 'Identifiant'"); $this->assertQueryContentContains('span#abonne_erreur', "Vous devez compléter le champ 'Mot de passe'"); @@ -231,7 +273,10 @@ class UsersControllerPostMarcusInvalidDataTest extends UsersControllerWithMarcus 'bib' => '1', 'id_abon' => '', 'ordre' => '2', - 'telephone' => '04 50 12 34')); + 'telephone' => '04 50 12 34', + 'adresse' => '', + 'code_postal' => '', + 'ville' => '')); $this->assertAction('edit'); $this->assertQueryContentContains('span#abonne_erreur', "Le champ 'Identifiant' doit être inférieur à 50 caractères"); @@ -271,7 +316,10 @@ class UsersControllerPostValidDataWithCommOpsysTest extends UsersControllerWithM 'bib' => '1', 'id_abon' => '2341', 'ordre' => '2', - 'telephone' => '04 12 34 56 78')); + 'telephone' => '04 12 34 56 78', + 'adresse' => '', + 'code_postal' => '', + 'ville' => '')); } @@ -350,7 +398,10 @@ class UsersControllerAddPostTest extends UsersControllerWithMarcusTestCase { 'bib' => '1', 'id_abon' => '2341', 'ordre' => '2', - 'telephone' => ''))); + 'telephone' => '', + 'adresse' => '', + 'code_postal' => '', + 'ville' => ''))); $this->dispatch('/admin/users/add'); } -- GitLab