Commit 4830fad8 authored by efalcy's avatar efalcy
Browse files

dev #72825 : fix tests

parent e88e31cd
Pipeline #4383 passed with stage
in 34 minutes and 29 seconds
......@@ -89,14 +89,14 @@ class Class_User_LoanCriteria {
if (!$date1 || !$date2)
return true;
return (DateTime::createFromFormat('Y-m-d',$date1)) >= (DateTime::createFromFormat('Y-m-d',$date2));
return (DateTime::createFromFormat('d/m/Y',$date1)) >= (DateTime::createFromFormat('d/m/Y',$date2));
}
public function isBeforeDate($date1,$date2) {
if (!$date1 || !$date2)
return true;
return (DateTime::createFromFormat('Y-m-d',$date1)) <= (DateTime::createFromFormat('Y-m-d',$date2));
return (DateTime::createFromFormat('d/m/Y',$date1)) <= (DateTime::createFromFormat('d/m/Y',$date2));
}
......
......@@ -126,11 +126,22 @@ abstract class Class_WebService_SIGB_AbstractILSDIPatronInfoReader {
$this->getEmprunteur()->empruntsAddAll($this->_loans);
}
public function startOnhold($data) {
public function endOnhold($data) {
if ($data)
$this->_currentLoan->setOnHold($data);
}
public function endIssuedate($data) {
if ($data)
$this->_currentLoan->setIssueDate($this->_formatDate($data));
}
protected function _formatDate($data) {
return implode('/', array_reverse(explode('-', current(explode(' ',$data)))));
}
/**
* @param array $attributes
......
......@@ -59,16 +59,22 @@ class ZendAfi_View_Helper_Abonne_Loans extends ZendAfi_View_Helper_Abonne_Operat
$this->_('Auteur'),
$this->_('Bibliothèque'),
$this->_('Retour prévu'),
$this->_('Informations'),
$this->displayBookedByOthers() ? $this->_('Document réservé par d\'autres') : null]);
$this->displayField('type') ? $this->_('Informations') : null,
$this->displayField('booked_by_others') ? $this->_('Document réservé par d\'autres') : null]);
}
protected function displayBookedByOthers() {
return true;
protected function displayField($field) {
foreach ($this->_operations as $loan) {
if ($loan->callGetterByAttributeName($field))
return true;
}
return false;
}
protected function renderLoans() {
$html = '';
......@@ -81,7 +87,7 @@ class ZendAfi_View_Helper_Abonne_Loans extends ZendAfi_View_Helper_Abonne_Operat
protected function renderLoan($loan) {
$tag_bookedbyothers = $this->displayBookedByOthers() ? $this->_tag('td',
$tag_bookedbyothers = $this->displayField('booked_by_others') ? $this->_tag('td',
'',
$loan->getBookedByOthers()?
['class' => 'checkedbox'] :
......
......@@ -154,7 +154,7 @@ class HandleBranchcodeDisplayLoanByOthersTest extends HandleBranchcodeTestCase {
/** @test */
public function ilsdiHoldTitleShouldBeCallWithCHYMinusGB() {
public function onHoldShouldDisplayBookedByOther() {
$this->borrower = $this->service->getEmprunteur($this->user);
$this->dispatch('/opac/abonne/prets', true);
$this->assertXPathContentContains('//div', 'réservé par d\'autres', $this->_response->getBody());
......@@ -162,17 +162,16 @@ class HandleBranchcodeDisplayLoanByOthersTest extends HandleBranchcodeTestCase {
/** @test */
public function onHoldShouldDisplayBookedByOther() {
public function informationsShouldNotBeDisplayed() {
$this->borrower = $this->service->getEmprunteur($this->user);
$this->dispatch('/opac/abonne/prets', true);
$this->assertXPathContentContains('//div', 'réservé par d\'autres', $this->_response->getBody());
$this->assertNotXPathContentContains('//div', 'Informations', $this->_response->getBody());
}
/** @test */
public function postOnHoldShouldDisplayBookedByOther() {
$this->borrower = $this->service->getEmprunteur($this->user);
$this->postDispatch('/opac/abonne/prets', ['onhold' => 'yes'],true);
$this->assertXPathContentContains('//div', 'réservé par d\'autres', $this->_response->getBody());
}
......@@ -181,8 +180,7 @@ class HandleBranchcodeDisplayLoanByOthersTest extends HandleBranchcodeTestCase {
/** @test */
public function postReturnDateShouldDisplayBookedByOther() {
$this->borrower = $this->service->getEmprunteur($this->user);
$this->dispatch('/opac/abonne/prets?start_loan_date=12%2F06%2F2018&end_loan_date=&start_date_retour=&end_date_retour=&onhold=',true);
$this->dispatch('/opac/abonne/prets?start_issue_date=12%2F06%2F2010&end_loan_date=&start_date_retour=&end_date_retour=&onhold=',true);
$this->assertXPathContentContains('//td', 'Quel bazar, Léonard', $this->_response->getBody());
}
......
Markdown is supported
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