We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Total Complexity | 3 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
11 | class SmrSessionIntegrationTest extends BaseIntegrationSpec { |
||
12 | |||
13 | /** |
||
14 | * Test that the updateTime function works properly when NPC_SCRIPT is set. |
||
15 | * We run in a separate process so that the constant doesn't propagate into |
||
16 | * other tests. |
||
17 | * @runInSeparateProcess |
||
18 | */ |
||
19 | public function test_updateTime_cli() { |
||
20 | // Set the NPC_SCRIPT variable as if this were a CLI program |
||
21 | define('NPC_SCRIPT', true); |
||
22 | |||
23 | $time = SmrSession::getTime(); |
||
24 | $microtime = SmrSession::getMicrotime(); |
||
25 | |||
26 | // Sleep 1 second to ensure that the integer time has incremented |
||
27 | sleep(1); |
||
28 | SmrSession::updateTime(); |
||
29 | |||
30 | // Make sure the times have changed |
||
31 | $this->assertNotEquals($time, SmrSession::getTime()); |
||
32 | $this->assertNotEquals($microtime, SmrSession::getMicroTime()); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * updateTime should throw if called without NPC_SCRIPT defined. |
||
37 | */ |
||
38 | public function test_updateTime() { |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * We can't check the getTime/getMicroTime values, but we can ensure that |
||
45 | * the rounded values are identical. |
||
46 | */ |
||
47 | public function test_getTime_getMicroTime_equality() { |
||
52 |