Skip to content
Snippets Groups Projects
Commit 98bce9e2 authored by Sebastien ANDRE's avatar Sebastien ANDRE
Browse files

MT add tests for openings

parent bca2ef95
Branches
Tags
1 merge request!4538MT add tests for openings
Pipeline #18351 passed with stage
in 17 minutes and 38 seconds
<?php
/**
* Copyright (c) 2012-2022, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class TemplatesBibOuverturesTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$this->_buildTemplateProfil(['id' => 42,
'libelle' => 'Template ouvertures']);
$time_source = new TimeSourceForTest('2022-07-01 14:30:00');
Class_Bib::setTimeSource($time_source);
ZendAfi_View_Helper_RenderLibraryOpening::setTimeSource($time_source);
Class_Ouverture_Visitor::setTimeSource($time_source);
$this->fixture(Class_Bib::class,
['id' => 10,
'libelle' => 'Annecy'
]);
$this->fixture(Class_Ouverture::class,
['id' => 100,
'id_site' => 10,
'jour_semaine' => Class_Ouverture::VENDREDI,
'debut_matin' => '08:00:00',
'fin_matin' => '12:00:00',
'debut_apres_midi' => '13:00:00',
'fin_apres_midi' => '18:00:00',
'label' => 'Horaires habituelles'
]);
$this->fixture(Class_Ouverture::class,
['id' => 101,
'id_site' => 10,
'jour_semaine' => Class_Ouverture::JEUDI,
'debut_matin' => '09:00:00',
'fin_matin' => '12:00:00',
'debut_apres_midi' => '14:00:00',
'fin_apres_midi' => '17:00:00',
'label' => 'Changement ponctuel',
'validity_start' => '2022-07-01',
'validity_end' => '2022-07-15'
]);
$this->fixture(Class_Ouverture::class,
['id' => 102,
'id_site' => 10,
'jour_semaine' => Class_Ouverture::JEUDI,
'debut_matin' => '09:00:00',
'fin_matin' => '12:00:00',
'debut_apres_midi' => '00:00:00',
'fin_apres_midi' => '00:00:00',
'label' => 'Changement ponctuel',
'validity_start' => '2022-06-15',
'validity_end' => '2022-07-20'
]);
$this->fixture(Class_Ouverture::class,
['id' => 103,
'id_site' => 10,
'jour_semaine' => Class_Ouverture::AUCUN_JOUR,
'jour' => '2022-07-04',
'debut_matin' => '00:00',
'fin_matin' => '00:00',
'debut_apres_midi' => '00:00',
'fin_apres_midi' => '00:00',
'label' => 'Fermeture ponctuel',
'validity_start' => '2022-06-25',
'validity_end' => '2022-07-04'
]);
$this->fixture(Class_Ouverture::class,
['id' => 104,
'id_site' => 10,
'jour_semaine' => Class_Ouverture::JEUDI,
'debut_matin' => '09:00:00',
'fin_matin' => '11:00:00',
'debut_apres_midi' => '15:00:00',
'fin_apres_midi' => '17:00:00',
'label' => 'Changement ponctuel',
'validity_start' => '2022-06-20',
'validity_end' => '2022-07-10'
]);
$this->dispatch('/bib/ouvertures/id/10');
}
public function tearDown() {
Class_Bib::setTimeSource(null);
ZendAfi_View_Helper_RenderLibraryOpening::setTimeSource(null);
Class_Ouverture_Visitor::setTimeSource(null);
parent::tearDown();
}
/** @test */
public function defaultOpeningShouldBeFirstLI_Horaires_Habituelles() {
$this->assertXPath('//div[@class="field-opening-hours"]/ul/li[1][@class="default_opening_hours"]/h3[text()="Horaires habituelles"]/following-sibling::ul/li[text()="Vendredi : 08h - 12h / 13h - 18h"]');
}
/** @test */
public function periodOpeningShouldBeSecondLI_Changement_Ponctuel_Mercredi() {
$this->assertXPath('//div[@class="field-opening-hours"]/ul/li[2][@class="period_opening_hours"]/h3[text()="Changement ponctuel du mercredi 15 juin au mercredi 20 juillet 2022"]/following-sibling::ul/li[text()="Jeudi : 09h - 12h"]');
}
/** @test */
public function periodOpeningShouldBeThirdLI_Changement_Ponctuel_Vendredi() {
$this->assertXPath('//div[@class="field-opening-hours"]/ul/li[3][@class="period_opening_hours"]/h3[text()="Changement ponctuel du vendredi 01 au vendredi 15 juillet 2022"]/following-sibling::ul/li[text()="Jeudi : 09h - 12h / 14h - 17h"]');
}
/** @test */
public function periodOpeningShouldBeForthLI_Changement_Ponctuel_Lundi() {
$this->assertXPath('//div[@class="field-opening-hours"]/ul/li[4][@class="period_opening_hours"]/h3[text()="Changement ponctuel du lundi 20 juin au dimanche 10 juillet 2022"]/following-sibling::ul/li[text()="Jeudi : 09h - 11h / 15h - 17h"]');
}
/** @test */
public function closingOpeningShouldBeFifthLI_Fermeture_Excptionnelle() {
$this->assertXPath('//div[@class="field-opening-hours"]/ul/li[5][@class="unexpected_closing_hours"]/h3[text()="Fermeture exceptionnelle"]/following-sibling::ul/li[text()="Fermeture ponctuel le lundi 04 juillet : fermé"]');
}
}
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