Skip to content
Snippets Groups Projects
Commit 9769f827 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

Merge branch...

Merge branch 'hotline#39506_erreur_affichage_dans_boite_ouverture_mediatheque_en_temps_reel' into 'stable'

Hotline#39506 erreur affichage dans boite ouverture mediatheque en temps reel

See merge request !1578
parents 9d0eff58 dbd53b11
Branches
Tags
4 merge requests!1659Master,!1587Master,!1585Master,!1584Hotline master
- ticket #39506 : Boite bibliotheque: Erreur affichage ouverture en temps réel
\ No newline at end of file
......@@ -64,10 +64,7 @@ class ZendAfi_View_Helper_Accueil_Library extends ZendAfi_View_Helper_Accueil_Ba
$this->_('Fermé.')
. $this->renderNextOuvertureForLibrary($library));
}
$hour = (int)date('H:i', $this->getCurrentTime());
$hour = date('H:i', $this->getCurrentTime());
$next_open_hour = ($hour >= $ouverture->getFinMatin())
? $ouverture->getDebutApresMidi()
......@@ -76,16 +73,13 @@ class ZendAfi_View_Helper_Accueil_Library extends ZendAfi_View_Helper_Accueil_Ba
if ($next_open_hour > $hour)
return $this->renderClosed($this->_('Ouvrira à %s', $next_open_hour));
$next_close_hour = ($ouverture->isJourneeContinue() || $hour >= $ouverture->getDebutApresMidi())
? max($ouverture->getFinMatin(), $ouverture->getFinApresMidi())
: $ouverture->getFinMatin();
if ($next_close_hour > $hour)
return $this->renderOpened($this->_('Ouvert jusqu\'à %s', $next_close_hour));
return
$this->renderClosed(
$this->_('Fermé depuis %s.', $next_close_hour)
......@@ -153,7 +147,5 @@ class ZendAfi_View_Helper_Accueil_Library extends ZendAfi_View_Helper_Accueil_Ba
? $ouverture->getDebutApresMidi()
: $ouverture->getDebutMatin());
}
}
?>
\ No newline at end of file
......@@ -255,4 +255,52 @@ class ZendAfi_View_Helper_Accueil_LibraryOnTuesdayMorningTest extends ZendAfi_Vi
utf8_encode('Ouvrira à 12:00'));
}
}
abstract class ZendAfi_View_Helper_Accueil_LibraryWithHalfHoursTestCase extends ViewHelperTestCase {
protected
$_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
$annecy = $this->fixture('Class_Bib',
['id' => 1,
'libelle' => 'Annecy',
'ouvertures' => [
Class_Ouverture::chaqueLundi('10:00', '12:30', '14:00', '18:30')]]);
$params = ['type_module' => 'LIBRARY',
'division' => 2,
'preferences' => ['titre' => 'My library']];
$this->_helper = new ZendAfi_View_Helper_Accueil_Library(2, $params);
$this->_helper->setView(new ZendAfi_Controller_Action_Helper_View());
}
}
class ZendAfi_View_Helper_Accueil_LibraryWithHalfHoursTest extends ZendAfi_View_Helper_Accueil_LibraryWithHalfHoursTestCase {
public function setUp() {
parent::setUp();
ZendAfi_View_Helper_Accueil_Library::setTimeSource(new TimeSourceForTest('2016-03-14 12:05:00'));
$this->html = $this->_helper->getBoite();
}
/** @test */
public function h2ShouldContainsAnnecy() {
$this->assertXPathContentContains($this->html, '//h2', 'Annecy');
}
/** @test */
public function annecyShouldContainsLibraryOpenedUntil1230() {
$this->assertXPathContentContains($this->html,
'//section[1]/p[@class="opened"]',
utf8_encode('Ouvert jusqu\'à 12:30'));
}
}
?>
\ 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