‪TYPO3CMS  ‪main
SysTemplateRepositoryTest.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\FunctionalTestCase;
23 
24 final class ‪SysTemplateRepositoryTest extends FunctionalTestCase
25 {
26  #[Test]
27  public function ‪singleRootTemplate(): void
28  {
29  $this->importCSVDataSet(__DIR__ . '/Fixtures/SysTemplate/singleRootTemplate.csv');
30  $rootline = [
31  [
32  'uid' => 1,
33  'pid' => 0,
34  'is_siteroot' => 0,
35  ],
36  ];
37  $sysTemplateRepository = $this->get(SysTemplateRepository::class);
38  $result = $sysTemplateRepository->getSysTemplateRowsByRootline($rootline);
39  self::assertSame(1, $result[0]['uid']);
40  $result = $sysTemplateRepository->getSysTemplateRowsByRootlineWithUidOverride($rootline, null, 1);
41  self::assertSame(1, $result[0]['uid']);
42  }
43 
44  #[Test]
45  public function ‪twoPagesTwoTemplates(): void
46  {
47  $this->importCSVDataSet(__DIR__ . '/Fixtures/SysTemplate/twoPagesTwoTemplates.csv');
48  $rootline = [
49  [
50  'uid' => 2,
51  'pid' => 1,
52  'is_siteroot' => 0,
53  ],
54  [
55  'uid' => 1,
56  'pid' => 0,
57  'is_siteroot' => 0,
58  ],
59  ];
60  $sysTemplateRepository = $this->get(SysTemplateRepository::class);
61  $result = $sysTemplateRepository->getSysTemplateRowsByRootline($rootline);
62  self::assertSame(1, $result[0]['uid']);
63  self::assertSame(2, $result[1]['uid']);
64  $result = $sysTemplateRepository->getSysTemplateRowsByRootlineWithUidOverride($rootline, null, 2);
65  self::assertSame(1, $result[0]['uid']);
66  self::assertSame(2, $result[1]['uid']);
67  }
68 
69  #[Test]
71  {
72  $this->importCSVDataSet(__DIR__ . '/Fixtures/SysTemplate/twoTemplatesOnPage.csv');
73  $rootline = [
74  [
75  'uid' => 1,
76  'pid' => 0,
77  'is_siteroot' => 0,
78  ],
79  ];
80  $sysTemplateRepository = $this->get(SysTemplateRepository::class);
81  $result = $sysTemplateRepository->getSysTemplateRowsByRootline($rootline);
82  self::assertSame(1, $result[0]['uid']);
83  $result = $sysTemplateRepository->getSysTemplateRowsByRootlineWithUidOverride($rootline, null, 2);
84  self::assertSame(2, $result[0]['uid']);
85  }
86 }
‪TYPO3\CMS\Core\TypoScript\IncludeTree\SysTemplateRepository
Definition: SysTemplateRepository.php:38
‪TYPO3\CMS\Core\Tests\Functional\TypoScript\IncludeTree\SysTemplateRepositoryTest\singleRootTemplate
‪singleRootTemplate()
Definition: SysTemplateRepositoryTest.php:27
‪TYPO3\CMS\Core\Tests\Functional\TypoScript\IncludeTree
‪TYPO3\CMS\Core\Tests\Functional\TypoScript\IncludeTree\SysTemplateRepositoryTest\twoTemplatesOnPagePrefersTheOneWithLowerSorting
‪twoTemplatesOnPagePrefersTheOneWithLowerSorting()
Definition: SysTemplateRepositoryTest.php:70
‪TYPO3\CMS\Core\Tests\Functional\TypoScript\IncludeTree\SysTemplateRepositoryTest
Definition: SysTemplateRepositoryTest.php:25
‪TYPO3\CMS\Core\Tests\Functional\TypoScript\IncludeTree\SysTemplateRepositoryTest\twoPagesTwoTemplates
‪twoPagesTwoTemplates()
Definition: SysTemplateRepositoryTest.php:45