Skip to content

Commit 768cd2c

Browse files
committed
Use PSR-4 autoloader and proper namespace for tests
1 parent 6a46050 commit 768cd2c

8 files changed

Lines changed: 26 additions & 14 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\\Timer\\": "src/" },
1515
"files": [ "src/functions.php" ]
1616
},
17+
"autoload-dev": {
18+
"psr-4": { "React\\Tests\\Promise\\Timer\\": "tests/" }
19+
},
1720
"require": {
1821
"php": ">=5.3",
1922
"react/event-loop": "~0.4.0|~0.3.0",

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/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\Timer;
4+
5+
class CallableStub
6+
{
7+
public function __invoke()
8+
{
9+
}
10+
}

tests/FunctionRejectTest.php

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

3+
namespace React\Tests\Promise\Timer;
4+
35
use React\Promise\Timer;
4-
use React\Promise\CancellablePromiseInterface;
56

67
class FunctionRejectTest extends TestCase
78
{

tests/FunctionResolveTest.php

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

3+
namespace React\Tests\Promise\Timer;
4+
35
use React\Promise\Timer;
4-
use React\Promise\CancellablePromiseInterface;
56

67
class FunctionResolveTest extends TestCase
78
{

tests/FunctionTimeoutTest.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\Timer;
4+
35
use React\Promise\Timer;
46
use React\Promise;
57

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

3-
use React\EventLoop\Factory;
3+
namespace React\Tests\Promise\Timer;
44

5-
require __DIR__ . '/../vendor/autoload.php';
5+
use React\EventLoop\Factory;
6+
use PHPUnit_Framework_TestCase;
67

78
class TestCase extends PHPUnit_Framework_TestCase
89
{
@@ -40,10 +41,9 @@ protected function expectCallableNever()
4041
*/
4142
protected function createCallableMock()
4243
{
43-
return $this->getMock('CallableStub');
44+
return $this->getMock('React\Tests\Promise\Timer\CallableStub');
4445
}
4546

46-
4747
protected function expectPromiseRejected($promise)
4848
{
4949
return $promise->then($this->expectCallableNever(), $this->expectCallableOnce());
@@ -59,10 +59,3 @@ protected function expectPromisePending($promise)
5959
return $promise->then($this->expectCallableNever(), $this->expectCallableNever());
6060
}
6161
}
62-
63-
class CallableStub
64-
{
65-
public function __invoke()
66-
{
67-
}
68-
}

tests/TimeoutExceptionTest.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\Timer;
4+
35
use React\Promise\Timer\TimeoutException;
46

57
class TimeoutExceptionTest extends TestCase

0 commit comments

Comments
 (0)