Commit 2834e868 authored by Ghislain Loas's avatar Ghislain Loas

hotline #84064 openings: on exceptional day closing, display day : closed

parent 77009bd9
Pipeline #5934 passed with stage
in 30 minutes
- ticket #84064 : Boîte bibliothèque / ouvertures: lorsqu'une journée est fermée dans une plage exceptionnelle, affiche explicitement "fermé" pour cette journée
\ No newline at end of file
......@@ -162,8 +162,11 @@ class ZendAfi_View_Helper_LibraryOpenings extends ZendAfi_View_Helper_BaseHelper
$hours = $this->_renderTimes($am, $pm);
return $opening->getFormattedJour()
. ($hours ? (' : ' . str_replace('h00', 'h', $hours)) : '');
return sprintf('%s : %s',
$opening->getFormattedJour(),
$hours
? str_replace('h00', 'h', $hours)
: $this->_('fermé'));
}
......
......@@ -108,6 +108,63 @@ class ZendAfi_View_Helper_RenderLibraryOpeningOnMondayMorningTest extends ZendAf
class ZendAfi_View_Helper_RenderLibraryOpeningSomeDaysClosedOnHolidaysTestTest extends ZendAfi_View_Helper_RenderLibraryOpeningTestCase {
public function setUp() {
parent::setUp();
$timesource = new TimeSourceForTest('2018-12-21 11:00:00');
ZendAfi_View_Helper_RenderLibraryOpening::setTimeSource($timesource);
Class_Ouverture_Visitor::setTimeSource($timesource);
$this->meythet
->addOuverture($this->fixture('Class_Ouverture',
['id' => 400,
'horaires' => ['00:00', '00:00', '00:00', '00:00'],
'jour_semaine' => Class_Ouverture::LUNDI,
'id_site' => 4,
'validity_start' => '2018-12-22',
'validity_end' => '2019-01-06']))
->addOuverture($this->fixture('Class_Ouverture',
['id' => 401,
'horaires' => ['11:00', '12:00', '14:00', '18:00'],
'jour_semaine' => Class_Ouverture::MARDI,
'id_site' => 4,
'validity_start' => '2018-12-22',
'validity_end' => '2019-01-06']));
}
protected function _renderOpening($library) {
$helper = new ZendAfi_View_Helper_RenderLibrary();
$helper->setView(new ZendAfi_Controller_Action_Helper_View());
return $helper->renderLibrary($library, ['fields' => Class_Systeme_ModulesAccueil_Library::FIELD_OPEN_CLOSE . ';' . Class_Systeme_ModulesAccueil_Library::FIELD_OPENING_HOURS]);
}
/** @test */
public function meythetShouldReopenOnTuesdayAtEleven() {
$this->assertXPathContentContains($this->_renderOpening($this->meythet),
'//p[@class="closed"]',
utf8_encode('Fermé. Réouverture Mardi à 11:00'));
}
/** @test */
public function holidaysOpeningsShouldContainsMondayClosed() {
$this->assertXPathContentContains($this->_renderOpening($this->meythet),
'//div[@class="field-opening-hours"]//ul/li[2]//li',
utf8_encode('Lundi : fermé'));
}
}
class ZendAfi_View_Helper_RenderLibraryOpeningHolidaysTest extends ZendAfi_View_Helper_RenderLibraryOpeningTestCase {
/** @test */
......
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