From 77cb3fb20f025dcf9dc03c30f335030e67e17a47 Mon Sep 17 00:00:00 2001 From: gloas <gloas@git-test.afi-sa.fr> Date: Wed, 16 Oct 2013 15:55:57 +0000 Subject: [PATCH] AuthCommSigb ajout test cas famille --- .../ZendAfi/Auth/Adapter/AuthCommSigbTest.php | 49 ++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/tests/library/ZendAfi/Auth/Adapter/AuthCommSigbTest.php b/tests/library/ZendAfi/Auth/Adapter/AuthCommSigbTest.php index 40856e77fc4..5c6d1da7e86 100644 --- a/tests/library/ZendAfi/Auth/Adapter/AuthCommSigbTest.php +++ b/tests/library/ZendAfi/Auth/Adapter/AuthCommSigbTest.php @@ -65,7 +65,6 @@ class AuthCommSigbAuthenticationWithoutWebServicesTest extends AuthCommSigbTestC - abstract class AuthCommSigbWithWebServicesAndAbonneZorkTestCase extends AuthCommSigbTestCase { public function setUp() { parent::setUp(); @@ -200,6 +199,54 @@ class AuthCommSigbSuccessfullAuthenticationWithExistingUserTest extends AuthComm +class AuthCommSigbSuccessfullAuthenticationWithExistingFamilleUserTest extends AuthCommSigbWithWebServicesAndAbonneZorkTestCase { + + protected $_zowife, $_zork_boy, $_zork_girl; + + + public function setUp() { + parent::setUp(); + + $this->_zowife = Class_Users::newInstanceWithId(45, + ['password' => 'zowife', + 'login' => 'zork_sigb']); + + $this->_zork_boy = Class_Users::newInstanceWithId(65, + ['password' => 'zorkboy', + 'login' => 'zork_sigb']); + + $this->_zork_girl = Class_Users::newInstanceWithId(85, + ['password' => 'zorkgirl', + 'login' => 'zork_sigb']); + + Class_Users + ::whenCalled('save') + ->with($this->_zork) + ->answers(true) + + ->whenCalled('findAllBy') + ->with(['login' => 'zork_sigb']) + ->answers([$this->_zork, + $this->_zowife, + $this->_zork_boy, + $this->_zork_girl]); + + $this->_adapter = (new ZendAfi_Auth_Adapter_CommSigb()) + ->setIdentity('zork_sigb') + ->setCredential('secret'); + + $this->_authenticate_result = $this->_adapter->authenticate(); + } + + + /** @test **/ + public function onlyZorkShouldHaveBeenSave() { + $this->assertTrue(Class_Users::methodHasBeenCalled('save')); + } + +} + + class AuthCommSigbAuthenticationSetupInvalidUserTest extends AuthCommSigbWithWebServicesAndAbonneZorkTestCase { public function setUp() { -- GitLab