Skip to content
Snippets Groups Projects
Commit 0b48da1e authored by efalcy's avatar efalcy
Browse files

hotline #47906 fix tests failures

parent 6bb0b025
Branches
Tags
2 merge requests!1896Master,!1879Hotline#47906 doublon de certains utilisateurs sigb
......@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
abstract class AuthCommSigbTestCase extends Storm_Test_ModelTestCase {
......@@ -25,7 +25,7 @@ abstract class AuthCommSigbTestCase extends Storm_Test_ModelTestCase {
Class_Users::beVolatile();
Class_IntBib::beVolatile();
$this->_zork = $this->fixture('Class_Users',
['id' => 4,
'date_fin' => '2010-10-23',
......@@ -34,7 +34,7 @@ abstract class AuthCommSigbTestCase extends Storm_Test_ModelTestCase {
'idabon' => '98475',
'id_site' => 2,
'password' => 'xzy']);
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Users');
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_IntBib');
}
......@@ -95,7 +95,7 @@ abstract class AuthCommSigbWithWebServicesAndAbonneZorkTestCase extends AuthComm
->setEndDate('2015-12-25')
->setPassword('secret')
->beValid());
$this->_zork->setIdSite(74);
$this->_zork->setIdSite(74)->save();
return $this;
}
......@@ -112,8 +112,8 @@ class AuthCommSigbSuccessfullAuthenticationTest extends AuthCommSigbWithWebServi
->whenCalled('save')
->willDo(
function($user) {
$user->setId(23);
return true;
$user->setId(23);
return true;
});
$this->_adapter = (new ZendAfi_Auth_Adapter_CommSigb())
......@@ -122,7 +122,7 @@ class AuthCommSigbSuccessfullAuthenticationTest extends AuthCommSigbWithWebServi
$this->_authenticate_result = $this->_adapter->authenticate();
}
/** @test */
public function authenticateZorkShouldReturnValidResult() {
......@@ -142,7 +142,7 @@ class AuthCommSigbSuccessfullAuthenticationTest extends AuthCommSigbWithWebServi
$this->assertTrue($user->isAbonne());
}
/** @test */
public function resultObjectShouldBeSetUp() {
$result = $this->_adapter->getResultObject();
......@@ -169,14 +169,14 @@ class AuthCommSigbSuccessfullAuthenticationWithExistingUserTest extends AuthComm
$this->_authenticate_result = $this->_adapter->authenticate();
}
/** @test */
public function authenticateZorkShouldReturnValidResult() {
$this->assertTrue($this->_authenticate_result->isValid());
}
/** @test */
public function zorkShouldHaveBeenSaved() {
$this->assertEquals($this->_zork, Class_Users::getFirstAttributeForLastCallOn('save'));
......@@ -192,13 +192,13 @@ class AuthCommSigbSuccessfullAuthenticationWithExistingUserTest extends AuthComm
/** @test */
public function zorkDateFinShouldBeUpdatedTo2015_12_25() {
$this->assertEquals('2015-12-25', $this->_zork->getDateFin());
$this->assertEquals('2015-12-25', $this->_zork->getDateFin());
}
/** @test */
public function zorkPasswordShouldBeSecret() {
$this->assertEquals('secret', $this->_zork->getPassword());
$this->assertEquals('secret', $this->_zork->getPassword());
}
}
......@@ -213,7 +213,7 @@ class AuthCommSigbSuccessfullAuthenticationWithExistingUserButWrongPasswordTest
::whenCalled('findAllBy')
->with(['login' => 'zork_sigb'])
->answers([$this->_zork]);
$this->_adapter = (new ZendAfi_Auth_Adapter_CommSigb())
->setIdentity('zork_sigb')
->setCredential('oups');
......@@ -234,7 +234,7 @@ class AuthCommSigbSuccessfullAuthenticationWithExistingUserButWrongPasswordTest
class AuthCommSigbErrorsTest extends AuthCommSigbWithWebServicesAndAbonneZorkTestCase {
public function setUp() {
parent::setUp();
$this->_adapter = (new ZendAfi_Auth_Adapter_CommSigb())
->setIdentity('zork_sigb')
->setCredential('blabla');
......@@ -265,7 +265,7 @@ class AuthCommSigbErrorsTest extends AuthCommSigbWithWebServicesAndAbonneZorkTes
class AuthCommSigbSuccessfullAuthenticationWithExistingFamilleUserTest extends AuthCommSigbWithWebServicesAndAbonneZorkTestCase {
protected $_zowife, $_zork_boy, $_zork_girl;
public function setUp() {
parent::setUp();
......@@ -274,19 +274,20 @@ class AuthCommSigbSuccessfullAuthenticationWithExistingFamilleUserTest extends A
$this->_zowife = $this->fixture('Class_Users',
['id' => 45,
'password' => 'zowife',
'password' => 'zowife',
'login' => 'zork_sigb']);
$this->_zork_boy = $this->fixture('Class_Users',
['id' => 65,
'password' => 'zorkboy',
'password' => 'zorkboy',
'login' => 'zork_sigb']);
$this->_zork_girl = $this->fixture('Class_Users',
['id' => 85,
'password' => 'zorkgirl',
'password' => 'zorkgirl',
'login' => 'zork_sigb',
'id_sigb' => '001234']);
'id_sigb' => '001234',
'id_site' => 74]);
$this->opsys
->whenCalled('getEmprunteur')
......@@ -297,15 +298,15 @@ class AuthCommSigbSuccessfullAuthenticationWithExistingFamilleUserTest extends A
->setPassword('zorkgirl')
->beValid());
$this->_adapter = (new ZendAfi_Auth_Adapter_CommSigb())
->setIdentity('zork_sigb')
->setCredential('zorkgirl');
$this->_authenticate_result = $this->_adapter->authenticate();
}
/** @test **/
public function zorkGirlShouldHaveBeenSave() {
$this->assertTrue(Class_Users::methodHasBeenCalledWithParams('save', [$this->_zork_girl]));
......@@ -336,15 +337,15 @@ class AuthCommSigbSuccessfullAuthenticationWithNewLoginTest extends AuthCommSigb
->setPassword('xzyz')
->beValid());
$this->_adapter = (new ZendAfi_Auth_Adapter_CommSigb())
->setIdentity('new_login')
->setCredential('xzyz');
$this->_authenticate_result = $this->_adapter->authenticate();
}
/** @test */
public function authenticateZorkShouldBeValid() {
$this->assertTrue($this->_authenticate_result->isValid());
......@@ -382,15 +383,15 @@ class AuthCommSigbErrorAuthenticationWithNewLoginTest extends AuthCommSigbWithWe
->setCodeBarres('1234')
->beValid());
$this->_adapter = (new ZendAfi_Auth_Adapter_CommSigb())
->setIdentity('new_login')
->setCredential('xzyz');
$this->_authenticate_result = $this->_adapter->authenticate();
}
/** @test */
public function authenticateZorkShouldBeValid() {
$this->assertTrue($this->_authenticate_result->isValid());
......@@ -431,14 +432,15 @@ class AuthCommSigbAuthenticationSetupInvalidUserTest extends AuthCommSigbWithWeb
/** @test */
public function authenticateZorkShouldNotBeValid() {
$this->assertFalse($this->_authenticate_result->isValid());
}
}
/** @test */
public function noUserShouldHaveBeenSaved() {
$this->assertFalse(Class_Users::methodHasBeenCalled('save'));
$this->assertCount(1, Class_Users::findAll());
}
/** @test */
public function zorkPasswordShouldRemainXZY() {
$this->assertEquals('xzy', $this->_zork->getPassword());
......
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