Skip to content

Commit a28e520

Browse files
committed
Clean up test suite
1 parent 2f23fcc commit a28e520

13 files changed

+31
-103
lines changed

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": { "ConnectionManager\\Extra\\": "src" }
1515
},
16+
"autoload-dev": {
17+
"psr-4": { "ConnectionManager\\Tests\\Extra\\": "tests/" }
18+
},
1619
"require": {
1720
"php": ">=5.3",
1821
"react/socket": "^1.0 || ^0.8 || ^0.7",

phpunit.xml.dist

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

3-
<phpunit bootstrap="tests/bootstrap.php" colors="true">
3+
<phpunit bootstrap="vendor/autoload.php" colors="true">
44
<testsuites>
5-
<testsuite>
5+
<testsuite name="Connection-Manager-Extra Test Suite">
66
<directory>./tests</directory>
77
</testsuite>
88
</testsuites>

tests/ConnectionManagerDelayTest.php

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

3+
namespace ConnectionManager\Tests\Extra;
34

45
use ConnectionManager\Extra\ConnectionManagerDelay;
56

@@ -12,7 +13,7 @@ class ConnectionManagerDelayTest extends TestCase
1213
*/
1314
public function setUpLoop()
1415
{
15-
$this->loop = React\EventLoop\Factory::create();
16+
$this->loop = \React\EventLoop\Factory::create();
1617
}
1718

1819
public function testDelayTenth()

tests/ConnectionManagerRejectTest.php

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

3+
namespace ConnectionManager\Tests\Extra;
4+
35
use ConnectionManager\Extra\ConnectionManagerReject;
46

57
class ConnectionManagerRejectTest extends TestCase
@@ -20,7 +22,7 @@ public function testRejectWithCustomMessage()
2022
$promise = $cm->connect('www.google.com:80');
2123

2224
$text = null;
23-
$promise->then($this->expectCallableNever(), function (Exception $e) use (&$text) {
25+
$promise->then($this->expectCallableNever(), function (\Exception $e) use (&$text) {
2426
$text = $e->getMessage();
2527
});
2628

@@ -30,7 +32,7 @@ public function testRejectWithCustomMessage()
3032
public function testRejectThrowsCustomException()
3133
{
3234
$cm = new ConnectionManagerReject(function ($uri) {
33-
throw new RuntimeException('Blocked ' . $uri);
35+
throw new \RuntimeException('Blocked ' . $uri);
3436
});
3537

3638
$promise = $cm->connect('www.google.com:80');
@@ -47,7 +49,7 @@ public function testRejectThrowsCustomException()
4749
public function testRejectReturnsCustomException()
4850
{
4951
$cm = new ConnectionManagerReject(function ($uri) {
50-
return new RuntimeException('Blocked ' . $uri);
52+
return new \RuntimeException('Blocked ' . $uri);
5153
});
5254

5355
$promise = $cm->connect('www.google.com:80');

tests/ConnectionManagerRepeatTest.php

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

3+
namespace ConnectionManager\Tests\Extra;
4+
35
use ConnectionManager\Extra\ConnectionManagerRepeat;
46
use ConnectionManager\Extra\ConnectionManagerReject;
57
use React\Promise;

tests/ConnectionManagerSwappableTest.php

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

3+
namespace ConnectionManager\Tests\Extra;
4+
35
use ConnectionManager\Extra\ConnectionManagerSwappable;
46
use ConnectionManager\Extra\ConnectionManagerReject;
57

tests/ConnectionManagerTimeoutTest.php

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

3+
namespace ConnectionManager\Tests\Extra;
4+
35
use ConnectionManager\Extra\ConnectionManagerReject;
46
use ConnectionManager\Extra\ConnectionManagerTimeout;
57
use React\Promise\Deferred;
@@ -14,7 +16,7 @@ class ConnectionManagerTimeoutTest extends TestCase
1416
*/
1517
public function setUpLoop()
1618
{
17-
$this->loop = React\EventLoop\Factory::create();
19+
$this->loop = \React\EventLoop\Factory::create();
1820
}
1921

2022
public function testTimeoutOkay()

tests/Multiple/ConnectionManagerConcurrentTest.php

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

3+
namespace ConnectionManager\Tests\Extra\Multiple;
4+
35
use ConnectionManager\Extra\Multiple\ConnectionManagerConcurrent;
46
use React\Promise;
7+
use ConnectionManager\Tests\Extra\TestCase;
58

69
class ConnectionManagerConcurrentTest extends TestCase
710
{

tests/Multiple/ConnectionManagerConsecutiveTest.php

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

3+
namespace ConnectionManager\Tests\Extra\Multiple;
4+
35
use ConnectionManager\Extra\Multiple\ConnectionManagerConsecutive;
46
use ConnectionManager\Extra\ConnectionManagerReject;
57
use React\Promise;
8+
use ConnectionManager\Tests\Extra\TestCase;
69

710
class ConnectionManagerConsecutiveTest extends TestCase
811
{

tests/Multiple/ConnectionManagerRandomTest.php

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

3+
namespace ConnectionManager\Tests\Extra\Multiple;
4+
35
use ConnectionManager\Extra\Multiple\ConnectionManagerRandom;
46
use ConnectionManager\Extra\ConnectionManagerReject;
57
use React\Promise;
8+
use ConnectionManager\Tests\Extra\TestCase;
69

710
class ConnectionManagerRandomTest extends TestCase
811
{

0 commit comments

Comments
 (0)