Skip to content
Snippets Groups Projects
Commit ca55aed5 authored by llaffont's avatar llaffont
Browse files

Correction authentification utilisateurs avec Web Service invalide

parent 3f2c9db4
Branches
Tags
No related merge requests found
......@@ -106,10 +106,10 @@ class ZendAfi_Auth_Adapter_CommSigb implements Zend_Auth_Adapter_Interface {
return Class_IntBib::findAllWithWebServices();
$user_in_db = $users_in_db[0];
if (!$user_in_db->isAbonne())
if (!$user_in_db->isAbonne() || (!$bib = $user_in_db->getIntBib()) || (!$bib->getSIGBComm()))
return [];
return [$user_in_db->getIntBib()];
return [$bib];
}
......
......@@ -27,7 +27,6 @@ abstract class AuthCommSigbTestCase extends Storm_Test_ModelTestCase {
->setDateFin('2010-10-23')
->setLogin('zork_sigb')
->setPassword('xzy')
->setIdSite(1)
->beAbonneSIGB();
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Users')
......@@ -242,6 +241,41 @@ class AuthCommSigbSuccessfullAuthenticationWithExistingUserButWrongPasswordTest
class AuthCommSigbErrorsTest extends AuthCommSigbWithWebServicesAndAbonneZorkTestCase {
public function setUp() {
parent::setUp();
Class_Users::whenCalled('findAllBy')
->with(['login' => 'zork_sigb'])
->answers([$this->_zork]);
$this->_adapter = (new ZendAfi_Auth_Adapter_CommSigb())
->setIdentity('zork_sigb')->setCredential('blabla');
}
/** @test */
public function withNoSiteShouldNotReturnValidResult() {
$this->_zork->setIdSite(9887);
$this->_authenticate_result = $this->_adapter->authenticate();
$this->assertFalse($this->_authenticate_result->isValid());
}
/** @test */
public function siteWithoutWebServiceShouldNotReturnValidResult() {
$this->_zork->setIntBib(Class_IntBib::newInstanceWithId(9876, ['comm_sigb' => '']));
$this->_authenticate_result = $this->_adapter->authenticate();
$this->assertFalse($this->_authenticate_result->isValid());
}
}
class AuthCommSigbSuccessfullAuthenticationWithExistingFamilleUserTest extends AuthCommSigbWithWebServicesAndAbonneZorkTestCase {
protected $_zowife, $_zork_boy, $_zork_girl;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment