‪TYPO3CMS  ‪main
PageViewContentObjectTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use PHPUnit\Framework\Attributes\Test;
22 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
23 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
24 
25 final class ‪PageViewContentObjectTest extends FunctionalTestCase
26 {
28 
29  protected const ‪LANGUAGE_PRESETS = [
30  'EN' => ['id' => 0, 'title' => 'English', 'locale' => 'en-US'],
31  'FR' => ['id' => 1, 'title' => 'French', 'locale' => 'fr-FR'],
32  ];
33  protected const ‪ROOT_PAGE_ID = 1;
34 
35  protected array ‪$testExtensionsToLoad = [
36  'typo3/sysext/frontend/Tests/Functional/Fixtures/Extensions/test_fluidpagerendering',
37  ];
38 
39  public function ‪setUp(): void
40  {
41  parent::setUp();
42  $this->importCSVDataSet(__DIR__ . '/Fixtures/FluidPage/pages.csv');
44  'pageview_template',
45  $this->‪buildSiteConfiguration(self::ROOT_PAGE_ID, '/'),
46  [
47  $this->‪buildDefaultLanguageConfiguration('EN', '/'),
48  $this->‪buildLanguageConfiguration('FR', '/fr'),
49  ],
50  );
51  }
52 
53  #[Test]
55  {
56  $this->setUpFrontendRootPage(
57  self::ROOT_PAGE_ID,
58  [
59  'EXT:frontend/Tests/Functional/Fixtures/Extensions/test_fluidpagerendering/Configuration/TypoScript/plain.typoscript',
60  ]
61  );
62  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::ROOT_PAGE_ID));
63  self::assertStringContainsString('You are on page Fluid Root Page', (string)$response->getBody());
64  self::assertStringContainsString('This is a standard page with no content.', (string)$response->getBody());
65  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::ROOT_PAGE_ID)->withLanguageId(1));
66  self::assertStringContainsString('Vous êtes à la page Fluid Root Page FR', (string)$response->getBody());
67  }
68 
69  #[Test]
71  {
72  $this->setUpFrontendRootPage(
73  self::ROOT_PAGE_ID,
74  [
75  'EXT:frontend/Tests/Functional/Fixtures/Extensions/test_fluidpagerendering/Configuration/TypoScript/plain.typoscript',
76  ]
77  );
78  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(self::ROOT_PAGE_ID)->withQueryParameter('type', 123));
79  self::assertStringContainsString('You are on page Fluid Root Page', (string)$response->getBody());
80  self::assertStringContainsString('This is a standard page with no content.', (string)$response->getBody());
81  }
82 }
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildLanguageConfiguration
‪buildLanguageConfiguration(string $identifier, string $base, array $fallbackIdentifiers=[], string $fallbackType=null)
Definition: SiteBasedTestTrait.php:108
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\PageViewContentObjectTest\ROOT_PAGE_ID
‪const ROOT_PAGE_ID
Definition: PageViewContentObjectTest.php:32
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\PageViewContentObjectTest\renderWorksWithPlainRenderingWithLowerCasePaths
‪renderWorksWithPlainRenderingWithLowerCasePaths()
Definition: PageViewContentObjectTest.php:69
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait
Definition: SiteBasedTestTrait.php:37
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\writeSiteConfiguration
‪writeSiteConfiguration(string $identifier, array $site=[], array $languages=[], array $errorHandling=[])
Definition: SiteBasedTestTrait.php:50
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildSiteConfiguration
‪buildSiteConfiguration(int $rootPageId, string $base='')
Definition: SiteBasedTestTrait.php:88
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\PageViewContentObjectTest\$testExtensionsToLoad
‪array $testExtensionsToLoad
Definition: PageViewContentObjectTest.php:34
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\PageViewContentObjectTest
Definition: PageViewContentObjectTest.php:26
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildDefaultLanguageConfiguration
‪buildDefaultLanguageConfiguration(string $identifier, string $base)
Definition: SiteBasedTestTrait.php:98
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\PageViewContentObjectTest\setUp
‪setUp()
Definition: PageViewContentObjectTest.php:38
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject
Definition: ContentContentObjectTest.php:18
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\PageViewContentObjectTest\renderWorksWithPlainRenderingInMultipleLanguages
‪renderWorksWithPlainRenderingInMultipleLanguages()
Definition: PageViewContentObjectTest.php:53
‪TYPO3\CMS\Frontend\Tests\Functional\ContentObject\PageViewContentObjectTest\LANGUAGE_PRESETS
‪const LANGUAGE_PRESETS
Definition: PageViewContentObjectTest.php:28