Support PublicHolidays for opening hours (#51)

DayOfWeek is an enum as defined at https://schema.org/DayOfWeek
We missed the PublicHolidays enum value when building
`getDaysOfWeekWithMondayFirstWeekDay()` which is used in templates to
get ordered result.
Opening hours for public holidays were not rendered, which is now fixed.
pull/50/head
Daniel Siepmann 1 year ago committed by GitHub
parent e8a44c555a
commit 355e4717b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      Classes/Domain/Model/Frontend/OpeningHour.php
  2. 32
      Resources/Private/Language/de.locallang.xlf
  3. 24
      Resources/Private/Language/locallang.xlf
  4. 2
      Resources/Private/Templates/Frontend/ContentElement/TouristAttraction.html
  5. 2
      Tests/Functional/Fixtures/Frontend/TouristAttractions.xml
  6. 9
      Tests/Functional/FrontendTest.php

@ -114,6 +114,7 @@ class OpeningHour
'Friday',
'Saturday',
'Sunday',
'PublicHolidays',
]);
}

@ -3,6 +3,38 @@
<file source-language="en" datatype="plaintext" original="messages" date="2021-02-01T09:24:10Z" product-name="ThueCat Plugins and Modules">
<header/>
<body>
<trans-unit id="content.openingHour.weekday.Monday" xml:space="preserve">
<source>Monday:</source>
<target>Montag:</target>
</trans-unit>
<trans-unit id="content.openingHour.weekday.Tuesday" xml:space="preserve">
<source>Tuesday:</source>
<target>Dienstag:</target>
</trans-unit>
<trans-unit id="content.openingHour.weekday.Wednesday" xml:space="preserve">
<source>Wednesday:</source>
<target>Mittwoch:</target>
</trans-unit>
<trans-unit id="content.openingHour.weekday.Thursday" xml:space="preserve">
<source>Thursday:</source>
<target>Donnerstag:</target>
</trans-unit>
<trans-unit id="content.openingHour.weekday.Friday" xml:space="preserve">
<source>Friday:</source>
<target>Freitag:</target>
</trans-unit>
<trans-unit id="content.openingHour.weekday.Saturday" xml:space="preserve">
<source>Saturday:</source>
<target>Samstag:</target>
</trans-unit>
<trans-unit id="content.openingHour.weekday.Sunday" xml:space="preserve">
<source>Sunday:</source>
<target>Sonntag:</target>
</trans-unit>
<trans-unit id="content.openingHour.weekday.PublicHolidays" xml:space="preserve">
<source>Public Holidays:</source>
<target>Feiertags:</target>
</trans-unit>
<trans-unit id="content.price.type.AccommodationOffer" xml:space="preserve">
<source>Accommodation Offer</source>
<target>Unterkunft</target>

@ -3,6 +3,30 @@
<file source-language="en" datatype="plaintext" original="messages" date="2021-02-01T09:24:10Z" product-name="ThueCat Plugins and Modules">
<header/>
<body>
<trans-unit id="content.openingHour.weekday.Monday" xml:space="preserve">
<source>Monday:</source>
</trans-unit>
<trans-unit id="content.openingHour.weekday.Tuesday" xml:space="preserve">
<source>Tuesday:</source>
</trans-unit>
<trans-unit id="content.openingHour.weekday.Wednesday" xml:space="preserve">
<source>Wednesday:</source>
</trans-unit>
<trans-unit id="content.openingHour.weekday.Thursday" xml:space="preserve">
<source>Thursday:</source>
</trans-unit>
<trans-unit id="content.openingHour.weekday.Friday" xml:space="preserve">
<source>Friday:</source>
</trans-unit>
<trans-unit id="content.openingHour.weekday.Saturday" xml:space="preserve">
<source>Saturday:</source>
</trans-unit>
<trans-unit id="content.openingHour.weekday.Sunday" xml:space="preserve">
<source>Sunday:</source>
</trans-unit>
<trans-unit id="content.openingHour.weekday.PublicHolidays" xml:space="preserve">
<source>Public Holidays:</source>
</trans-unit>
<trans-unit id="module.actions" xml:space="preserve">
<source>Actions</source>
</trans-unit>

@ -12,7 +12,7 @@
<f:for each="{entity.openingHours}" as="openingHour">
<p>
<f:for each="{openingHour.daysOfWeekWithMondayFirstWeekDay}" as="weekday">
{weekday}: {openingHour.opens} - {openingHour.closes}<br>
{f:translate(id: 'content.openingHour.weekday.{weekday}', default: weekday, extensionName: 'Thuecat')} {openingHour.opens} - {openingHour.closes}<br>
</f:for>
{openingHour.from -> f:format.date(format: 'd.m.Y')} -
{openingHour.through -> f:format.date(format: 'd.m.Y')}

@ -7,7 +7,7 @@
<description>Die Beschreibung der Attraktion</description>
<town>1</town>
<media>[{"mainImage":true,"type":"image","title":"Erfurt-Dom und Severikirche-beleuchtet.jpg","description":"","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5159216\/Preview-1280x0\/image","copyrightYear":2016,"license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":""}},{"mainImage":false,"type":"image","title":"Erfurt-Dom-und-Severikirche.jpg","description":"Sicht auf Dom St. Marien, St. Severikirche sowie die davor liegenden Klostergeb\u00e4ude und einem Ausschnitt des Biergartens umgeben von einem d\u00e4mmerungsverf\u00e4rten Himmel","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5159186\/Preview-1280x0\/image","copyrightYear":2020,"license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":""}},{"mainImage":false,"type":"image","title":"Erfurt-Dom und Severikirche-beleuchtet.jpg","description":"","url":"https:\/\/cms.thuecat.org\/o\/adaptive-media\/image\/5159216\/Preview-1280x0\/image","copyrightYear":2016,"license":{"type":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/","author":""}}]</media>
<opening_hours>[{"opens":"09:30:00","closes":"18:00:00","from":{"date":"2021-05-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2021-10-31 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Saturday","Friday","Thursday","Tuesday","Monday","Wednesday"]},{"opens":"13:00:00","closes":"18:00:00","from":{"date":"2021-05-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2021-10-31 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Sunday"]},{"opens":"09:30:00","closes":"17:00:00","from":{"date":"2021-11-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2022-04-30 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Saturday","Friday","Thursday","Tuesday","Monday","Wednesday"]},{"opens":"13:00:00","closes":"17:00:00","from":{"date":"2021-11-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2022-04-30 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Sunday"]}]</opening_hours>
<opening_hours>[{"opens":"09:30:00","closes":"18:00:00","from":{"date":"2021-05-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2021-10-31 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Saturday","Friday","Thursday","Tuesday","Monday","Wednesday"]},{"opens":"13:00:00","closes":"18:00:00","from":{"date":"2021-05-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2021-10-31 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Sunday"]},{"opens":"09:30:00","closes":"17:00:00","from":{"date":"2021-11-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2022-04-30 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Saturday","Friday","Thursday","Tuesday","Monday","Wednesday"]},{"opens":"13:00:00","closes":"17:00:00","from":{"date":"2021-11-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"through":{"date":"2022-04-30 00:00:00.000000","timezone_type":3,"timezone":"UTC"},"daysOfWeek":["Sunday","PublicHolidays"]}]</opening_hours>
<address>{"street":"Beispielstraße 1a","zip":"99084","city":"Beispielstadt","email":"example@example.com","phone":"(0)30 23125 000","fax":"","geo":{"latitude":50.975955358589545,"longitude":11.023667024961856}}</address>
<offers>[{"type":"GuidedTourOffer","title":"F\u00fchrungen","description":"Immer samstags, um 11:15 Uhr findet eine \u00f6ffentliche F\u00fchrung durch das Museum statt. Dauer etwa 90 Minuten","prices":[{"title":"Erwachsene","description":"","price":8,"currency":"EUR","rule":"PerPerson"},{"title":"Erm\u00e4\u00dfigt","description":"als erm\u00e4\u00dfigt gelten schulpflichtige Kinder, Auszubildende, Studierende, Rentner\/-innen, Menschen mit Behinderungen, Inhaber Sozialausweis der Landeshauptstadt Erfurt","price":5,"currency":"EUR","rule":"PerPerson"}]},{"type":"EntryOffer","title":"Eintritt","description":"Schulklassen und Kitagruppen im Rahmen des Unterrichts: Eintritt frei\nAn jedem ersten Dienstag im Monat: Eintritt frei","prices":[{"title":"Erm\u00e4\u00dfigt","description":"als erm\u00e4\u00dfigt gelten schulpflichtige Kinder, Auszubildende, Studierende, Rentner\/-innen, Menschen mit Behinderungen, Inhaber Sozialausweis der Landeshauptstadt Erfurt","price":5,"currency":"EUR","rule":"PerPerson"},{"title":"Familienkarte","description":"","price":17,"currency":"EUR","rule":"PerGroup"},{"title":"ErfurtCard","description":"","price":14.9,"currency":"EUR","rule":"PerPackage"},{"title":"Erwachsene","description":"","price":8,"currency":"EUR","rule":"PerPerson"}]}]</offers>
<slogan>Highlight</slogan>

@ -82,7 +82,14 @@ class FrontendTest extends FunctionalTestCase
self::assertStringContainsString('example@example.com', (string)$result->getBody());
self::assertStringContainsString('(0)30 23125 000', (string)$result->getBody());
self::assertStringContainsString('Monday: 09:30:00 - 18:00:00', (string)$result->getBody());
self::assertStringContainsString('Montag: 09:30:00 - 17:00:00', (string)$result->getBody());
self::assertStringContainsString('Dienstag: 09:30:00 - 17:00:00', (string)$result->getBody());
self::assertStringContainsString('Mittwoch: 09:30:00 - 17:00:00', (string)$result->getBody());
self::assertStringContainsString('Donnerstag: 09:30:00 - 17:00:00', (string)$result->getBody());
self::assertStringContainsString('Freitag: 09:30:00 - 17:00:00', (string)$result->getBody());
self::assertStringContainsString('Samstag: 09:30:00 - 17:00:00', (string)$result->getBody());
self::assertStringContainsString('Sonntag: 13:00:00 - 17:00:00', (string)$result->getBody());
self::assertStringContainsString('Feiertags: 13:00:00 - 17:00:00', (string)$result->getBody());
self::assertStringContainsString('Führungen', (string)$result->getBody());
self::assertStringContainsString('(Führung)', (string)$result->getBody());

Loading…
Cancel
Save