Skip to content

Commit 4e3dbdd

Browse files
authored
Merge pull request #11 from clue-labs/tests
Simplify test bootstrapping logic via Composer
2 parents 48787a4 + 3025199 commit 4e3dbdd

9 files changed

Lines changed: 27 additions & 12 deletions

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"psr-4": { "React\\Promise\\Stream\\" : "src/" },
1515
"files": [ "src/functions_include.php" ]
1616
},
17+
"autoload-dev": {
18+
"psr-4": { "React\\Tests\\Promise\\Stream\\": "tests/" }
19+
},
1720
"require": {
1821
"php": ">=5.3",
1922
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4 || ^0.3",

phpunit.xml.dist

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

3-
<phpunit bootstrap="tests/bootstrap.php"
3+
<phpunit bootstrap="vendor/autoload.php"
44
colors="true"
55
convertErrorsToExceptions="true"
66
convertNoticesToExceptions="true"

tests/AllTest.php

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

3+
namespace React\Tests\Promise\Stream;
4+
35
use React\Promise\Stream;
46
use React\Stream\ThroughStream;
57

tests/BufferTest.php

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

3+
namespace React\Tests\Promise\Stream;
4+
35
use Clue\React\Block;
46
use React\EventLoop\Factory;
57
use React\Promise\Stream;

tests/CallableStub.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace React\Tests\Promise\Stream;
4+
5+
class CallableStub
6+
{
7+
public function __invoke()
8+
{
9+
}
10+
}

tests/FirstTest.php

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

3+
namespace React\Tests\Promise\Stream;
4+
35
use React\Promise\Stream;
46
use React\Stream\ThroughStream;
57

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

3-
require_once __DIR__ . '/../vendor/autoload.php';
3+
namespace React\Tests\Promise\Stream;
44

5-
class TestCase extends PHPUnit_Framework_TestCase
5+
class TestCase extends \PHPUnit_Framework_TestCase
66
{
77
protected function expectCallableOnce()
88
{
@@ -51,7 +51,7 @@ protected function expectCallableNever()
5151
*/
5252
protected function createCallableMock()
5353
{
54-
return $this->getMock('CallableStub');
54+
return $this->getMock('React\Tests\Promise\Stream\CallableStub');
5555
}
5656

5757
protected function expectPromiseResolve($promise)
@@ -81,11 +81,3 @@ protected function expectPromiseReject($promise)
8181
return $promise;
8282
}
8383
}
84-
85-
class CallableStub
86-
{
87-
public function __invoke()
88-
{
89-
}
90-
}
91-

tests/UnwrapReadableTest.php

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

3+
namespace React\Tests\Promise\Stream;
4+
35
use Clue\React\Block;
46
use React\EventLoop\Factory;
57
use React\Promise;

tests/UnwrapWritableTest.php

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

3+
namespace React\Tests\Promise\Stream;
4+
35
use Clue\React\Block;
46
use React\EventLoop\Factory;
57
use React\Promise;

0 commit comments

Comments
 (0)