mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2025-01-08 08:26:10 +01:00

[TASK] Add functional tests for showAction (#1419)

Fixes #1228
This commit is contained in:
Eike Starkmann 2025-01-04 14:26:13 +01:00 committed by GitHub
parent 5260d3d939
commit 45f9479e58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 3 deletions

View file

@ -1,3 +1,4 @@
"tt_content" "tt_content"
,"uid","pid","CType","header","list_type" ,"uid","pid","CType","header","list_type"
,1,1,"list","Tea index","tea_teaindex" ,1,1,"list","Tea index","tea_teaindex"
,2,3,"list","Tea show","tea_teashow"

Can't render this file because it has a wrong number of fields in line 2.

View file

@ -2,3 +2,4 @@
,"uid","pid","title","slug" ,"uid","pid","title","slug"
,1,0,"Rootpage","/" ,1,0,"Rootpage","/"
,2,1,"Storage","/storage" ,2,1,"Storage","/storage"
,3,1,"Show","/show"

Can't render this file because it has a wrong number of fields in line 2.

View file

@ -20,6 +20,14 @@ final class TeaControllerTest extends FunctionalTestCase
'typo3conf/ext/tea/Tests/Functional/Controller/Fixtures/Sites/' => 'typo3conf/sites', 'typo3conf/ext/tea/Tests/Functional/Controller/Fixtures/Sites/' => 'typo3conf/sites',
]; ];
protected array $configurationToUseInTestInstance = [
'FE' => [
'cacheHash' => [
'enforceValidation' => false,
],
],
];
protected function setUp(): void protected function setUp(): void
{ {
parent::setUp(); parent::setUp();
@ -37,6 +45,8 @@ final class TeaControllerTest extends FunctionalTestCase
'EXT:tea/Tests/Functional/Controller/Fixtures/TypoScript/Setup/Rendering.typoscript', 'EXT:tea/Tests/Functional/Controller/Fixtures/TypoScript/Setup/Rendering.typoscript',
], ],
]); ]);
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/ContentElementTeaIndex.csv');
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/Teas.csv');
} }
/** /**
@ -44,9 +54,6 @@ final class TeaControllerTest extends FunctionalTestCase
*/ */
public function indexActionRendersAllAvailableTeas(): void public function indexActionRendersAllAvailableTeas(): void
{ {
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/ContentElementTeaIndex.csv');
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/Teas.csv');
$request = (new InternalRequest())->withPageId(1); $request = (new InternalRequest())->withPageId(1);
$html = (string)$this->executeFrontendSubRequest($request)->getBody(); $html = (string)$this->executeFrontendSubRequest($request)->getBody();
@ -54,4 +61,17 @@ final class TeaControllerTest extends FunctionalTestCase
self::assertStringContainsString('Godesberger Burgtee', $html); self::assertStringContainsString('Godesberger Burgtee', $html);
self::assertStringContainsString('Oolong', $html); self::assertStringContainsString('Oolong', $html);
} }
/**
* @test
*/
public function showActionRendersTheGivenTeas(): void
{
$request = (new InternalRequest())->withPageId(3)->withQueryParameters(['tx_tea_teashow[tea]' => 1]);
$html = (string)$this->executeFrontendSubRequest($request)->getBody();
self::assertStringContainsString('Godesberger Burgtee', $html);
self::assertStringNotContainsString('Oolong', $html);
}
} }