‪TYPO3CMS  11.5
TypoScriptFrontendControllerTest.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\MockObject\MockObject;
23 use TYPO3\TestingFramework\Core\AccessibleObjectInterface;
24 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
25 
29 class ‪TypoScriptFrontendControllerTest extends FunctionalTestCase
30 {
34  protected ‪$tsFrontendController;
35 
36  protected function ‪setUp(): void
37  {
38  parent::setUp();
39  $this->importCSVDataSet(__DIR__ . '/fixtures.csv');
40 
41  $this->tsFrontendController = $this->getAccessibleMock(
42  TypoScriptFrontendController::class,
43  ['dummy'],
44  [],
45  '',
46  false
47  );
48 
49  $this->tsFrontendController->_set('sys_page', new ‪PageRepository());
50  }
51 
56  {
57  self::assertSame(
58  $this->‪getFirstTimeValueForRecordCall('tt_content:2', 1),
59  2,
60  'The next start/endtime should be 2'
61  );
62  self::assertSame(
63  $this->‪getFirstTimeValueForRecordCall('tt_content:2', 2),
64  3,
65  'The next start/endtime should be 3'
66  );
67  self::assertSame(
68  $this->‪getFirstTimeValueForRecordCall('tt_content:2', 4),
69  5,
70  'The next start/endtime should be 5'
71  );
72  self::assertSame(
73  $this->‪getFirstTimeValueForRecordCall('tt_content:2', 5),
74  PHP_INT_MAX,
75  'The next start/endtime should be PHP_INT_MAX as there are no more'
76  );
77  self::assertSame(
78  $this->‪getFirstTimeValueForRecordCall('tt_content:3', 1),
79  PHP_INT_MAX,
80  'Should be PHP_INT_MAX as table has not this PID'
81  );
82  self::assertSame(
83  $this->‪getFirstTimeValueForRecordCall('fe_groups:2', 1),
84  PHP_INT_MAX,
85  'Should be PHP_INT_MAX as table fe_groups has no start/endtime in TCA'
86  );
87  }
88 
94  public function ‪getFirstTimeValueForRecordCall(string $tablePid, int $now): int
95  {
96  return $this->tsFrontendController->_call('getFirstTimeValueForRecord', $tablePid, $now);
97  }
98 }
‪TYPO3\CMS\Frontend\Tests\Functional\Controller\TypoScriptFrontendControllerTest\setUp
‪setUp()
Definition: TypoScriptFrontendControllerTest.php:35
‪TYPO3\CMS\Frontend\Tests\Functional\Controller\TypoScriptFrontendControllerTest\getFirstTimeValueForRecordCall
‪int getFirstTimeValueForRecordCall(string $tablePid, int $now)
Definition: TypoScriptFrontendControllerTest.php:93
‪TYPO3\CMS\Frontend\Tests\Functional\Controller
Definition: TypoScriptFrontendControllerTest.php:18
‪TYPO3\CMS\Frontend\Tests\Functional\Controller\TypoScriptFrontendControllerTest\$tsFrontendController
‪TypoScriptFrontendController MockObject AccessibleObjectInterface $tsFrontendController
Definition: TypoScriptFrontendControllerTest.php:33
‪TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
Definition: TypoScriptFrontendController.php:104
‪TYPO3\CMS\Frontend\Tests\Functional\Controller\TypoScriptFrontendControllerTest\getFirstTimeValueForRecordReturnCorrectData
‪getFirstTimeValueForRecordReturnCorrectData()
Definition: TypoScriptFrontendControllerTest.php:54
‪TYPO3\CMS\Frontend\Tests\Functional\Controller\TypoScriptFrontendControllerTest
Definition: TypoScriptFrontendControllerTest.php:30
‪TYPO3\CMS\Core\Domain\Repository\PageRepository
Definition: PageRepository.php:53