2023-11-27 14:18:04 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace TTN\Tea\Tests\Functional\Controller;
|
|
|
|
|
2024-07-31 14:33:08 +02:00
|
|
|
use TYPO3\CMS\Core\Utility\ArrayUtility;
|
2023-11-27 14:18:04 +01:00
|
|
|
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
|
|
|
|
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers \TTN\Tea\Controller\TeaController
|
|
|
|
*/
|
|
|
|
final class TeaControllerTest extends FunctionalTestCase
|
|
|
|
{
|
|
|
|
protected array $testExtensionsToLoad = ['ttn/tea'];
|
|
|
|
|
|
|
|
protected array $coreExtensionsToLoad = ['typo3/cms-fluid-styled-content'];
|
|
|
|
|
|
|
|
protected array $pathsToLinkInTestInstance = [
|
|
|
|
'typo3conf/ext/tea/Tests/Functional/Controller/Fixtures/Sites/' => 'typo3conf/sites',
|
|
|
|
];
|
|
|
|
|
|
|
|
protected function setUp(): void
|
|
|
|
{
|
2024-07-31 14:33:08 +02:00
|
|
|
ArrayUtility::mergeRecursiveWithOverrule($this->configurationToUseInTestInstance, [
|
|
|
|
'FE' => [
|
|
|
|
'cacheHash' => [
|
|
|
|
'enforceValidation' => false,
|
|
|
|
],
|
|
|
|
]
|
|
|
|
]);
|
|
|
|
|
2023-11-27 14:18:04 +01:00
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/SiteStructure.csv');
|
|
|
|
$this->setUpFrontendRootPage(1, [
|
2024-04-15 09:24:22 +02:00
|
|
|
'constants' => [
|
|
|
|
'EXT:fluid_styled_content/Configuration/TypoScript/constants.typoscript',
|
|
|
|
'EXT:tea/Configuration/TypoScript/constants.typoscript',
|
2024-04-15 11:13:57 +02:00
|
|
|
'EXT:tea/Tests/Functional/Controller/Fixtures/TypoScript/Constants/PluginConfiguration.typoscript',
|
2024-04-15 09:24:22 +02:00
|
|
|
],
|
2023-11-27 14:18:04 +01:00
|
|
|
'setup' => [
|
|
|
|
'EXT:fluid_styled_content/Configuration/TypoScript/setup.typoscript',
|
2024-04-15 09:24:22 +02:00
|
|
|
'EXT:tea/Configuration/TypoScript/setup.typoscript',
|
2024-04-15 07:19:53 +02:00
|
|
|
'EXT:tea/Tests/Functional/Controller/Fixtures/TypoScript/Setup/Rendering.typoscript',
|
2023-11-27 14:18:04 +01:00
|
|
|
],
|
|
|
|
]);
|
2024-07-31 14:33:08 +02:00
|
|
|
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/ContentElementTeaIndex.csv');
|
|
|
|
$this->importCSVDataSet(__DIR__ . '/Fixtures/Database/Teas.csv');
|
2023-11-27 14:18:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
|
|
|
public function indexActionRendersAllAvailableTeas(): void
|
|
|
|
{
|
2024-12-10 20:47:54 +01:00
|
|
|
$request = (new InternalRequest())->withPageId(1);
|
2023-11-27 14:18:04 +01:00
|
|
|
|
2024-01-24 13:21:49 +01:00
|
|
|
$html = (string)$this->executeFrontendSubRequest($request)->getBody();
|
2023-11-27 14:18:04 +01:00
|
|
|
|
|
|
|
self::assertStringContainsString('Godesberger Burgtee', $html);
|
|
|
|
self::assertStringContainsString('Oolong', $html);
|
|
|
|
}
|
2024-07-31 14:33:08 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
|
|
|
public function showActionRendersTheGivenTeas(): void
|
|
|
|
{
|
2024-07-31 19:38:49 +02:00
|
|
|
$request = (new InternalRequest())->withPageId(1)->withQueryParameters(['tx_tea_teashow[tea]' => 1]);
|
2024-07-31 14:33:08 +02:00
|
|
|
|
|
|
|
$html = (string)$this->executeFrontendSubRequest($request)->getBody();
|
|
|
|
|
|
|
|
self::assertStringContainsString('Godesberger Burgtee', $html);
|
|
|
|
self::assertStringNotContainsString('Oolong', $html);
|
|
|
|
}
|
2023-11-27 14:18:04 +01:00
|
|
|
}
|