From a1b9df074ad8ec6575cec97f055e5ede4f48232d Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@afi-sa.fr> Date: Tue, 27 Oct 2015 14:55:11 +0100 Subject: [PATCH] hotline #30552 : update user fix tests --- VERSIONS_HOTLINE/30552 | 4 +- .../admin/controllers/UsersControllerTest.php | 67 +++---------------- 2 files changed, 12 insertions(+), 59 deletions(-) diff --git a/VERSIONS_HOTLINE/30552 b/VERSIONS_HOTLINE/30552 index 6cd3c16776d..1b85fa9b8e7 100644 --- a/VERSIONS_HOTLINE/30552 +++ b/VERSIONS_HOTLINE/30552 @@ -1 +1,3 @@ - - ticket #30552 : Le pseudo d'un utilisateur (abonné SIGB) ne résiste pas à la mise à jour \ No newline at end of file + - ticket #30552 : + - La longueur maxi d'un pseudo passe a 100 caractères + - correction du bug : lors de la mise a jour du pseudo l'abonné se retrouve en invite \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/UsersControllerTest.php b/tests/application/modules/admin/controllers/UsersControllerTest.php index b02bd9dc173..ddd36a72a8e 100644 --- a/tests/application/modules/admin/controllers/UsersControllerTest.php +++ b/tests/application/modules/admin/controllers/UsersControllerTest.php @@ -248,18 +248,18 @@ class UsersControllerEditMarcusTest extends UsersControllerWithMarcusTestCase { class UsersControllerEditMarcusAsAbonPortailTest extends UsersControllerWithMarcusTestCase { public function setUp() { parent::setUp(); - } /** @test */ - function comboBibShouldBeVisible() { + function comboBibShouldNotBeVisible() { $this->dispatch('/admin/users/edit/id/10'); - $this->assertXPath('//select[@name="bib"]'); + $this->assertNotXPath('//select[@name="bib"]'); } - } -class UserrsControllerEditMarcusAsAdminPortailTest extends UsersControllerWithMarcusTestCase { + + +class UsersControllerEditMarcusAsAdminPortailTest extends UsersControllerWithMarcusTestCase { public function setUp() { parent::setUp(); $this->marcus->setRoleLevel(ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL); @@ -314,7 +314,7 @@ class UsersControllerPostMarcusDataTest extends UsersControllerWithMarcusTestCas 'password' => 'tutu', 'nom' => 'Davis', 'prenom' => 'Miles', - 'pseudo' => 'Dave miles murks??', + 'pseudo' => 'Dave', 'mail' => 'mdavis@free.fr', 'role' => '4', 'bib' => '1', @@ -470,12 +470,11 @@ class UsersControllerPostMarcusInvalidDataTest extends UsersControllerWithMarcus } } -class UsersControllerPostValidDataTest extends UsersControllerWithMarcusTestCase { +class UsersControllerPostValidDataWithCommOpsysTest extends UsersControllerWithMarcusTestCase { public function setUp() { - Class_Users::beVolatile(); parent::setUp(); - Class_Users::clearCache(); + $this->opsys_service = $this->getMock('MockOpsysService', array('saveEmprunteur')); $this->emprunteur = new Class_WebService_SIGB_Emprunteur('2341', 'Marcus'); $this->emprunteur->setService($this->opsys_service); @@ -488,29 +487,9 @@ class UsersControllerPostValidDataTest extends UsersControllerWithMarcusTestCase ->whenCalled('save') ->with($this->marcus) ->answers(true); - - $this->postDispatch('/admin/users/edit/10',['username' => 'mmiller', - 'password' => 'tutu', - 'nom' => 'Miller', - 'prenom' => 'Marcus', - 'pseudo' => 'Macus miller ? ', - 'mail' => 'marcus@gmail.com', - 'role' => 'abonne_sigb', - 'role_level' =>ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB, - 'bib' => '1', - 'id_abon' => '2341', - 'id_site' => '1', - 'ordre' => '2', - 'telephone' => '04 12 34 56 78', - 'adresse' => '', - 'code_postal' => '', - 'ville' => '', - 'naissance' => '', - 'mobile' => '', - 'civilite' => 1]); - } + /** @test */ public function idAbonShouldNotBeModified() { $this->assertEquals('00123',Class_Users::find(10)->getIdabon()); @@ -521,34 +500,6 @@ class UsersControllerPostValidDataTest extends UsersControllerWithMarcusTestCase $this->assertEquals(ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB,Class_Users::find(10)->getRoleLevel()); } -} - - - -class UsersControllerPostValidDataWithCommOpsysTest extends UsersControllerWithMarcusTestCase { - public function setUp() { - parent::setUp(); - - $this->opsys_service = $this->getMock('MockOpsysService', array('saveEmprunteur')); - $this->emprunteur = new Class_WebService_SIGB_Emprunteur('2341', 'Marcus'); - $this->emprunteur->setService($this->opsys_service); - - $this->marcus->setFicheSIGB(array('type_comm' => Class_IntBib::COM_OPSYS, - 'fiche' => $this->emprunteur, - 'nom_aff' => 'Marcus')); - - $this->user_loader - ->whenCalled('save') - ->with($this->marcus) - ->answers(true); - } - - - /** @test */ - public function idAbonShouldNotBeModified() { - $this->assertEquals(2341,Class_Users::find(10)->getIdabon()); - } - protected function _postData() { $this->_postEditData(array('username' => 'mdavis', 'password' => 'tutu', -- GitLab