2021-08-12 09:19:16 +02:00
< ? php
declare ( strict_types = 1 );
/*
* Copyright ( C ) 2021 Daniel Siepmann < coding @ daniel - siepmann . de >
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
* of the License , or ( at your option ) any later version .
*
* This program 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 General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA
* 02110 - 1301 , USA .
*/
namespace WerkraumMedia\ThueCat\Tests\Functional ;
2023-11-30 13:52:23 +01:00
use Codappix\Typo3PhpDatasets\TestingFramework ;
use DateTimeImmutable ;
use PHPUnit\Framework\Attributes\Test ;
2021-08-12 09:19:16 +02:00
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest ;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase ;
class FrontendTest extends FunctionalTestCase
{
2023-11-30 13:52:23 +01:00
use TestingFramework ;
2023-08-29 13:54:16 +02:00
protected function setUp () : void
{
$this -> coreExtensionsToLoad = [
'fluid_styled_content' ,
];
2021-08-12 09:19:16 +02:00
2023-08-29 13:54:16 +02:00
$this -> testExtensionsToLoad = [
'typo3conf/ext/thuecat/' ,
];
2021-08-12 09:19:16 +02:00
2023-08-29 13:54:16 +02:00
$this -> pathsToLinkInTestInstance = [
'typo3conf/ext/thuecat/Tests/Functional/Fixtures/Frontend/Sites/' => 'typo3conf/sites' ,
];
2021-08-12 09:19:16 +02:00
parent :: setUp ();
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/Content.php' );
2021-08-12 09:19:16 +02:00
$this -> setUpFrontendRootPage ( 1 , [
'EXT:fluid_styled_content/Configuration/TypoScript/setup.typoscript' ,
'EXT:thuecat/Configuration/TypoScript/ContentElements/setup.typoscript' ,
2023-08-29 13:54:16 +02:00
'EXT:thuecat/Tests/Functional/Fixtures/Frontend/Rendering.typoscript' ,
2021-08-12 09:19:16 +02:00
]);
}
2023-11-30 13:52:23 +01:00
#[Test]
2021-08-12 09:19:16 +02:00
public function touristAttractionContentElementIsRendered () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractions.php' );
2021-08-12 09:19:16 +02:00
$request = new InternalRequest ();
$request = $request -> withPageId ( 2 );
2023-11-30 13:52:23 +01:00
$result = $this -> executeFrontendSubRequest ( $request );
2021-08-12 09:19:16 +02:00
self :: assertSame ( 200 , $result -> getStatusCode ());
self :: assertStringContainsString ( 'Erste Attraktion (Beispielstadt)' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Die Beschreibung der Attraktion' , ( string ) $result -> getBody ());
2021-08-10 16:04:29 +02:00
self :: assertStringContainsString ( 'Highlight' , ( string ) $result -> getBody ());
2021-09-14 15:02:16 +02:00
self :: assertStringContainsString ( '<img class="img-fluid" src="https://cms.thuecat.org/o/adaptive-media/image/5159216/Preview-1280x0/image" />' , ( string ) $result -> getBody ());
2022-11-24 11:05:13 +01:00
self :: assertStringContainsString ( 'ⓒ Image Author' , ( string ) $result -> getBody ());
2021-08-12 09:19:16 +02:00
self :: assertStringContainsString ( 'Beispielstraße 1a' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( '99084' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Beispielstadt' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'example@example.com' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( '(0)30 23125 000' , ( string ) $result -> getBody ());
2022-11-29 11:50:22 +01:00
self :: assertStringContainsString ( 'https://example.com/attraction' , ( string ) $result -> getBody ());
2021-08-12 09:19:16 +02:00
self :: assertStringContainsString ( 'Führungen' , ( string ) $result -> getBody ());
2021-09-13 10:32:12 +02:00
self :: assertStringContainsString ( '(Führung)' , ( string ) $result -> getBody ());
2021-08-12 09:19:16 +02:00
self :: assertStringContainsString ( 'Immer samstags, um 11:15 Uhr findet eine öffentliche Führung durch das Museum statt. Dauer etwa 90 Minuten' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Erwachsene' , ( string ) $result -> getBody ());
2021-09-13 10:32:12 +02:00
self :: assertStringContainsString ( '(Eintritt)' , ( string ) $result -> getBody ());
2021-08-12 09:19:16 +02:00
self :: assertStringContainsString ( '8,00 EUR' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'pro Person' , ( string ) $result -> getBody ());
2021-08-10 16:18:06 +02:00
self :: assertStringContainsString ( '11. Jh' , ( string ) $result -> getBody ());
2021-08-10 16:42:23 +02:00
self :: assertStringContainsString ( 'Toilette' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Behindertentoilette' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Wickelplatz' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'familien- / kindgerecht' , ( string ) $result -> getBody ());
2021-08-12 13:28:10 +02:00
self :: assertStringContainsString ( 'Spielplatz' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Ruhezone mit Sitzmöglichkeit oder separate Sitzmöglichkeit' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Souvenirshop' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Spielecke / Spielbereich' , ( string ) $result -> getBody ());
2021-08-12 13:43:20 +02:00
self :: assertStringContainsString ( 'Museumsshop' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Pädagogisches Angebot' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'kein weiterer Service' , ( string ) $result -> getBody ());
2021-08-12 14:05:45 +02:00
self :: assertStringContainsString ( 'Heimatschutzarchitektur' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Art Déco' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Jugendstil' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Barock' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Bauhaus' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Brutalismus' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Klassizismus' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Konstruktivismus' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Kritischer Regionalismus' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Dekonstruktivismus' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Expressionismus' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Funktionalismus' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Gotik' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Neogotik' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'High-Tech-Architektur' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Historismus' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Internationaler Stil' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Minimalismus' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Moderne' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Neoklassizismus' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Neorenaissance' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Neues Bauen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Neue Sachlichkeit' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Organische Architektur' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Postmoderne' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Rationalismus' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Renaissance' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Rokoko' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Romanik' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'keine Angabe' , ( string ) $result -> getBody ());
2021-08-16 08:02:43 +02:00
self :: assertStringContainsString ( 'Fahrradboxen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Fahrradständer / -boxen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Fahrradständer' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Bushaltepunkt (für Ein- und Ausstieg) vorhanden' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'E-Bike-Ladestation' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'E-Auto-Ladestation' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'keine Angabe' , ( string ) $result -> getBody ());
2021-08-16 08:15:38 +02:00
self :: assertStringContainsString ( 'AliPay' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'American Express' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'ApplePay' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Barzahlung' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'EC' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Sofortüberweisung' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Rechnung' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'MasterCard' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'PayPal' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Visa' , ( string ) $result -> getBody ());
2021-08-16 08:25:54 +02:00
self :: assertStringContainsString ( 'App für mobile Endgeräte' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Audioguide' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Augmented Reality' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Videoguide' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Virtual Reality' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'kein digitales Angebot' , ( string ) $result -> getBody ());
2021-08-16 08:37:15 +02:00
self :: assertStringContainsString ( 'Fotolizenz kostenpflichtig' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Fotografieren erlaubt' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Fotografieren nicht gestattet' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'some free text value for photography' , ( string ) $result -> getBody ());
2021-08-16 09:35:47 +02:00
2021-09-14 15:02:16 +02:00
self :: assertStringContainsString ( '250 Meter' , ( string ) $result -> getBody ());
2021-08-17 15:51:38 +02:00
2021-08-17 11:50:11 +02:00
self :: assertStringNotContainsString ( 'Keine tiere erlaubt' , ( string ) $result -> getBody ());
self :: assertStringNotContainsString ( 'Tiere erlaubt' , ( string ) $result -> getBody ());
self :: assertStringNotContainsString ( 'kein freier Eintritt' , ( string ) $result -> getBody ());
self :: assertStringNotContainsString ( 'freier Eintritt' , ( string ) $result -> getBody ());
2021-08-17 14:01:48 +02:00
self :: assertStringNotContainsString ( 'nicht öffentlich zugänglich' , ( string ) $result -> getBody ());
self :: assertStringNotContainsString ( 'öffentlich zugänglich' , ( string ) $result -> getBody ());
2021-08-17 14:36:26 +02:00
self :: assertStringNotContainsString ( 'Englisch' , ( string ) $result -> getBody ());
self :: assertStringNotContainsString ( 'Französisch' , ( string ) $result -> getBody ());
2021-08-18 13:54:18 +02:00
self :: assertStringContainsString ( 'Parkhäuser in der Nähe' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Parkhaus Domplatz' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Bechtheimer Str. 1' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( '99084 Erfurt' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'info@stadtwerke-erfurt.de' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( '+49 361 5640' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Q-Park Anger 1 Parkhaus' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Anger 1' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( '99084 Erfurt' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'servicecenter@q-park.de' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( '+49 218 18190290' , ( string ) $result -> getBody ());
2021-08-23 14:20:36 +02:00
self :: assertStringContainsString ( 'barrierefrei' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'barrierefrei für taube Menschen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'nicht zertifiziert für Menschen mit kognitiven Beeinträchtigungen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'nicht zertifiziert für Menschen mit Hörbehinderung' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'teilweise barrierefrei für Menschen mit Sehbehinderung' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'nicht zertifiziert für blinde Menschen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'teilweise barrierefrei für Menschen mit Gehbehinderung' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'teilweise barrierefrei für Rollstuhlfahrer' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Kurzbeschreibung Alle Generationen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Deutsche Beschreibung von shortDescriptionAccessibilityAllGenerations' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Kurzbeschreibung Allergiker' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Deutsche Beschreibung von shortDescriptionAccessibilityAllergic' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Kurzbeschreibung Hörbehinderte / Gehörlos' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Deutsche Beschreibung von shortDescriptionAccessibilityDeaf' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Kurzbeschreibung Kognitive Beeinträchtigungen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Deutsche Beschreibung von shortDescriptionAccessibilityMental' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Kurzbeschreibung Sehbehinderung / Blinde' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Deutsche Beschreibung von shortDescriptionAccessibilityVisual' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Kurzbeschreibung Gehbehindert/Rollstuhl' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Deutsche Beschreibung von shortDescriptionAccessibilityWalking' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Induktive Höranlage/ -schleife' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Blinksignal bei Anklopfen an die Zimmertür' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Spezielle Angebote für gehörlose Menschen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Spezielle Angbote für Menschen mit Hörbehinderung' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Optische Bestätigung des Notrufs im Aufzug' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Farbliches oder bildhaftes Leitsystem' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Informationen in leichter Sprache (Führung, Begleitheft o.ä.)' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Informationen mit Piktogrammen oder Bildern' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Assistenzhunde willkommen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Durchgehendes Leitsystem mit Bodenindikatoren' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Informationen in Braille- oder Prismenschrift' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Angebote in bildhafter Sprache (Führung, Audioguide o.ä.)' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Spezielle Angebote für blinde Menschen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Spezielle Angbote für Menschen mit Sehbehinderung' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Taktile Angebote (Tastmodell, Lageplan o.ä.)' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Visuell kontrastierende Stufenkanten' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Alle nutzbaren Räume und Einrichtungen stufenlos bzw. über Aufzug erreichbar' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( '80 cm Mindestbreite aller Durchgänge / Türen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Einstiegshilfe Schwimmbecken' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Haltegriff in der Dusche' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Beidseitige Handläufe an allen Treppen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Klappbarer Haltegriff am WC' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'WC seitlich anfahrbar' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Bewegungsfläche der Dusche min. 1m x 1m' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( '90 cm Mindestbreite aller Durchgänge / Türen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Pflegebett' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Parkplatz für Menschen mit Behinderung' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( '70 cm Mindestbreite aller Durchgänge / Türen' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Duschstuhl oder sitz' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Spezielle Angbote für Menschen mit Gehbehinderung' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Spezielle Angebote für Rollstuhlfahrer' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Stufenloser Zugang zum Gebäude/ Objekt/ Gelände' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'Stufenlose Dusche' , ( string ) $result -> getBody ());
self :: assertStringContainsString ( 'WC für Menschen mit Behinderung' , ( string ) $result -> getBody ());
2021-08-16 09:35:47 +02:00
}
2023-11-30 13:52:23 +01:00
#[Test]
2022-12-12 14:12:32 +01:00
public function touristAttractionContentElementRespectsEditorialSorting () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractions.php' );
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/SecondTouristAttraction.php' );
2022-12-12 14:12:32 +01:00
$this -> getConnectionPool () -> getConnectionForTable ( 'tt_content' ) -> update (
'tt_content' ,
[
'records' => '2,1' ,
],
[ 'uid' => 2 ]
);
$request = new InternalRequest ();
$request = $request -> withPageId ( 2 );
2023-11-30 13:52:23 +01:00
$html = ( string ) $this -> executeFrontendSubRequest ( $request ) -> getBody ();
2022-12-12 14:12:32 +01:00
self :: assertGreaterThan (
stripos ( $html , 'Eine weitere Attraktion' ),
stripos ( $html , 'Erste Attraktion' )
);
}
2023-11-30 13:52:23 +01:00
#[Test]
2021-08-16 09:35:47 +02:00
public function touristAttractionWithPetsFalse () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractionsForPets.php' );
2021-08-16 09:35:47 +02:00
$request = new InternalRequest ();
$request = $request -> withPageId ( 4 );
2023-11-30 13:52:23 +01:00
$result = $this -> executeFrontendSubRequest ( $request );
2021-08-16 09:35:47 +02:00
self :: assertSame ( 200 , $result -> getStatusCode ());
self :: assertStringContainsString ( 'Keine Tiere erlaubt' , ( string ) $result -> getBody ());
}
2023-11-30 13:52:23 +01:00
#[Test]
2021-08-16 09:35:47 +02:00
public function touristAttractionWithPetsTrue () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractionsForPets.php' );
2021-08-16 09:35:47 +02:00
$request = new InternalRequest ();
$request = $request -> withPageId ( 5 );
2023-11-30 13:52:23 +01:00
$result = $this -> executeFrontendSubRequest ( $request );
2021-08-16 09:35:47 +02:00
self :: assertSame ( 200 , $result -> getStatusCode ());
self :: assertStringContainsString ( 'Tiere erlaubt' , ( string ) $result -> getBody ());
2021-08-12 09:19:16 +02:00
}
2021-08-23 16:23:23 +02:00
2023-11-30 13:52:23 +01:00
#[Test]
2021-08-17 11:50:11 +02:00
public function touristAttractionWithIsAccessibleForFreeFalse () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractionsForIsAccessibleForFree.php' );
2021-08-17 11:50:11 +02:00
$request = new InternalRequest ();
$request = $request -> withPageId ( 4 );
2023-11-30 13:52:23 +01:00
$result = $this -> executeFrontendSubRequest ( $request );
2021-08-17 11:50:11 +02:00
self :: assertSame ( 200 , $result -> getStatusCode ());
self :: assertStringContainsString ( 'kein freier Eintritt' , ( string ) $result -> getBody ());
}
2023-11-30 13:52:23 +01:00
#[Test]
2021-08-17 11:50:11 +02:00
public function touristAttractionWithIsAccessibleForFreeTrue () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractionsForIsAccessibleForFree.php' );
2021-08-17 11:50:11 +02:00
$request = new InternalRequest ();
$request = $request -> withPageId ( 5 );
2023-11-30 13:52:23 +01:00
$result = $this -> executeFrontendSubRequest ( $request );
2021-08-17 11:50:11 +02:00
self :: assertSame ( 200 , $result -> getStatusCode ());
self :: assertStringContainsString ( 'freier Eintritt' , ( string ) $result -> getBody ());
}
2023-11-30 13:52:23 +01:00
#[Test]
2021-08-17 14:01:48 +02:00
public function touristAttractionWithPublicAccessFalse () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractionsForPublicAccess.php' );
2021-08-17 14:01:48 +02:00
$request = new InternalRequest ();
$request = $request -> withPageId ( 4 );
2023-11-30 13:52:23 +01:00
$result = $this -> executeFrontendSubRequest ( $request );
2021-08-17 14:01:48 +02:00
self :: assertSame ( 200 , $result -> getStatusCode ());
self :: assertStringContainsString ( 'nicht öffentlich zugänglich' , ( string ) $result -> getBody ());
}
2023-11-30 13:52:23 +01:00
#[Test]
2021-08-17 14:01:48 +02:00
public function touristAttractionWithPublicAccessTrue () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractionsForPublicAccess.php' );
2021-08-17 14:01:48 +02:00
$request = new InternalRequest ();
$request = $request -> withPageId ( 5 );
2023-11-30 13:52:23 +01:00
$result = $this -> executeFrontendSubRequest ( $request );
2021-08-17 14:01:48 +02:00
self :: assertSame ( 200 , $result -> getStatusCode ());
self :: assertStringContainsString ( 'öffentlich zugänglich' , ( string ) $result -> getBody ());
}
2023-11-30 13:52:23 +01:00
#[Test]
2021-08-23 16:23:23 +02:00
public function pricesAreSorted () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractionWithPrices.php' );
2021-08-23 16:23:23 +02:00
$request = new InternalRequest ();
$request = $request -> withPageId ( 2 );
2023-11-30 13:52:23 +01:00
$result = $this -> executeFrontendSubRequest ( $request );
2021-08-23 16:23:23 +02:00
self :: assertSame ( 200 , $result -> getStatusCode ());
self :: assertStringContainsString ( 'Attraktion mit Preisen' , ( string ) $result -> getBody ());
2021-09-14 14:39:28 +02:00
self :: assertGreaterThan (
2021-08-23 16:23:23 +02:00
mb_strpos (( string ) $result -> getBody (), 'Erwachsene' ),
2021-09-14 14:39:28 +02:00
mb_strpos (( string ) $result -> getBody (), 'Familienkarte A' ),
'"Erwachsene" is not rendered before "Familienkarte A"'
2021-08-23 16:23:23 +02:00
);
2021-09-14 14:39:28 +02:00
self :: assertGreaterThan (
2021-08-23 16:23:23 +02:00
mb_strpos (( string ) $result -> getBody (), 'Familienkarte A' ),
2021-09-14 14:39:28 +02:00
mb_strpos (( string ) $result -> getBody (), 'Familienkarte B' ),
'"Familienkarte A" is not rendered before "Familienkarte B"'
2021-08-23 16:23:23 +02:00
);
2021-09-14 14:39:28 +02:00
self :: assertGreaterThan (
2021-08-23 16:23:23 +02:00
mb_strpos (( string ) $result -> getBody (), 'Familienkarte B' ),
2021-09-14 14:39:28 +02:00
mb_strpos (( string ) $result -> getBody (), 'Schulklassen' ),
'"Familienkarte B" is not rendered before "Schulklassen"'
);
}
2023-11-30 13:52:23 +01:00
#[Test]
2021-09-14 14:39:28 +02:00
public function offersAreSortedByType () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractionWithOfferTypes.php' );
2021-09-14 14:39:28 +02:00
$request = new InternalRequest ();
$request = $request -> withPageId ( 2 );
2023-11-30 13:52:23 +01:00
$result = $this -> executeFrontendSubRequest ( $request );
2021-09-14 14:39:28 +02:00
self :: assertSame ( 200 , $result -> getStatusCode ());
self :: assertStringContainsString ( 'Attraktion mit Angebotstypen' , ( string ) $result -> getBody ());
self :: assertGreaterThan (
mb_strpos (( string ) $result -> getBody (), 'Eintritt 1' ),
mb_strpos (( string ) $result -> getBody (), 'Eintritt 2' ),
'"Eintritt 1" is not rendered before "Eintritt 2"'
);
self :: assertGreaterThan (
mb_strpos (( string ) $result -> getBody (), 'Eintritt 2' ),
mb_strpos (( string ) $result -> getBody (), 'Führungen' ),
'"Eintritt 2" is not rendered before "Führungen"'
);
self :: assertGreaterThan (
mb_strpos (( string ) $result -> getBody (), 'Führungen' ),
mb_strpos (( string ) $result -> getBody (), 'Parkgebühr' ),
'"Führungen" is not rendered before "Parkgebühr"'
);
self :: assertGreaterThan (
mb_strpos (( string ) $result -> getBody (), 'Parkgebühr' ),
mb_strpos (( string ) $result -> getBody (), 'Verkostung' ),
'"Parkgebühr" is not rendered before "Verkostung"'
2021-08-23 16:23:23 +02:00
);
}
2022-11-24 15:55:50 +01:00
2023-11-30 13:52:23 +01:00
#[Test]
2022-11-24 15:55:50 +01:00
public function openingHoursAreFilteredByThough () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractionsOpeningHours.php' );
2022-11-24 15:55:50 +01:00
2023-11-30 13:52:23 +01:00
$hidden = new DateTimeImmutable ( 'yesterday' );
$available = new DateTimeImmutable ( 'tomorrow' );
2022-11-24 15:55:50 +01:00
$this -> getConnectionPool ()
-> getConnectionForTable ( 'tx_thuecat_tourist_attraction' )
-> update (
'tx_thuecat_tourist_attraction' ,
[ 'opening_hours' => json_encode ([
[
2022-11-29 10:02:44 +01:00
'closes' => '14:00:00' ,
2022-11-24 15:55:50 +01:00
'opens' => '13:00:00' ,
'daysOfWeek' => [ 'Sunday' ],
'from' => [
'date' => $hidden -> modify ( '-1 day' ) -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
'through' => [
'date' => $hidden -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
],
[
2022-11-29 10:02:44 +01:00
'closes' => '16:00:00' ,
'opens' => '15:00:00' ,
2022-11-24 15:55:50 +01:00
'daysOfWeek' => [ 'Sunday' ],
'from' => [
'date' => $available -> modify ( '-1 day' ) -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
'through' => [
'date' => $available -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
],
])],
[ 'uid' => 1 ]
2023-11-30 13:52:23 +01:00
)
;
2022-11-24 15:55:50 +01:00
$request = new InternalRequest ();
$request = $request -> withPageId ( 2 );
2023-11-30 13:52:23 +01:00
$result = ( string ) $this -> executeFrontendSubRequest ( $request ) -> getBody ();
2022-11-24 15:55:50 +01:00
2022-11-29 10:02:44 +01:00
self :: assertStringNotContainsString ( '14:00' , $result );
self :: assertStringNotContainsString ( '13:00' , $result );
self :: assertStringNotContainsString ( '16:00:00' , $result );
self :: assertStringContainsString ( '16:00' , $result );
self :: assertStringNotContainsString ( '15:00:00' , $result );
self :: assertStringContainsString ( '15:00' , $result );
2022-11-24 15:55:50 +01:00
self :: assertStringNotContainsString ( $hidden -> modify ( '-1 day' ) -> format ( 'd.m.Y' ), $result );
self :: assertStringNotContainsString ( $hidden -> format ( 'd.m.Y' ), $result );
self :: assertStringContainsString ( $available -> modify ( '-1 day' ) -> format ( 'd.m.Y' ), $result );
self :: assertStringContainsString ( $available -> format ( 'd.m.Y' ), $result );
}
2023-11-30 13:52:23 +01:00
#[Test]
2022-11-24 15:55:50 +01:00
public function openingHoursAreSortedByFrom () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractionsOpeningHours.php' );
2022-11-24 15:55:50 +01:00
2023-11-30 13:52:23 +01:00
$fromFirstOpening = new DateTimeImmutable ( 'today' );
$fromSecondOpening = new DateTimeImmutable ( '+2 days' );
$fromThirdOpening = new DateTimeImmutable ( '+7 days' );
2022-11-24 15:55:50 +01:00
$this -> getConnectionPool ()
-> getConnectionForTable ( 'tx_thuecat_tourist_attraction' )
-> update (
'tx_thuecat_tourist_attraction' ,
[ 'opening_hours' => json_encode ([
[
'closes' => '17:00:00' ,
'opens' => '13:00:00' ,
'daysOfWeek' => [ 'Sunday' ],
'from' => [
'date' => $fromThirdOpening -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
'through' => [
'date' => $fromThirdOpening -> modify ( '+1 day' ) -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
],
[
'closes' => '17:00:00' ,
'opens' => '13:00:00' ,
'daysOfWeek' => [ 'Sunday' ],
'from' => [
'date' => $fromFirstOpening -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
'through' => [
'date' => $fromFirstOpening -> modify ( '+1 day' ) -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
],
[
'closes' => '17:00:00' ,
'opens' => '13:00:00' ,
'daysOfWeek' => [ 'Sunday' ],
'from' => [
'date' => $fromSecondOpening -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
'through' => [
'date' => $fromSecondOpening -> modify ( '+1 day' ) -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
],
])],
[ 'uid' => 1 ]
2023-11-30 13:52:23 +01:00
)
;
2022-11-24 15:55:50 +01:00
$request = new InternalRequest ();
$request = $request -> withPageId ( 2 );
2023-11-30 13:52:23 +01:00
$result = ( string ) $this -> executeFrontendSubRequest ( $request ) -> getBody ();
2022-11-24 15:55:50 +01:00
$positionFirstHour = mb_strpos ( $result , $fromFirstOpening -> format ( 'd.m.Y' ));
$positionSecondHour = mb_strpos ( $result , $fromSecondOpening -> format ( 'd.m.Y' ));
$positionThirdHour = mb_strpos ( $result , $fromThirdOpening -> format ( 'd.m.Y' ));
self :: assertLessThan ( $positionThirdHour , $positionSecondHour , 'Third hour does not come after second hour.' );
self :: assertLessThan ( $positionSecondHour , $positionFirstHour , 'Second hour does not come after first hour.' );
}
2022-11-28 11:06:54 +01:00
2023-11-30 13:52:23 +01:00
#[Test]
2022-11-28 11:06:54 +01:00
public function specialOpeningHoursAreRendered () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractionsOpeningHours.php' );
2022-11-28 11:06:54 +01:00
2023-11-30 13:52:23 +01:00
$hidden = new DateTimeImmutable ( 'yesterday' );
$available = new DateTimeImmutable ( 'tomorrow' );
$available2 = new DateTimeImmutable ( '+3 days' );
2022-11-28 11:06:54 +01:00
$this -> getConnectionPool ()
-> getConnectionForTable ( 'tx_thuecat_tourist_attraction' )
-> update (
'tx_thuecat_tourist_attraction' ,
[ 'special_opening_hours' => json_encode ([
[
2022-11-29 10:02:44 +01:00
'closes' => '12:00:00' ,
'opens' => '11:00:00' ,
2022-11-28 11:06:54 +01:00
'daysOfWeek' => [ 'Sunday' ],
'from' => [
'date' => $hidden -> modify ( '-1 day' ) -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
'through' => [
'date' => $hidden -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
],
[
2022-11-29 10:02:44 +01:00
'closes' => '14:00:00' ,
2022-11-28 11:06:54 +01:00
'opens' => '13:00:00' ,
'daysOfWeek' => [ 'Sunday' ],
'from' => [
'date' => $available2 -> modify ( '-1 day' ) -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
'through' => [
'date' => $available2 -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
],
[
2022-11-29 10:02:44 +01:00
'closes' => '16:00:00' ,
'opens' => '15:00:00' ,
2022-11-28 11:06:54 +01:00
'daysOfWeek' => [ 'Sunday' ],
'from' => [
'date' => $available -> modify ( '-1 day' ) -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
'through' => [
'date' => $available -> format ( 'Y-m-d' ) . ' 00:00:00.000000' ,
'timezone' => 'UTC' ,
'timezone_type' => 3 ,
],
],
])],
[ 'uid' => 1 ]
2023-11-30 13:52:23 +01:00
)
;
2022-11-28 11:06:54 +01:00
$request = new InternalRequest ();
$request = $request -> withPageId ( 2 );
2023-11-30 13:52:23 +01:00
$result = ( string ) $this -> executeFrontendSubRequest ( $request ) -> getBody ();
2022-11-28 11:06:54 +01:00
2022-11-29 10:02:44 +01:00
self :: assertStringNotContainsString ( '11:00' , $result );
self :: assertStringNotContainsString ( '12:00' , $result );
self :: assertStringNotContainsString ( '14:00:00' , $result );
self :: assertStringContainsString ( '14:00' , $result );
self :: assertStringNotContainsString ( '13:00:00' , $result );
self :: assertStringContainsString ( '13:00' , $result );
self :: assertStringNotContainsString ( '16:00:00' , $result );
self :: assertStringContainsString ( '16:00' , $result );
self :: assertStringNotContainsString ( '15:00:00' , $result );
self :: assertStringContainsString ( '15:00' , $result );
2022-11-28 11:06:54 +01:00
self :: assertStringNotContainsString ( $hidden -> modify ( '-1 day' ) -> format ( 'd.m.Y' ), $result , 'Filtered date is shown' );
self :: assertStringNotContainsString ( $hidden -> format ( 'd.m.Y' ), $result , 'Filtered date is shown' );
self :: assertStringContainsString ( $available -> modify ( '-1 day' ) -> format ( 'd.m.Y' ), $result , 'First special opening hour is missing' );
self :: assertStringContainsString ( $available -> format ( 'd.m.Y' ), $result , 'First special opening hour is missing' );
self :: assertStringContainsString ( $available2 -> modify ( '-1 day' ) -> format ( 'd.m.Y' ), $result , 'Second special opening hour is missing' );
self :: assertStringContainsString ( $available2 -> format ( 'd.m.Y' ), $result , 'Second special opening hour is missing' );
$positionFirstHour = mb_strpos ( $result , $available -> format ( 'd.m.Y' ));
$positionSecondHour = mb_strpos ( $result , $available2 -> format ( 'd.m.Y' ));
self :: assertLessThan ( $positionSecondHour , $positionFirstHour , 'Second hour does not come after first hour.' );
}
2023-08-29 13:54:16 +02:00
2023-11-30 13:52:23 +01:00
#[Test]
2023-08-29 13:54:16 +02:00
public function editorialImagesOfTouristAttractionAreRenderedForDefaultLanguage () : void
{
2023-11-30 13:52:23 +01:00
$this -> importPHPDataSet ( __DIR__ . '/Fixtures/Frontend/TouristAttractionWithEditorialImages.php' );
2023-08-29 13:54:16 +02:00
$request = new InternalRequest ();
$request = $request -> withPageId ( 2 );
2023-11-30 13:52:23 +01:00
$html = ( string ) $this -> executeFrontendSubRequest ( $request ) -> getBody ();
2023-08-29 13:54:16 +02:00
self :: assertStringContainsString (
'<img src="/fileadmin/tourismus/images/inhalte/sehenswertes/parks_gaerten/hirschgarten/2998_Spielplaetze_Hirschgarten.jpg" width="" height="" alt="" />' ,
$html
);
self :: assertStringContainsString (
'<img src="/fileadmin/tourismus/images/inhalte/sehenswertes/sehenswuerdigkeiten/Petersberg/20_Erfurt-Schriftzug_Petersberg_2021__c_Stadtverwaltung_Erfurt_CC-BY-NC-SA.JPG" width="" height="" alt="" />' ,
$html ,
);
}
2021-08-12 09:19:16 +02:00
}