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

hotline#13696 Koha renewals : test webservice returns error according 2 differents koha versions

parent 99dc7386
Branches
Tags
5 merge requests!258Dev/13872 Orphee Allow Hold Available Items,!180Master,!125Master,!124Hotline 6.43,!121Hotline#13696 Valence Koha Prolongations
......@@ -133,10 +133,11 @@ class Class_WebService_SIGB_Koha_Service extends Class_WebService_SIGB_AbstractR
* @return array
*/
public function prolongerPret($user, $pret_id) {
return $this->ilsdiRenewLoan(array(
'patron_id' => $this->_authenticate($user),
'item_id' => $pret_id),
'message');
return $this->ilsdiRenewLoan([ 'patron_id' => $this->_authenticate($user),
'item_id' => $pret_id
],
'(message|error)'
);
}
......
......@@ -626,7 +626,7 @@ class KohaOperationsTest extends KohaTestCase {
/** @test */
function prolongerPretShouldReturnErrorIfTooMany() {
function prolongerPretWithKohaCG55VersionShouldReturnErrorIfTooMany() {
$this->mock_web_client
->expects($this->at(1))
->method('open_url')
......@@ -645,6 +645,26 @@ class KohaOperationsTest extends KohaTestCase {
}
/** @test */
function prolongerPretShouldReturnErrorIfTooMany() {
$this->mock_web_client
->expects($this->at(1))
->method('open_url')
->with('http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl?service=RenewLoan&patron_id=572&item_id=24426')
->will($this->returnValue('<RenewLoan>
<success>0</success>
<renewals>1</renewals>
<error>too_many</error>
<date_due>2009-06-22</date_due>
</RenewLoan>'));
$this->assertEquals(array('statut' => false, 'erreur' => 'Prolongation impossible'),
$this->service->prolongerPret($this->_lafond, '24426'));
}
/** @test */
function prolongerPretShouldReturnSuccessIfNoErrors() {
$this->mock_web_client
......@@ -665,6 +685,29 @@ class KohaOperationsTest extends KohaTestCase {
/** @test */
function prolongerPretWithKohaCG55VersionShouldReturnSuccessIfNoErrors() {
$this->mock_web_client
->expects($this->at(1))
->method('open_url')
->with('http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl?service=RenewLoan&patron_id=572&item_id=24426')
->will($this->returnValue('<?xml version="1.0" encoding="ISO-8859-1" ?>
<RenewLoan>
<success>1</success>
<renewals>2</renewals>
<error>
<renewalsallowed>2</renewalsallowed>
</error>
<date_due>2015-07-19</date_due>
</RenewLoan>'));
$this->assertEquals(array('statut' => true, 'erreur' => ''),
$this->service->prolongerPret($this->_lafond, '24426'));
}
/** @test */
function reserverExemplaireShouldReturnSuccessIfNoErrors() {
$this->mock_web_client
......
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