Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PSR-4 autoloader and proper namespace for tests #21

Merged
merged 1 commit into from
Dec 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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\\Timer\\": "src/" },
"files": [ "src/functions.php" ]
},
"autoload-dev": {
"psr-4": { "React\\Tests\\Promise\\Timer\\": "tests/" }
},
"require": {
"php": ">=5.3",
"react/event-loop": "~0.4.0|~0.3.0",
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
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\Timer;

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

namespace React\Tests\Promise\Timer;

use React\Promise\Timer;
use React\Promise\CancellablePromiseInterface;

class FunctionRejectTest extends TestCase
{
Expand Down
3 changes: 2 additions & 1 deletion tests/FunctionResolveTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

namespace React\Tests\Promise\Timer;

use React\Promise\Timer;
use React\Promise\CancellablePromiseInterface;

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

namespace React\Tests\Promise\Timer;

use React\Promise\Timer;
use React\Promise;

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

use React\EventLoop\Factory;
namespace React\Tests\Promise\Timer;

require __DIR__ . '/../vendor/autoload.php';
use React\EventLoop\Factory;
use PHPUnit_Framework_TestCase;

class TestCase extends PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -40,10 +41,9 @@ protected function expectCallableNever()
*/
protected function createCallableMock()
{
return $this->getMock('CallableStub');
return $this->getMock('React\Tests\Promise\Timer\CallableStub');
}


protected function expectPromiseRejected($promise)
{
return $promise->then($this->expectCallableNever(), $this->expectCallableOnce());
Expand All @@ -59,10 +59,3 @@ protected function expectPromisePending($promise)
return $promise->then($this->expectCallableNever(), $this->expectCallableNever());
}
}

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

namespace React\Tests\Promise\Timer;

use React\Promise\Timer\TimeoutException;

class TimeoutExceptionTest extends TestCase
Expand Down