Skip to content

Commit bcc67f3

Browse files
authored
Merge pull request #93 from SimonFrings/tests
Clean up test suite, add .gitattributes to exclude dev files from exports and run tests on PHP 7.4 and simplify test matrix
2 parents 5f42a3a + 372d00a commit bcc67f3

File tree

8 files changed

+29
-26
lines changed

8 files changed

+29
-26
lines changed

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.gitattributes export-ignore
2+
/.gitignore export-ignore
3+
/.travis.yml export-ignore
4+
/examples/ export-ignore
5+
/phpunit.xml.dist export-ignore
6+
/tests/ export-ignore

.travis.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
language: php
22

3-
php:
4-
# - 5.3 # requires old distro, see below
5-
- 5.4
6-
- 5.5
7-
- 5.6
8-
- 7.0
9-
- 7.1
10-
- 7.2
11-
- 7.3
12-
- hhvm # ignore errors, see below
13-
143
# lock distro so future defaults will not break the build
154
dist: trusty
165

176
matrix:
187
include:
198
- php: 5.3
209
dist: precise
10+
- php: 5.4
11+
- php: 5.5
12+
- php: 5.6
13+
- php: 7.0
14+
- php: 7.1
15+
- php: 7.2
16+
- php: 7.3
17+
- php: 7.4
18+
- php: hhvm-3.18
2119
allow_failures:
22-
- php: hhvm
20+
- php: hhvm-3.18
2321

2422
sudo: false
2523

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
"autoload": {
2424
"psr-4": { "Clue\\React\\Stdio\\": "src/" }
2525
},
26+
"autoload-dev": {
27+
"psr-4": { "Clue\\Tests\\React\\Stdio\\": "tests/" }
28+
},
2629
"require-dev": {
2730
"clue/arguments": "^2.0",
2831
"clue/commander": "^1.2",

phpunit.xml.dist

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

3-
<phpunit bootstrap="tests/bootstrap.php"
4-
colors="true"
5-
convertErrorsToExceptions="true"
6-
convertNoticesToExceptions="true"
7-
convertWarningsToExceptions="true"
8-
>
3+
<phpunit bootstrap="vendor/autoload.php" colors="true">
94
<testsuites>
105
<testsuite name="Stdio React Test Suite">
116
<directory>./tests/</directory>

tests/FunctionalExampleTest.php

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

3+
namespace Clue\Tests\React\Stdio;
4+
35
class FunctionalExampleTest extends TestCase
46
{
57
public function testPeriodicExampleWithPipedInputEndsBecauseInputEnds()

tests/ReadlineTest.php

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

3+
namespace Clue\Tests\React\Stdio;
4+
35
use Clue\React\Stdio\Readline;
46
use React\Stream\ThroughStream;
57
use Evenement\EventEmitter;

tests/StdioTest.php

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

3+
namespace Clue\Tests\React\Stdio;
4+
35
use Clue\React\Stdio\Stdio;
46
use Clue\React\Stdio\Readline;
57
use React\EventLoop\Factory;
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Clue\Tests\React\Stdio;
4+
35
use PHPUnit\Framework\TestCase as BaseTestCase;
46

57
require_once __DIR__ . '/../vendor/autoload.php';
@@ -44,7 +46,7 @@ protected function expectCallableOnceWith($value)
4446
*/
4547
protected function createCallableMock()
4648
{
47-
return $this->getMockBuilder('CallableStub')->getMock();
49+
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
4850
}
4951

5052
protected function expectPromiseResolve($promise)
@@ -65,10 +67,3 @@ protected function expectPromiseReject($promise)
6567
return $promise;
6668
}
6769
}
68-
69-
class CallableStub
70-
{
71-
public function __invoke()
72-
{
73-
}
74-
}

0 commit comments

Comments
 (0)