‪TYPO3CMS  11.5
PageViewHelperTest.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 
22 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
23 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
24 
25 class ‪PageViewHelperTest extends FunctionalTestCase
26 {
28 
29  protected const ‪LANGUAGE_PRESETS = [];
30 
31  public function ‪renderDataProvider(): array
32  {
33  return [
34  'renderProvidesATagForValidLinkTarget' => [
35  '<f:link.page>index.php</f:link.page>',
36  '<a href="/">index.php</a>',
37  ],
38  'renderWillProvideEmptyATagForNonValidLinkTarget' => [
39  '<f:link.page></f:link.page>',
40  '<a href="/"></a>',
41  ],
42  'link to root page' => [
43  '<f:link.page pageUid="1">linkMe</f:link.page>',
44  '<a href="/">linkMe</a>',
45  ],
46  'link to root page with page type' => [
47  '<f:link.page pageUid="1" pageType="1234">linkMe</f:link.page>',
48  '<a href="/?type=1234">linkMe</a>',
49  ],
50  'link to page sub page' => [
51  '<f:link.page pageUid="3">linkMe</f:link.page>',
52  '<a href="/dummy-1-2/dummy-1-2-3">linkMe</a>',
53  ],
54  ];
55  }
56 
61  public function ‪render(string $template, string $expected): void
62  {
63  $this->importCSVDataSet(__DIR__ . '/../../Fixtures/pages.csv');
65  'test',
66  $this->‪buildSiteConfiguration(1, '/'),
67  );
68  (new ‪ConnectionPool())->getConnectionForTable('sys_template')->insert('sys_template', [
69  'pid' => 1,
70  'root' => 1,
71  'clear' => 1,
72  'config' => <<<EOT
73 page = PAGE
74 page.10 = FLUIDTEMPLATE
75 page.10 {
76  template = TEXT
77  template.value = $template
78 }
79 EOT
80  ]);
81  $response = $this->executeFrontendSubRequest((new InternalRequest())->withPageId(1));
82  self::assertStringContainsString($expected, (string)$response->getBody());
83  }
84 }
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait
Definition: SiteBasedTestTrait.php:36
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\writeSiteConfiguration
‪writeSiteConfiguration(string $identifier, array $site=[], array $languages=[], array $errorHandling=[])
Definition: SiteBasedTestTrait.php:58
‪TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait\buildSiteConfiguration
‪array buildSiteConfiguration(int $rootPageId, string $base='')
Definition: SiteBasedTestTrait.php:111
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:46