‪TYPO3CMS  9.5
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 
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
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 }
‪TYPO3\CMS\Core\Tests\Unit\TimeTracker\TimeTrackerTest\getParseTimeReturnsTotalParseTimeInMillisecondsWithoutBeUserInitialization
‪getParseTimeReturnsTotalParseTimeInMillisecondsWithoutBeUserInitialization()
Definition: TimeTrackerTest.php:44
‪TYPO3\CMS\Core\Tests\Unit\TimeTracker\TimeTrackerTest\getParseTimeReturnsZeroOrOneIfNoValuesAreSet
‪getParseTimeReturnsZeroOrOneIfNoValuesAreSet()
Definition: TimeTrackerTest.php:29
‪TYPO3\CMS\Core\Tests\Unit\TimeTracker\TimeTrackerTest
Definition: TimeTrackerTest.php:25
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Tests\Unit\TimeTracker\TimeTrackerTest\getParseTimeReturnsParseTimeIfNoBeUserTimeWasSet
‪getParseTimeReturnsParseTimeIfNoBeUserTimeWasSet()
Definition: TimeTrackerTest.php:72
‪TYPO3\CMS\Core\Tests\Unit\TimeTracker\TimeTrackerTest\getParseTimeReturnsParseTimeIfOnlyOneBeUserTimeWasSet
‪getParseTimeReturnsParseTimeIfOnlyOneBeUserTimeWasSet()
Definition: TimeTrackerTest.php:58
‪TYPO3\CMS\Core\Tests\Unit\TimeTracker
Definition: TimeTrackerTest.php:3
‪TYPO3\CMS\Core\TimeTracker\TimeTracker
Definition: TimeTracker.php:27