TYPO3 CMS  TYPO3_7-6
TypoScriptFrontendControllerTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
19 
24 {
29 
30  protected function setUp()
31  {
32  parent::setUp();
33  $this->importDataSet(__DIR__ . '/fixtures.xml');
34 
35  $this->tsFrontendController = $this->getAccessibleMock(
36  TypoScriptFrontendController::class,
37  ['dummy'],
38  [],
39  '',
40  false
41  );
42 
43  $pageContextMock = $this->getMock(\TYPO3\CMS\Frontend\Page\PageRepository::class);
44  $this->tsFrontendController->_set('sys_page', $pageContextMock);
45  }
46 
51  {
52  $this->assertSame(
53  $this->getFirstTimeValueForRecordCall('tt_content:2', 1),
54  2,
55  'The next start/endtime should be 2'
56  );
57  $this->assertSame(
58  $this->getFirstTimeValueForRecordCall('tt_content:2', 2),
59  3,
60  'The next start/endtime should be 3'
61  );
62  $this->assertSame(
63  $this->getFirstTimeValueForRecordCall('tt_content:2', 4),
64  5,
65  'The next start/endtime should be 5'
66  );
67  $this->assertSame(
68  $this->getFirstTimeValueForRecordCall('tt_content:2', 5),
69  PHP_INT_MAX,
70  'The next start/endtime should be PHP_INT_MAX as there are no more'
71  );
72  $this->assertSame(
73  $this->getFirstTimeValueForRecordCall('tt_content:3', 1),
74  PHP_INT_MAX,
75  'Should be PHP_INT_MAX as table has not this PID'
76  );
77  $this->assertSame(
78  $this->getFirstTimeValueForRecordCall('fe_groups:2', 1),
79  PHP_INT_MAX,
80  'Should be PHP_INT_MAX as table fe_groups has no start/endtime in TCA'
81  );
82  }
83 
89  public function getFirstTimeValueForRecordCall($tablePid, $now)
90  {
91  return $this->tsFrontendController->_call('getFirstTimeValueForRecord', $tablePid, $now);
92  }
93 }
getAccessibleMock( $originalClassName, $methods=[], array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true)