Skip to content
Snippets Groups Projects
Commit e73952b3 authored by Laurent's avatar Laurent Committed by Patrick Barroca
Browse files

#13536 reservation ajax under tests

parent bde35e4b
Branches
Tags
4 merge requests!258Dev/13872 Orphee Allow Hold Available Items,!114Master,!113Hotline 6.43,!111Hotdev#13536 Reservation Message Site Retrait
......@@ -153,4 +153,69 @@ class RechercheControllerReservationWithMailPostAction extends AbstractControlle
}
}
class RechercheControllerReservationWithWebServiceKohaTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$this->jajm = $this->fixture('Class_Users',
['id' => 1,
'login' => 'jajm',
'password' => 'secret',
'int_bib' => $this->fixture('Class_IntBib',
['id' => 1,
'comm_sigb' => Class_IntBib::COM_KOHA,
'comm_params' => ['url_serveur' => 'http://bib.valensol.net']])
]);
ZendAfi_Auth::getInstance()->logUser($this->jajm);
Class_WebService_SIGB_Koha::setService(['url_serveur' => 'http://bib.valensol.net',
'id_bib' => 1,
'type' => Class_IntBib::COM_KOHA],
$this->koha = Storm_Test_ObjectWrapper::mock());
}
/** @test */
public function popupResultContentShouldContainsVotreReservationEstEnregistree() {
$this->jajm->setIdabon(395749);
$this->koha
->whenCalled('isConnected')->answers(true)
->whenCalled('reserverExemplaire')->answers(['statut' => true,
'erreur' => '',
'popup' => false]);
$this->dispatch('/recherche/reservationajax/id_bib/1/id_origine/456/code_annexe/VS',
true);
$this->json = json_decode($this->_response->getBody());
$this->assertEquals($this->json->content, "Votre réservation est enregistrée.");
}
/** @test */
public function popupResultContentWithWebServiceErrorShouldContainsErreurDeCommunication() {
$this->jajm->setIdabon(395749);
$this->koha->whenCalled('isConnected')->answers(false);
$this->dispatch('/recherche/reservationajax/id_bib/1/id_origine/456/code_annexe/VS',
true);
$this->json = json_decode($this->_response->getBody());
$this->assertEquals($this->json->content,
"Une erreur de communication avec le serveur a fait échouer la requête. Merci de signaler ce problème à la bibliothèque.");
}
/** @test */
public function withoutIdAbonpopupResultContentShouldContainsVousDevezVousConnecterSousVotreNumeroDeCarte() {
$this->dispatch('/recherche/reservationajax/id_bib/1/id_origine/456/code_annexe/VS');
$this->json = json_decode($this->_response->getBody());
$this->assertEquals($this->json->content,
"Vous devez vous connecter sous votre numéro de carte pour effectuer une réservation.");
}
}
?>
\ No newline at end of file
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