Skip to content

Commit 5ded30f

Browse files
committed
Merge branch 'release/0.6.1'
2 parents 88c6027 + cee645f commit 5ded30f

37 files changed

+115
-425
lines changed

.codeclimate.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@ engines:
44
enabled: true
55
config:
66
languages:
7-
- php
7+
php:
8+
mass_threshold: 100
89
fixme:
910
enabled: true
1011
phpmd:
1112
enabled: true
13+
checks:
14+
Naming/ShortMethodName:
15+
enabled: false
16+
Naming/ShortVariable:
17+
enabled: false
18+
CleanCode/StaticAccess:
19+
enabled: false
1220
ratings:
1321
paths:
1422
- "**.php"

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

2+
### [0.6.1] - 2016-10-02
3+
4+
* maintenance
5+
26
### [0.6.0] - 2016-10-02
37

48
* added basic meta model

tests/integration/crossbar/CrossbarTestingTrait.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
<?php
22
/**
3-
*
43
* * This file is part of the Tidal/WampWatch package.
54
* * (c) 2016 Timo Michna <timomichna/yahoo.de>
65
* *
76
* * For the full copyright and license information, please view the LICENSE
87
* * file that was distributed with this source code.
9-
*
108
*/
119

1210
namespace integration\crossbar;
@@ -53,7 +51,6 @@ trait CrossbarTestingTrait
5351

5452
private function setupConnection()
5553
{
56-
5754
$this->clientSessionId = -1;
5855
$this->monitoredSessionId = -2;
5956

@@ -69,7 +66,6 @@ private function setupConnection()
6966
$this->clientSession = $this->createSessionAdapter($session);
7067
$this->clientSessionId = $session->getSessionId();
7168
});
72-
7369
}
7470

7571
/**
@@ -112,12 +108,12 @@ private function createClientConnection()
112108

113109
private function setupTestTopicName()
114110
{
115-
$this->testTopicName = "";
111+
$this->testTopicName = '';
116112

117-
$chars = str_split("abcdefghijklmnopqrstuvwxyz");
118-
for ($i = 0; $i < 10; $i++) {
113+
$chars = str_split('abcdefghijklmnopqrstuvwxyz');
114+
for ($i = 0; $i < 10; ++$i) {
119115
$key = array_rand($chars);
120-
$this->testTopicName .= "" . $chars[$key];
116+
$this->testTopicName .= '' . $chars[$key];
121117
}
122118
}
123119

@@ -148,5 +144,4 @@ public function getConnection()
148144
return $this->connection
149145
?: $this->connection = $this->createConnection();
150146
}
151-
152-
}
147+
}

tests/integration/crossbar/CrosssbarSessionMonitorTest.php

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace integration\crossbar;
44

5-
require_once realpath(__DIR__ . "/../..") . "/bootstrap.php";
6-
require_once __DIR__ . "/CrossbarTestingTrait.php";
5+
require_once realpath(__DIR__ . '/../..') . '/bootstrap.php';
6+
require_once __DIR__ . '/CrossbarTestingTrait.php';
77

88
use Thruway\ClientSession;
99
use Tidal\WampWatch\SessionMonitor;
@@ -17,37 +17,26 @@ class CrosssbarSessionMonitorTest extends \PHPUnit_Framework_TestCase
1717

1818
const ROUTER_URL = 'ws://127.0.0.1:8080/ws';
1919

20-
/**
21-
*
22-
*/
2320
public function setup()
2421
{
2522
$this->setupConnection();
2623
}
2724

28-
/**
29-
*
30-
*/
3125
public function test_onstart()
3226
{
33-
3427
$sessionIds = null;
3528

3629
$this->connection->on('open', function (ClientSession $session) use (&$sessionIds) {
37-
3830
$sessionMonitor = new SessionMonitor(new Adapter($session));
3931

4032
$sessionMonitor->on('start', function ($ids) use (&$sessionIds, $sessionMonitor) {
41-
4233
$sessionIds = $ids;
4334

4435
$sessionMonitor->stop();
4536
$this->connection->close();
4637
});
4738

4839
$sessionMonitor->start();
49-
50-
5140
});
5241

5342
$this->connection->on('error', function ($reason) {
@@ -57,24 +46,17 @@ public function test_onstart()
5746
$this->connection->open();
5847

5948
$this->assertTrue(is_array($sessionIds));
60-
61-
6249
}
6350

64-
6551
public function test_onjoin()
6652
{
67-
6853
$this->connection->on('open', function (ClientSession $session) {
69-
7054
$sessionMonitor = new SessionMonitor(new Adapter($session));
7155

7256
$sessionMonitor->on('join', function (\stdClass $info) use ($sessionMonitor) {
73-
7457
$this->monitoredSessionId = $info->session;
7558
$sessionMonitor->stop();
7659
$this->connection->close();
77-
7860
});
7961

8062
$sessionMonitor->on('start', function () use ($sessionMonitor) {
@@ -87,11 +69,9 @@ public function test_onjoin()
8769
$clientConnection->close();
8870
});
8971
$clientConnection->open();
90-
9172
});
9273

9374
$sessionMonitor->start();
94-
9575
});
9676

9777
$this->connection->on('error', function ($reason) {
@@ -101,23 +81,17 @@ public function test_onjoin()
10181
$this->connection->open();
10282

10383
$this->assertEquals($this->clientSessionId, $this->monitoredSessionId);
104-
10584
}
10685

10786
public function test_onleave()
10887
{
109-
110-
11188
$this->connection->on('open', function (ClientSession $session) {
112-
11389
$sessionMonitor = new SessionMonitor(new Adapter($session));
11490

11591
$sessionMonitor->on('leave', function ($id) use ($sessionMonitor) {
116-
11792
$this->monitoredSessionId = $id;
11893
$sessionMonitor->stop();
11994
$this->connection->close();
120-
12195
});
12296

12397
$sessionMonitor->on('start', function () {
@@ -130,12 +104,9 @@ public function test_onleave()
130104
$clientConnection->close();
131105
});
132106
$clientConnection->open();
133-
134-
135107
});
136108

137109
$sessionMonitor->start();
138-
139110
});
140111

141112
$this->connection->on('error', function ($reason) {
@@ -145,7 +116,5 @@ public function test_onleave()
145116
$this->connection->open();
146117

147118
$this->assertEquals($this->clientSessionId, $this->monitoredSessionId);
148-
149119
}
150-
151120
}

tests/integration/crossbar/CrosssbarSubscriptionMonitorTest.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
<?php
22
/**
3-
*
43
* This file is part of the Tidal/WampWatch package.
54
* (c) 2016 Timo Michna <timomichna/yahoo.de>
65
* *
76
* For the full copyright and license information, please view the LICENSE
87
* file that was distributed with this source code.
9-
*
108
*/
119

1210
namespace integration\crossbar;
1311

14-
require_once realpath(__DIR__ . "/../..") . "/bootstrap.php";
15-
require_once __DIR__ . "/CrossbarTestingTrait.php";
12+
require_once realpath(__DIR__ . '/../..') . '/bootstrap.php';
13+
require_once __DIR__ . '/CrossbarTestingTrait.php';
1614

1715
use Thruway\ClientSession;
1816
use Thruway\Message\SubscribedMessage;
@@ -23,7 +21,6 @@
2321

2422
class CrosssbarSubscriptionMonitorTest extends \PHPUnit_Framework_TestCase
2523
{
26-
2724
use CrossbarTestingTrait;
2825

2926
const REALM_NAME = 'realm1';
@@ -72,7 +69,6 @@ public function setup()
7269
public function test_onstart()
7370
{
7471
$this->getConnection()->on('open', function () {
75-
7672
$this->subscriptionMonitor->on('start', [$this->subscriptionMonitor, 'stop']);
7773

7874
$this->subscriptionMonitor->start();
@@ -90,15 +86,13 @@ public function test_onstart_delivers_current_list()
9086
// create an additional client session
9187
$clientConnection = $this->createClientConnection();
9288
$clientConnection->on('open', function () use (&$subscriptionId, $clientConnection) {
93-
9489
$this->clientSession->subscribe($this->testTopicName, function () {
9590
})
9691
->done(function (SubscribedMessage $message) use (&$subscriptionId) {
9792
$subscriptionId = $message->getSubscriptionId();
9893

9994
$this->getConnection()->open();
10095
});
101-
10296
});
10397

10498
$this->getConnection()->on('open', function () use ($clientConnection) {
@@ -149,7 +143,6 @@ public function test_oncreate()
149143
public function test_onsubscribe()
150144
{
151145
$this->connection->on('open', function () {
152-
153146
$this->subscriptionMonitor->on('subscribe', function () {
154147
$this->subscriptionMonitor->stop();
155148
});
@@ -167,7 +160,6 @@ public function test_onsubscribe()
167160
});
168161

169162
$this->subscriptionMonitor->start();
170-
171163
});
172164

173165
$this->connection->open();
@@ -178,7 +170,6 @@ public function test_onsubscribe()
178170

179171
public function test_onunsubscribe()
180172
{
181-
182173
$sessionId = null;
183174
$subscriptionId = null;
184175

@@ -206,15 +197,13 @@ public function test_onunsubscribe()
206197
});
207198

208199
$this->subscriptionMonitor->on('unsubscribe', function ($sesId, $subId) use (&$sessionId, &$subscriptionId, $clientConnection) {
209-
210200
$sessionId = $sesId;
211201
$subscriptionId = $subId;
212202

213203
$this->subscriptionMonitor->stop();
214204
});
215205

216206
$this->subscriptionMonitor->start();
217-
218207
});
219208

220209
$this->connection->open();
@@ -264,7 +253,6 @@ public function test_ondelete()
264253
});
265254

266255
$this->subscriptionMonitor->start();
267-
268256
});
269257

270258
$this->connection->open();
@@ -307,5 +295,4 @@ private function validateSubscriptionInfo(stdClass $subscriptionInfo)
307295
$this->assertAttributeInternalType('array', 'prefix', $subscriptionInfo);
308296
$this->assertAttributeInternalType('array', 'wildcard', $subscriptionInfo);
309297
}
310-
311298
}

tests/unit/Adapter/React/DeferredAdapterTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*/
1010

11-
namespace Tidal\WampWatch\Test\Unit\Adapter\React;
11+
namespace Tidal\WampWatch\Test\unit\Adapter\React;
1212

1313
require_once __DIR__ . '/../../Stub/PromiseStub.php';
1414

@@ -20,7 +20,6 @@
2020

2121
class DeferredAdapterTest extends PHPUnit_Framework_TestCase
2222
{
23-
2423
/**
2524
* @var DeferredAdapter
2625
*/
@@ -49,7 +48,7 @@ public function test_constructor_sets_adaptee()
4948

5049
public function test_can_access_promise_class()
5150
{
52-
$promiseClass = "Foo";
51+
$promiseClass = 'Foo';
5352
$this->adapter->setPromiseClass($promiseClass);
5453

5554
$this->assertEquals(

tests/unit/Adapter/React/PromiseAdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*/
1010

11-
namespace Tidal\WampWatch\Test\Unit\Adapter\React;
11+
namespace Tidal\WampWatch\Test\unit\Adapter\React;
1212

1313
use Tidal\WampWatch\Adapter\React\PromiseAdapter;
1414
use React\Promise\Promise;

0 commit comments

Comments
 (0)