Skip to content

Commit e2967ae

Browse files
committed
Clean up test suite
1 parent 1d07876 commit e2967ae

4 files changed

Lines changed: 15 additions & 13 deletions

File tree

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
"autoload": {
1414
"psr-4": { "Clue\\React\\EventSource\\": "src/" }
1515
},
16+
"autoload-dev": {
17+
"psr-4": { "Clue\\Tests\\React\\EventSource\\": "tests/" }
18+
},
1619
"require": {
1720
"php": ">=5.4",
1821
"clue/buzz-react": "^2.5",

phpunit.xml.dist

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<phpunit bootstrap="vendor/autoload.php"
4-
colors="true"
5-
convertErrorsToExceptions="true"
6-
convertNoticesToExceptions="true"
7-
convertWarningsToExceptions="true"
8-
>
3+
<phpunit bootstrap="vendor/autoload.php" colors="true">
94
<testsuites>
105
<testsuite name="EventSource Test Suite">
116
<directory>./tests/</directory>

tests/EventSourceTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Clue\Tests\React\EventSource;
4+
35
use PHPUnit\Framework\TestCase;
46
use Clue\React\EventSource\EventSource;
57
use React\Promise\Promise;
@@ -44,7 +46,7 @@ public function testConstructorCanBeCalledWithoutBrowser()
4446

4547
$es = new EventSource('http://example.invalid', $loop);
4648

47-
$ref = new ReflectionProperty($es, 'browser');
49+
$ref = new \ReflectionProperty($es, 'browser');
4850
$ref->setAccessible(true);
4951
$browser = $ref->getValue($es);
5052

@@ -98,7 +100,7 @@ public function testCloseWillNotEmitErrorEventWhenGetRequestCancellationHandlerR
98100
$loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
99101

100102
$pending = new Promise(function () { }, function () {
101-
throw new RuntimeException();
103+
throw new \RuntimeException();
102104
});
103105
$browser = $this->getMockBuilder('Clue\React\Buzz\Browser')->disableOriginalConstructor()->getMock();
104106
$browser->expects($this->once())->method('withOptions')->willReturnSelf();
@@ -131,7 +133,7 @@ public function testConstructorWillStartGetRequestThatWillStartRetryTimerWhenGet
131133

132134
$es = new EventSource('http://example.com', $loop, $browser);
133135

134-
$deferred->reject(new RuntimeException());
136+
$deferred->reject(new \RuntimeException());
135137
}
136138

137139
public function testConstructorWillStartGetRequestThatWillStartRetryTimerThatWillRetryGetRequestWhenInitialGetRequestRejects()
@@ -156,7 +158,7 @@ public function testConstructorWillStartGetRequestThatWillStartRetryTimerThatWil
156158

157159
$es = new EventSource('http://example.com', $loop, $browser);
158160

159-
$deferred->reject(new RuntimeException());
161+
$deferred->reject(new \RuntimeException());
160162

161163
$this->assertNotNull($timerRetry);
162164
$timerRetry();
@@ -181,7 +183,7 @@ public function testConstructorWillStartGetRequestThatWillEmitErrorWhenGetReques
181183
$es->on('error', function ($e) use (&$caught) {
182184
$caught = $e;
183185
});
184-
$deferred->reject($expected = new RuntimeException());
186+
$deferred->reject($expected = new \RuntimeException());
185187

186188
$this->assertSame($expected, $caught);
187189
}
@@ -200,7 +202,7 @@ public function testConstructorWillStartGetRequestThatWillNotStartRetryTimerWhen
200202
$es->on('error', function () use ($es) {
201203
$es->close();
202204
});
203-
$deferred->reject(new RuntimeException());
205+
$deferred->reject(new \RuntimeException());
204206
}
205207

206208
public function testCloseAfterGetRequestFromConstructorFailsWillCancelPendingRetryTimer()
@@ -220,7 +222,7 @@ public function testCloseAfterGetRequestFromConstructorFailsWillCancelPendingRet
220222

221223
$es = new EventSource('http://example.com', $loop, $browser);
222224

223-
$deferred->reject(new RuntimeException());
225+
$deferred->reject(new \RuntimeException());
224226

225227
$es->close();
226228
}

tests/MessageEventTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Clue\Tests\React\EventSource;
4+
35
use PHPUnit\Framework\TestCase;
46
use Clue\React\EventSource\MessageEvent;
57

0 commit comments

Comments
 (0)