TYPO3 CMS  TYPO3_8-7
TimeTrackerTest.php
Go to the documentation of this file.
1 <?php
2 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 
20 
24 class TimeTrackerTest extends UnitTestCase
25 {
30  {
31  unset(
32  $GLOBALS['TYPO3_MISC']['microtime_end'],
33  $GLOBALS['TYPO3_MISC']['microtime_start'],
34  $GLOBALS['TYPO3_MISC']['microtime_BE_USER_start'],
35  $GLOBALS['TYPO3_MISC']['microtime_BE_USER_end']
36  );
37  $parseTime = (new TimeTracker())->getParseTime();
38  self::assertLessThanOrEqual(1, $parseTime);
39  }
40 
45  {
46  $baseValue = time();
47  $GLOBALS['TYPO3_MISC']['microtime_start'] = $baseValue;
48  $GLOBALS['TYPO3_MISC']['microtime_end'] = $baseValue + 10;
49  $GLOBALS['TYPO3_MISC']['microtime_BE_USER_start'] = $baseValue + 1;
50  $GLOBALS['TYPO3_MISC']['microtime_BE_USER_end'] = $baseValue + 3;
51  $parseTime = (new TimeTracker())->getParseTime();
52  self::assertSame(8000, $parseTime);
53  }
54 
59  {
60  $baseValue = time();
61  $GLOBALS['TYPO3_MISC']['microtime_start'] = $baseValue;
62  $GLOBALS['TYPO3_MISC']['microtime_end'] = $baseValue + 10;
63  $GLOBALS['TYPO3_MISC']['microtime_BE_USER_start'] = $baseValue + 1;
64  $GLOBALS['TYPO3_MISC']['microtime_BE_USER_end'] = 0;
65  $parseTime = (new TimeTracker())->getParseTime();
66  self::assertSame(10000, $parseTime);
67  }
68 
73  {
74  $baseValue = time();
75  $GLOBALS['TYPO3_MISC']['microtime_start'] = $baseValue;
76  $GLOBALS['TYPO3_MISC']['microtime_end'] = $baseValue + 10;
77  $GLOBALS['TYPO3_MISC']['microtime_BE_USER_start'] = 0;
78  $GLOBALS['TYPO3_MISC']['microtime_BE_USER_end'] = 0;
79  $parseTime = (new TimeTracker())->getParseTime();
80  self::assertSame(10000, $parseTime);
81  }
82 }
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']