Skip to content

Commit

Permalink
Clean up test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonFrings committed Jun 15, 2020
1 parent 2f23fcc commit a28e520
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 103 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"autoload": {
"psr-4": { "ConnectionManager\\Extra\\": "src" }
},
"autoload-dev": {
"psr-4": { "ConnectionManager\\Tests\\Extra\\": "tests/" }
},
"require": {
"php": ">=5.3",
"react/socket": "^1.0 || ^0.8 || ^0.7",
Expand Down
4 changes: 2 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="tests/bootstrap.php" colors="true">
<phpunit bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite>
<testsuite name="Connection-Manager-Extra Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
Expand Down
3 changes: 2 additions & 1 deletion tests/ConnectionManagerDelayTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

namespace ConnectionManager\Tests\Extra;

use ConnectionManager\Extra\ConnectionManagerDelay;

Expand All @@ -12,7 +13,7 @@ class ConnectionManagerDelayTest extends TestCase
*/
public function setUpLoop()
{
$this->loop = React\EventLoop\Factory::create();
$this->loop = \React\EventLoop\Factory::create();
}

public function testDelayTenth()
Expand Down
8 changes: 5 additions & 3 deletions tests/ConnectionManagerRejectTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace ConnectionManager\Tests\Extra;

use ConnectionManager\Extra\ConnectionManagerReject;

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

$text = null;
$promise->then($this->expectCallableNever(), function (Exception $e) use (&$text) {
$promise->then($this->expectCallableNever(), function (\Exception $e) use (&$text) {
$text = $e->getMessage();
});

Expand All @@ -30,7 +32,7 @@ public function testRejectWithCustomMessage()
public function testRejectThrowsCustomException()
{
$cm = new ConnectionManagerReject(function ($uri) {
throw new RuntimeException('Blocked ' . $uri);
throw new \RuntimeException('Blocked ' . $uri);
});

$promise = $cm->connect('www.google.com:80');
Expand All @@ -47,7 +49,7 @@ public function testRejectThrowsCustomException()
public function testRejectReturnsCustomException()
{
$cm = new ConnectionManagerReject(function ($uri) {
return new RuntimeException('Blocked ' . $uri);
return new \RuntimeException('Blocked ' . $uri);
});

$promise = $cm->connect('www.google.com:80');
Expand Down
2 changes: 2 additions & 0 deletions tests/ConnectionManagerRepeatTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace ConnectionManager\Tests\Extra;

use ConnectionManager\Extra\ConnectionManagerRepeat;
use ConnectionManager\Extra\ConnectionManagerReject;
use React\Promise;
Expand Down
2 changes: 2 additions & 0 deletions tests/ConnectionManagerSwappableTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace ConnectionManager\Tests\Extra;

use ConnectionManager\Extra\ConnectionManagerSwappable;
use ConnectionManager\Extra\ConnectionManagerReject;

Expand Down
4 changes: 3 additions & 1 deletion tests/ConnectionManagerTimeoutTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace ConnectionManager\Tests\Extra;

use ConnectionManager\Extra\ConnectionManagerReject;
use ConnectionManager\Extra\ConnectionManagerTimeout;
use React\Promise\Deferred;
Expand All @@ -14,7 +16,7 @@ class ConnectionManagerTimeoutTest extends TestCase
*/
public function setUpLoop()
{
$this->loop = React\EventLoop\Factory::create();
$this->loop = \React\EventLoop\Factory::create();
}

public function testTimeoutOkay()
Expand Down
3 changes: 3 additions & 0 deletions tests/Multiple/ConnectionManagerConcurrentTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php

namespace ConnectionManager\Tests\Extra\Multiple;

use ConnectionManager\Extra\Multiple\ConnectionManagerConcurrent;
use React\Promise;
use ConnectionManager\Tests\Extra\TestCase;

class ConnectionManagerConcurrentTest extends TestCase
{
Expand Down
3 changes: 3 additions & 0 deletions tests/Multiple/ConnectionManagerConsecutiveTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php

namespace ConnectionManager\Tests\Extra\Multiple;

use ConnectionManager\Extra\Multiple\ConnectionManagerConsecutive;
use ConnectionManager\Extra\ConnectionManagerReject;
use React\Promise;
use ConnectionManager\Tests\Extra\TestCase;

class ConnectionManagerConsecutiveTest extends TestCase
{
Expand Down
3 changes: 3 additions & 0 deletions tests/Multiple/ConnectionManagerRandomTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php

namespace ConnectionManager\Tests\Extra\Multiple;

use ConnectionManager\Extra\Multiple\ConnectionManagerRandom;
use ConnectionManager\Extra\ConnectionManagerReject;
use React\Promise;
use ConnectionManager\Tests\Extra\TestCase;

class ConnectionManagerRandomTest extends TestCase
{
Expand Down
3 changes: 3 additions & 0 deletions tests/Multiple/ConnectionManagerSelectiveTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php

namespace ConnectionManager\Tests\Extra\Multiple;

use ConnectionManager\Extra\Multiple\ConnectionManagerSelective;
use ConnectionManager\Extra\ConnectionManagerReject;
use ConnectionManager\Tests\Extra\TestCase;

class ConnectionManagerSelectiveTest extends TestCase
{
Expand Down
1 change: 0 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,4 @@ public function setExpectedException($exception, $message = '', $code = 0)
parent::setExpectedException($exception, $message, $code);
}
}

}
95 changes: 0 additions & 95 deletions tests/bootstrap.php

This file was deleted.

0 comments on commit a28e520

Please sign in to comment.