|
3 | 3 | namespace integration\crossbar; |
4 | 4 |
|
5 | 5 | require_once realpath(__DIR__ . "/../..") . "/bootstrap.php"; |
| 6 | +require_once __DIR__ . "/CrossbarTestingTrait.php"; |
6 | 7 |
|
7 | | - |
8 | | -use Psr\Log\NullLogger; |
9 | | -use Thruway\Logging\Logger; |
10 | 8 | use Thruway\ClientSession; |
11 | | -use Thruway\Connection; |
12 | | -use React\EventLoop\Factory as LoopFactory; |
13 | | -use React\EventLoop\LoopInterface; |
14 | 9 | use Tidal\WampWatch\SessionMonitor; |
15 | 10 | use Tidal\WampWatch\Adapter\Thruway\ClientSession as Adapter; |
16 | 11 |
|
17 | 12 | class CrosssbarSessionMonitorTest extends \PHPUnit_Framework_TestCase |
18 | 13 | { |
| 14 | + use CrossbarTestingTrait; |
19 | 15 |
|
20 | 16 | const REALM_NAME = 'realm1'; |
21 | 17 |
|
22 | 18 | const ROUTER_URL = 'ws://127.0.0.1:8080/ws'; |
23 | 19 |
|
24 | 20 | /** |
25 | | - * @var Connection |
26 | | - */ |
27 | | - private $connection; |
28 | | - |
29 | | - /** |
30 | | - * @var LoopInterface |
| 21 | + * |
31 | 22 | */ |
32 | | - private $loop; |
33 | | - |
34 | | - /** |
35 | | - * @var int |
36 | | - */ |
37 | | - private $clientSessionId = -1; |
38 | | - |
39 | | - /** |
40 | | - * @var int |
41 | | - */ |
42 | | - private $monitoredSessionId = -2; |
43 | | - |
44 | 23 | public function setup() |
45 | 24 | { |
46 | | - |
47 | | - $this->clientSessionId = -1; |
48 | | - $this->monitoredSessionId = -2; |
49 | | - |
50 | | - Logger::set(new NullLogger()); |
51 | | - |
52 | | - $this->loop = LoopFactory::create(); |
53 | | - |
54 | | - $this->connection = $this->createConnection($this->loop); |
55 | | - |
| 25 | + $this->setupConnection(); |
56 | 26 | } |
57 | 27 |
|
58 | | - |
| 28 | + /** |
| 29 | + * |
| 30 | + */ |
59 | 31 | public function test_onstart() |
60 | 32 | { |
61 | 33 |
|
@@ -176,19 +148,4 @@ public function test_onleave() |
176 | 148 |
|
177 | 149 | } |
178 | 150 |
|
179 | | - private function createConnection(LoopInterface $loop = null) |
180 | | - { |
181 | | - if ($loop = null) { |
182 | | - $loop = LoopFactory::create(); |
183 | | - } |
184 | | - |
185 | | - return new Connection( |
186 | | - [ |
187 | | - 'realm' => self::REALM_NAME, |
188 | | - 'url' => self::ROUTER_URL, |
189 | | - ], |
190 | | - $loop |
191 | | - ); |
192 | | - } |
193 | | - |
194 | 151 | } |
0 commit comments