Skip to content

Commit

Permalink
Merge pull request #11 from clue-labs/tests
Browse files Browse the repository at this point in the history
Simplify test bootstrapping logic via Composer
  • Loading branch information
WyriHaximus authored Dec 22, 2017
2 parents 48787a4 + 3025199 commit 4e3dbdd
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 12 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"psr-4": { "React\\Promise\\Stream\\" : "src/" },
"files": [ "src/functions_include.php" ]
},
"autoload-dev": {
"psr-4": { "React\\Tests\\Promise\\Stream\\": "tests/" }
},
"require": {
"php": ">=5.3",
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4 || ^0.3",
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="tests/bootstrap.php"
<phpunit bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
Expand Down
2 changes: 2 additions & 0 deletions tests/AllTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace React\Tests\Promise\Stream;

use React\Promise\Stream;
use React\Stream\ThroughStream;

Expand Down
2 changes: 2 additions & 0 deletions tests/BufferTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace React\Tests\Promise\Stream;

use Clue\React\Block;
use React\EventLoop\Factory;
use React\Promise\Stream;
Expand Down
10 changes: 10 additions & 0 deletions tests/CallableStub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace React\Tests\Promise\Stream;

class CallableStub
{
public function __invoke()
{
}
}
2 changes: 2 additions & 0 deletions tests/FirstTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace React\Tests\Promise\Stream;

use React\Promise\Stream;
use React\Stream\ThroughStream;

Expand Down
14 changes: 3 additions & 11 deletions tests/bootstrap.php → tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

require_once __DIR__ . '/../vendor/autoload.php';
namespace React\Tests\Promise\Stream;

class TestCase extends PHPUnit_Framework_TestCase
class TestCase extends \PHPUnit_Framework_TestCase
{
protected function expectCallableOnce()
{
Expand Down Expand Up @@ -51,7 +51,7 @@ protected function expectCallableNever()
*/
protected function createCallableMock()
{
return $this->getMock('CallableStub');
return $this->getMock('React\Tests\Promise\Stream\CallableStub');
}

protected function expectPromiseResolve($promise)
Expand Down Expand Up @@ -81,11 +81,3 @@ protected function expectPromiseReject($promise)
return $promise;
}
}

class CallableStub
{
public function __invoke()
{
}
}

2 changes: 2 additions & 0 deletions tests/UnwrapReadableTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace React\Tests\Promise\Stream;

use Clue\React\Block;
use React\EventLoop\Factory;
use React\Promise;
Expand Down
2 changes: 2 additions & 0 deletions tests/UnwrapWritableTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace React\Tests\Promise\Stream;

use Clue\React\Block;
use React\EventLoop\Factory;
use React\Promise;
Expand Down

0 comments on commit 4e3dbdd

Please sign in to comment.