Skip to content
Snippets Groups Projects
Commit 3e204ecf authored by Ghislain Loas's avatar Ghislain Loas
Browse files

dev #59224 add tests for nanook

parent 6cf21f78
Branches
Tags
4 merge requests!2660Master,!2636Master,!2633Dev#59224 miop mot de passe adherent bokeh koha,!2627Dev#59224 miop mot de passe adherent bokeh koha
Pipeline #4010 passed with stage
in 34 minutes and 12 seconds
......@@ -199,6 +199,9 @@ abstract class Class_WebService_SIGB_AbstractService {
}
public function changePasswordOfBy($user, $new_password) {}
abstract public function getServerRoot();
abstract public function getEmprunteur($user);
......
......@@ -20,7 +20,7 @@
*/
class AbonneControllerChangePasswordOnKohaTestCase extends AbstractControllerTestCase {
class AbonneControllerChangePasswordOnKohaTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
......@@ -84,6 +84,73 @@ class AbonneControllerChangePasswordOnKohaTestCase extends AbstractControllerTes
}
/** @test */
public function userPasswordShouldHaveBeenUpdatedToCe1bnm2p() {
Class_Users::clearCache();
$this->assertEquals('ce1bnm2p', Class_Users::getIdentity()->getPassword());
}
}
class AbonneControllerChangePasswordOnNanookTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$sigb_plage = $this->fixture('Class_IntBib',
['id' => 3,
'comm_params' => ['url_serveur' => 'http://plage.com/cgi-bin/nanook/ilsdi.pl'],
'comm_sigb' => Class_IntBib::COM_NANOOK
]);
$this->fixture('Class_Bib', ['id' => 11,
'libelle' => 'Bib de la plage',
'int_bib' => $sigb_plage]);
$nanook_user = $this->fixture('Class_Users',
['id' => 5,
'login' => 'ml34',
'password' => 'achanger',
'id_site' => 11,
'int_bib' => $sigb_plage,
'idabon' => '123456',
'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB]);
$mock_web_client = $this->mock()
->whenCalled('open_url')
->with('http://plage.com/cgi-bin/nanook/ilsdi.pl/service/AuthenticatePatron/username/ml34/password/achanger')
->answers(true)
->beStrict();
$sigb_comm = Class_IntBib::find(3)->getSIGBComm();
$sigb_comm->setWebClient($mock_web_client);
ZendAfi_Auth::getInstance()->logUser($nanook_user);
$logger = $this->mock()
->whenCalled('log')->answers(true)
->whenCalled('logError')
->willDo(
function($url, $message) {
var_dump($url . ' :: ' . $message);
exit;
});
Class_WebService_SIGB_AbstractService::setLogger($logger);
$this->postDispatch('/abonne/edit', ['password' => 'ce1bnm2p',
'confirm_password' => 'ce1bnm2p']);
}
public function tearDown() {
Class_WebService_SIGB_AbstractService::setLogger(null);
Class_IntBib::find(3)->getSIGBComm()->setWebClient(null);
parent::tearDown();
}
/** @test */
public function userPasswordShouldHaveBeenUpdatedToCe1bnm2p() {
Class_Users::clearCache();
......
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