diff --git a/cosmogramme/php/classes/classe_abonne.php b/cosmogramme/php/classes/classe_abonne.php index b35672679ac95ee728fbe9eb375acd79ccb4be65..19cf19ed34b6ee6f4c8e60cf69199dd67f8e414c 100644 --- a/cosmogramme/php/classes/classe_abonne.php +++ b/cosmogramme/php/classes/classe_abonne.php @@ -1,4 +1,4 @@ -<?PHP +<?php /** * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. * @@ -199,7 +199,6 @@ class abonne } return $result; } - } ?> \ No newline at end of file diff --git a/cosmogramme/tests/php/classes/AbonneIntegrationTest.php b/cosmogramme/tests/php/classes/AbonneIntegrationTest.php index a87233b74fc0579bb75715c573fe2d1a0889457f..56d375400ac89a1019d402406e999add8b160eea 100644 --- a/cosmogramme/tests/php/classes/AbonneIntegrationTest.php +++ b/cosmogramme/tests/php/classes/AbonneIntegrationTest.php @@ -452,7 +452,7 @@ class AbonneIntegrationXMLWithRoutoInDbTest extends AbonneIntegrationXMLTestCase $this->abon_config->importFicheXml($champs_sigb_xml); $this->zozio_after_import = Class_Users::findFirstby(['login'=>'0100 3080', - 'id_site' => 2]); + 'id_site' => 2]); } /** @test **/ diff --git a/library/Class/Users.php b/library/Class/Users.php index d2ad442fabf86523106ca795a040b926c8f392bb..d3e5fa531780edc9b1fe7d493242ad2a1fb103dc 100644 --- a/library/Class/Users.php +++ b/library/Class/Users.php @@ -43,8 +43,8 @@ class UsersLoader extends Storm_Model_Loader { } - public function findMatchingPatron($patron,$bib) { - if (!$bib || !$patron) + public function findMatchingPatron($patron, $bib) { + if (!$patron || !$bib) return null; if (($ordreabon = $patron->getOrdreabon()) diff --git a/library/ZendAfi/Auth/Adapter/CommSigb.php b/library/ZendAfi/Auth/Adapter/CommSigb.php index 8ad3062b4fe47e6019ad300fddf030d1ce4a124c..3e478cbb1dce8c5118d01d1315162e08199c9870 100644 --- a/library/ZendAfi/Auth/Adapter/CommSigb.php +++ b/library/ZendAfi/Auth/Adapter/CommSigb.php @@ -52,9 +52,9 @@ class ZendAfi_Auth_Adapter_CommSigb implements Zend_Auth_Adapter_Interface { public function authenticate() { return $this->authResult( - $this->matchingProcessSIGBUserInDB( - $this->getUserFromSigb(Class_Users::newInstance(['login' => $this->_identity, - 'password' => $this->_credential])))); + $this->matchingProcessSIGBUserInDB( + $this->getUserFromSigb(Class_Users::newInstance(['login' => $this->_identity, + 'password' => $this->_credential])))); } @@ -84,7 +84,6 @@ class ZendAfi_Auth_Adapter_CommSigb implements Zend_Auth_Adapter_Interface { public function getUserFromSigb($user) { - $bibs = $this->getBibsToAuthenticateTo($user); foreach($bibs as $bib) { @@ -122,6 +121,7 @@ class ZendAfi_Auth_Adapter_CommSigb implements Zend_Auth_Adapter_Interface { public function authResult($user) { $result = new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $this->_identity); + if(!$user) return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, $this->_identity); diff --git a/tests/library/ZendAfi/Auth/Adapter/AuthCommSigbTest.php b/tests/library/ZendAfi/Auth/Adapter/AuthCommSigbTest.php index b498932b0eb43f6bb32463b8c77f5d1f7f13b2b9..baa6540765bb3050dc5a72c29a8690c988588b86 100644 --- a/tests/library/ZendAfi/Auth/Adapter/AuthCommSigbTest.php +++ b/tests/library/ZendAfi/Auth/Adapter/AuthCommSigbTest.php @@ -315,7 +315,7 @@ class AuthCommSigbSuccessfullAuthenticationWithExistingFamilleUserTest extends A /** @test */ public function zorkGirlShouldBeAbonneSIGB() { - $this->assertTrue(Class_Users::find(85)->isAbonne()); + $this->assertTrue($this->_zork_girl->isAbonne()); } } @@ -436,7 +436,7 @@ class AuthCommSigbAuthenticationSetupInvalidUserTest extends AuthCommSigbWithWeb /** @test */ - public function noUserShouldHaveBeenSaved() { + public function noUserShouldHaveBeenAdded() { $this->assertCount(1, Class_Users::findAll()); }