Skip to content

Commit 53214f3

Browse files
committed
Updated composer.json
1 parent 77bb575 commit 53214f3

File tree

3 files changed

+132
-3
lines changed

3 files changed

+132
-3
lines changed

composer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121
],
2222
"require": {
2323
"php": ">=5.6.7",
24-
"dazzle-php/util": "0.5.*"
24+
"dazzle-php/util": "^0.5"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": ">=4.8.0 <5.4.0",
28-
"react/event-loop": "0.4.*"
27+
"phpunit/phpunit": ">=4.8.0 <5.4.0"
2928
},
3029
"suggest": {
3130
"ext-libevent": ">=0.1.0",

test/TUnit/Bridge/React/ReactLoopTest.php

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ public function tearDown()
2727
*/
2828
public function testApiGetActualLoop_ReturnsLoopPassedInConstructor()
2929
{
30+
if (!interface_exists('React\EventLoop\LoopInterface'))
31+
{
32+
return $this->markTestSkipped('This test requires React\EventLoop instance to work');
33+
}
34+
3035
$loop = $this->createLoopMock();
3136
$react = new ReactLoop($loop);
3237
$this->assertSame($loop, $react->getActualLoop());
@@ -37,6 +42,11 @@ public function testApiGetActualLoop_ReturnsLoopPassedInConstructor()
3742
*/
3843
public function testApiAddReadStream_PassesProperParameters()
3944
{
45+
if (!interface_exists('React\EventLoop\LoopInterface'))
46+
{
47+
return $this->markTestSkipped('This test requires React\EventLoop instance to work');
48+
}
49+
4050
$stream = $this->createMemoryStream();
4151
$listener = $this->createCallableMock();
4252

@@ -56,6 +66,11 @@ function($passedStream, $passedListener) use($stream, $listener) {
5666
*/
5767
public function testApiAddWriteStream_PassesProperParameters()
5868
{
69+
if (!interface_exists('React\EventLoop\LoopInterface'))
70+
{
71+
return $this->markTestSkipped('This test requires React\EventLoop instance to work');
72+
}
73+
5974
$stream = $this->createMemoryStream();
6075
$listener = $this->createCallableMock();
6176

@@ -75,6 +90,11 @@ function($passedStream, $passedListener) use($stream, $listener) {
7590
*/
7691
public function testApiRemoveReadStream_PassesProperParameters()
7792
{
93+
if (!interface_exists('React\EventLoop\LoopInterface'))
94+
{
95+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
96+
}
97+
7898
$stream = $this->createMemoryStream();
7999

80100
$react = $this->createApiMethodMock(
@@ -92,6 +112,11 @@ function($passedStream) use($stream) {
92112
*/
93113
public function testApiRemoveWriteStream_PassesProperParameters()
94114
{
115+
if (!interface_exists('React\EventLoop\LoopInterface'))
116+
{
117+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
118+
}
119+
95120
$stream = $this->createMemoryStream();
96121

97122
$react = $this->createApiMethodMock(
@@ -109,6 +134,11 @@ function($passedStream) use($stream) {
109134
*/
110135
public function testApiRemoveStream_PassesProperParameters()
111136
{
137+
if (!interface_exists('React\EventLoop\LoopInterface'))
138+
{
139+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
140+
}
141+
112142
$stream = $this->createMemoryStream();
113143

114144
$react = $this->createApiMethodMock(
@@ -126,6 +156,11 @@ function($passedStream) use($stream) {
126156
*/
127157
public function testApiAddTimer_PassesProperParameters()
128158
{
159+
if (!interface_exists('React\EventLoop\LoopInterface'))
160+
{
161+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
162+
}
163+
129164
$interval = 5e-1;
130165
$callback = $this->createCallableMock();
131166

@@ -148,6 +183,11 @@ function($passedInterval, $passedCallback) use($interval, $callback) {
148183
*/
149184
public function testApiAddTimer_ReturnsReactTimer()
150185
{
186+
if (!interface_exists('React\EventLoop\LoopInterface'))
187+
{
188+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
189+
}
190+
151191
$interval = 5e-1;
152192
$callback = $this->createCallableMock();
153193

@@ -171,6 +211,11 @@ function($interval, $callback) {
171211
*/
172212
public function testApiAddPeriodicTimer_PassesProperParameters()
173213
{
214+
if (!interface_exists('React\EventLoop\LoopInterface'))
215+
{
216+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
217+
}
218+
174219
$interval = 5e-1;
175220
$callback = $this->createCallableMock();
176221

@@ -193,6 +238,11 @@ function($passedInterval, $passedCallback) use($interval, $callback) {
193238
*/
194239
public function testApiAddPeriodicTimer_ReturnsReactTimer()
195240
{
241+
if (!interface_exists('React\EventLoop\LoopInterface'))
242+
{
243+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
244+
}
245+
196246
$interval = 5e-1;
197247
$callback = $this->createCallableMock();
198248

@@ -216,6 +266,11 @@ function($interval, $callback) {
216266
*/
217267
public function testCancelTimer_CallsActualCancelTimer()
218268
{
269+
if (!interface_exists('React\EventLoop\LoopInterface'))
270+
{
271+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
272+
}
273+
219274
$mockedTimer = $this->getMock(
220275
\Dazzle\Loop\Timer\TimerInterface::class
221276
);
@@ -244,6 +299,11 @@ function($passedTimer) use($mockedTimer) {
244299
*/
245300
public function testApiIsTimerActive_CallsActualIsTimerActive()
246301
{
302+
if (!interface_exists('React\EventLoop\LoopInterface'))
303+
{
304+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
305+
}
306+
247307
$mockedTimer = $this->getMock(
248308
\Dazzle\Loop\Timer\TimerInterface::class
249309
);
@@ -272,6 +332,11 @@ function($passedTimer) use($mockedTimer) {
272332
*/
273333
public function testApiNextTick_PassesProperParamters()
274334
{
335+
if (!interface_exists('React\EventLoop\LoopInterface'))
336+
{
337+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
338+
}
339+
275340
$listener = $this->createCallableMock();
276341

277342
$react = $this->createApiMethodMock(
@@ -289,6 +354,11 @@ function($passedListener) use($listener) {
289354
*/
290355
public function testApiFutureTick_PassesProperParamters()
291356
{
357+
if (!interface_exists('React\EventLoop\LoopInterface'))
358+
{
359+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
360+
}
361+
292362
$listener = $this->createCallableMock();
293363

294364
$react = $this->createApiMethodMock(
@@ -306,6 +376,11 @@ function($passedListener) use($listener) {
306376
*/
307377
public function testApiTick_NeverTicksLoop()
308378
{
379+
if (!interface_exists('React\EventLoop\LoopInterface'))
380+
{
381+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
382+
}
383+
309384
$this->markTestSkipped(
310385
'Seems there is a problem with PHPUnit 5.2 compatibility here.'
311386
);
@@ -325,6 +400,11 @@ public function testApiTick_NeverTicksLoop()
325400
*/
326401
public function testApiRun_NeverRunsLoop()
327402
{
403+
if (!interface_exists('React\EventLoop\LoopInterface'))
404+
{
405+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
406+
}
407+
328408
$this->markTestSkipped(
329409
'Seems there is a problem with PHPUnit 5.2 compatibility here.'
330410
);
@@ -344,6 +424,11 @@ public function testApiRun_NeverRunsLoop()
344424
*/
345425
public function testApiStop_NeverStopsLoop()
346426
{
427+
if (!interface_exists('React\EventLoop\LoopInterface'))
428+
{
429+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
430+
}
431+
347432
$this->markTestSkipped(
348433
'Seems there is a problem with PHPUnit 5.2 compatibility here.'
349434
);

test/TUnit/Bridge/React/ReactTimerTest.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ class ReactTimerTest extends TUnit
1515
*/
1616
public function testApiGetActualTimer_ReturnsTimerPassedInConstructor()
1717
{
18+
if (!interface_exists('React\EventLoop\LoopInterface'))
19+
{
20+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
21+
}
22+
1823
$timer = $this->createTimerMock();
1924
$react = new ReactTimer($timer);
2025

@@ -26,6 +31,11 @@ public function testApiGetActualTimer_ReturnsTimerPassedInConstructor()
2631
*/
2732
public function testApiGetLoop_ReturnsReactLoop()
2833
{
34+
if (!interface_exists('React\EventLoop\LoopInterface'))
35+
{
36+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
37+
}
38+
2939
$react = $this->createApiMethodMock(
3040
'getLoop',
3141
function() {
@@ -41,6 +51,11 @@ function() {
4151
*/
4252
public function testApiGetInterval_ReturnsProperInterval()
4353
{
54+
if (!interface_exists('React\EventLoop\LoopInterface'))
55+
{
56+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
57+
}
58+
4459
$interval = 1e-23;
4560
$react = $this->createApiMethodMock(
4661
'getInterval',
@@ -57,6 +72,11 @@ function() use($interval) {
5772
*/
5873
public function testApiGetCallback_ReturnsProperCallback()
5974
{
75+
if (!interface_exists('React\EventLoop\LoopInterface'))
76+
{
77+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
78+
}
79+
6080
$callback = $this->createCallableMock();
6181
$react = $this->createApiMethodMock(
6282
'getCallback',
@@ -73,6 +93,11 @@ function() use($callback) {
7393
*/
7494
public function testApiSetData_PassesProperParameters()
7595
{
96+
if (!interface_exists('React\EventLoop\LoopInterface'))
97+
{
98+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
99+
}
100+
76101
$expectedData = $this->getMock('StdClass');
77102
$react = $this->createApiMethodMock(
78103
'setData',
@@ -89,6 +114,11 @@ function($data) use($expectedData) {
89114
*/
90115
public function testApiGetData_ReturnsProperData()
91116
{
117+
if (!interface_exists('React\EventLoop\LoopInterface'))
118+
{
119+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
120+
}
121+
92122
$expectedData = $this->getMock('StdClass');
93123
$react = $this->createApiMethodMock(
94124
'getData',
@@ -105,6 +135,11 @@ function() use($expectedData) {
105135
*/
106136
public function testApiIsPeriodic_CallsActualIsPeriodic($bool)
107137
{
138+
if (!interface_exists('React\EventLoop\LoopInterface'))
139+
{
140+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
141+
}
142+
108143
$react = $this->createApiMethodMock(
109144
'isPeriodic',
110145
function() use($bool) {
@@ -120,6 +155,11 @@ function() use($bool) {
120155
*/
121156
public function testApiIsActive_CallsActualIsActive($bool)
122157
{
158+
if (!interface_exists('React\EventLoop\LoopInterface'))
159+
{
160+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
161+
}
162+
123163
$react = $this->createApiMethodMock(
124164
'isActive',
125165
function() use($bool) {
@@ -135,6 +175,11 @@ function() use($bool) {
135175
*/
136176
public function testApiCancel_CallsActualCancel()
137177
{
178+
if (!interface_exists('React\EventLoop\LoopInterface'))
179+
{
180+
$this->markTestSkipped('This test requires React\EventLoop instance to work');
181+
}
182+
138183
$react = $this->createApiMethodMock(
139184
'cancel',
140185
function() {}

0 commit comments

Comments
 (0)