diff --git a/Tests/Functional/Controller/Fixtures/Database/ContentElementTeaIndex.csv b/Tests/Functional/Controller/Fixtures/Database/ContentElementTeaIndex.csv new file mode 100644 index 0000000..d30958c --- /dev/null +++ b/Tests/Functional/Controller/Fixtures/Database/ContentElementTeaIndex.csv @@ -0,0 +1,3 @@ +tt_content +,uid,pid,CType,header,list_type +,1,1,list,Teas Index,tea_teaindex diff --git a/Tests/Functional/Controller/Fixtures/Database/SiteStructure.csv b/Tests/Functional/Controller/Fixtures/Database/SiteStructure.csv new file mode 100644 index 0000000..0982959 --- /dev/null +++ b/Tests/Functional/Controller/Fixtures/Database/SiteStructure.csv @@ -0,0 +1,4 @@ +pages +,uid,pid,title,slug +,1,0,Rootpage,/ +,2,1,Storage,/storage diff --git a/Tests/Functional/Controller/Fixtures/Database/Teas.csv b/Tests/Functional/Controller/Fixtures/Database/Teas.csv new file mode 100644 index 0000000..be0b7d4 --- /dev/null +++ b/Tests/Functional/Controller/Fixtures/Database/Teas.csv @@ -0,0 +1,4 @@ +"tx_tea_domain_model_product_tea" +,"uid","pid","title" +,1,2,"Godesberger Burgtee" +,2,2,"Oolong" diff --git a/Tests/Functional/Controller/Fixtures/Sites/default/config.yaml b/Tests/Functional/Controller/Fixtures/Sites/default/config.yaml new file mode 100644 index 0000000..7eecb62 --- /dev/null +++ b/Tests/Functional/Controller/Fixtures/Sites/default/config.yaml @@ -0,0 +1,16 @@ +base: '/' +languages: + - + title: English + enabled: true + languageId: '0' + base: / + typo3Language: default + locale: en_US.utf8 + iso-639-1: en + navigationTitle: English + hreflang: en-us + direction: ltr + flag: us + websiteTitle: '' +rootPageId: 1 diff --git a/Tests/Functional/Controller/Fixtures/TypoScript/Rendering.typoscript b/Tests/Functional/Controller/Fixtures/TypoScript/Rendering.typoscript new file mode 100644 index 0000000..cd4ac40 --- /dev/null +++ b/Tests/Functional/Controller/Fixtures/TypoScript/Rendering.typoscript @@ -0,0 +1,4 @@ +page = PAGE +page { + 10 < styles.content.get +} diff --git a/Tests/Functional/Controller/TeaControllerTest.php b/Tests/Functional/Controller/TeaControllerTest.php new file mode 100644 index 0000000..00d137a --- /dev/null +++ b/Tests/Functional/Controller/TeaControllerTest.php @@ -0,0 +1,52 @@ + 'typo3conf/sites', + ]; + + protected function setUp(): void + { + parent::setUp(); + + $this->importCSVDataSet(__DIR__ . '/Fixtures/Database/SiteStructure.csv'); + $this->setUpFrontendRootPage(1, [ + 'setup' => [ + 'EXT:fluid_styled_content/Configuration/TypoScript/setup.typoscript', + 'EXT:tea/Tests/Functional/Controller/Fixtures/TypoScript/Rendering.typoscript', + ], + ]); + } + + /** + * @test + */ + public function indexActionRendersAllAvailableTeas(): void + { + $this->importCSVDataSet(__DIR__ . '/Fixtures/Database/ContentElementTeaIndex.csv'); + $this->importCSVDataSet(__DIR__ . '/Fixtures/Database/Teas.csv'); + + $request = new InternalRequest(); + $request = $request->withPageId(1); + + $html = $this->executeFrontendRequest($request)->getBody()->__toString(); + + self::assertStringContainsString('Godesberger Burgtee', $html); + self::assertStringContainsString('Oolong', $html); + } +}