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

dev #30973 fix item save after update

parent 589464c9
Branches
Tags
5 merge requests!1553Master,!1502Master,!1501Stable,!1328Dev#30973 pnb backoffice table,!1294Dev#30973 pnb backoffice table
......@@ -46,6 +46,7 @@ class Class_WebService_BibNumerique_Dilicom_Hub extends Class_WebService_Abstrac
$item = $album->getItems()[0];
$item->setLoanCount($album->getUsageConstraints()->getLoanMaxNumberOfUsers() - $simultaneous_users_remaining);
$item->setQuantity($album->getUsageConstraints()->getLoanQuantity() - $content->loanResponseLine[0]->nta);
$item->save();
}
return $content;
......
......@@ -93,6 +93,8 @@ class Class_Webservice_Dilicom_HubUpdateStatusSuccessfulTest extends Class_Webse
public function setUp() {
parent::setUp();
$this->_wrapper = Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Album_Item');
$this->_http
->whenCalled('open_url')
->with('https://pnb-test.centprod.com/v2/pnb-numerique/json/getLoanStatus?glnContractor=123456789&orderLineId[0]=x321')
......@@ -114,6 +116,12 @@ class Class_Webservice_Dilicom_HubUpdateStatusSuccessfulTest extends Class_Webse
public function loanQuantityRemainingShouldBe24OnSuccessfulUpdate() {
$this->assertEquals(24, $this->loan_constraint->quantityOfLoansRemaining());
}
/** @test */
public function itemSaveShouldHaveBeenCalled() {
$this->assertTrue($this->_wrapper->methodHasBeenCalled('save'));
}
}
......
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