Skip to content

Commit

Permalink
[TASK] Add functional tests for showAction (#1419)
Browse files Browse the repository at this point in the history
Fixes #1228
  • Loading branch information
Starkmann authored Jan 4, 2025
1 parent 5260d3d commit 45f9479
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"tt_content"
,"uid","pid","CType","header","list_type"
,1,1,"list","Tea index","tea_teaindex"
,2,3,"list","Tea show","tea_teashow"
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
,"uid","pid","title","slug"
,1,0,"Rootpage","/"
,2,1,"Storage","/storage"
,3,1,"Show","/show"
26 changes: 23 additions & 3 deletions Tests/Functional/Controller/TeaControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ final class TeaControllerTest extends FunctionalTestCase
'typo3conf/ext/tea/Tests/Functional/Controller/Fixtures/Sites/' => 'typo3conf/sites',
];

protected array $configurationToUseInTestInstance = [
'FE' => [
'cacheHash' => [
'enforceValidation' => false,
],
],
];

protected function setUp(): void
{
parent::setUp();
Expand All @@ -37,21 +45,33 @@ protected function setUp(): void
'EXT:tea/Tests/Functional/Controller/Fixtures/TypoScript/Setup/Rendering.typoscript',
],
]);
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/ContentElementTeaIndex.csv');
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/Teas.csv');
}

/**
* @test
*/
public function indexActionRendersAllAvailableTeas(): void
{
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/ContentElementTeaIndex.csv');
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/Teas.csv');

$request = (new InternalRequest())->withPageId(1);

$html = (string)$this->executeFrontendSubRequest($request)->getBody();

self::assertStringContainsString('Godesberger Burgtee', $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);
}
}

0 comments on commit 45f9479

Please sign in to comment.