|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the Cubiche/Async component. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright (c) Cubiche |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Cubiche\Core\Async\Tests\Units\Loop; |
|
13
|
|
|
|
|
14
|
|
|
use React\EventLoop\Timer\TimerInterface; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Loop Adapter Tests class. |
|
18
|
|
|
* |
|
19
|
|
|
* @author Karel Osorio Ramírez <[email protected]> |
|
20
|
|
|
*/ |
|
21
|
|
|
class LoopAdapterTests extends LoopTests |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* Test addTimer method. |
|
25
|
|
|
*/ |
|
26
|
|
|
public function testAddTimer() |
|
27
|
|
|
{ |
|
28
|
|
|
$this->proxyMethodTest('addTimer', array(1, $this->delegateMock())); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Test addPeriodicTimer method. |
|
33
|
|
|
*/ |
|
34
|
|
|
public function testAddPeriodicTimer() |
|
35
|
|
|
{ |
|
36
|
|
|
$this->proxyMethodTest('addPeriodicTimer', array(1, $this->delegateMock())); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Test cancelTimer method. |
|
41
|
|
|
*/ |
|
42
|
|
|
public function testCancelTimer() |
|
43
|
|
|
{ |
|
44
|
|
|
$this->proxyMethodTest('cancelTimer', array($this->newMockInstance(TimerInterface::class))); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Test isTimerActive method. |
|
49
|
|
|
*/ |
|
50
|
|
|
public function testIsTimerActive() |
|
51
|
|
|
{ |
|
52
|
|
|
$this->proxyMethodTest('isTimerActive', array($this->newMockInstance(TimerInterface::class))); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Test nextTick method. |
|
57
|
|
|
*/ |
|
58
|
|
|
public function testNextTick() |
|
59
|
|
|
{ |
|
60
|
|
|
$this->proxyMethodTest('nextTick', array($this->delegateMock())); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Test futureTick method. |
|
65
|
|
|
*/ |
|
66
|
|
|
public function testFutureTick() |
|
67
|
|
|
{ |
|
68
|
|
|
$this->proxyMethodTest('futureTick', array($this->delegateMock())); |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|