Skip to content

Commit 040093d

Browse files
authored
Merge pull request #56 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 f49e18f + 9575f97 commit 040093d

9 files changed

Lines changed: 33 additions & 32 deletions

.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: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
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-
14-
sudo: false
15-
163
# lock distro so new future defaults will not break the build
174
dist: trusty
185

196
matrix:
207
include:
218
- php: 5.3
229
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
2319
allow_failures:
24-
- php: hhvm
20+
- php: hhvm-3.18
21+
22+
sudo: false
2523

2624
install:
2725
- composer install --no-interaction

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818
},
1919
"require-dev": {
2020
"clue/block-react": "^1.1",
21-
"phpunit/phpunit": "^5.0 || ^4.8"
21+
"phpunit/phpunit": "^7.0 || ^5.0 || ^4.8"
2222
},
2323
"autoload": {
2424
"psr-4": { "Clue\\React\\Zenity\\": "src/" }
25+
},
26+
"autoload-dev": {
27+
"psr-4": { "Clue\\Tests\\React\\Zenity\\": "tests/" }
2528
}
2629
}

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="Zenity React Test Suite">
116
<directory>./tests/</directory>

tests/Dialog/AbstractDialogTest.php

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

33
use Clue\React\Zenity\Dialog\AbstractDialog;
4+
use Clue\Tests\React\Zenity\TestCase;
45

56
abstract class AbstractDialogTest extends TestCase
67
{

tests/FunctionalLauncherTest.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\Zenity;
4+
35
use Clue\React\Block;
46
use Clue\React\Zenity\Launcher;
57
use Clue\React\Zenity\Zen\BaseZen;
Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
22

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

5-
class TestCase extends PHPUnit_Framework_TestCase
5+
use PHPUnit\Framework\TestCase as BaseTestCase;
6+
7+
class TestCase extends BaseTestCase
68
{
79
protected function expectCallableOnce()
810
{
@@ -42,7 +44,7 @@ protected function expectCallableNever()
4244
*/
4345
protected function createCallableMock()
4446
{
45-
return $this->getMockBuilder('CallableStub')->getMock();
47+
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
4648
}
4749

4850
protected function expectPromiseResolve($promise)
@@ -63,11 +65,3 @@ protected function expectPromiseReject($promise)
6365
return $promise;
6466
}
6567
}
66-
67-
class CallableStub
68-
{
69-
public function __invoke()
70-
{
71-
}
72-
}
73-

tests/Zen/BaseZenTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use Clue\React\Zenity\Zen\BaseZen;
44
use React\EventLoop\Factory;
55
use React\ChildProcess\Process;
6+
use Clue\Tests\React\Zenity\TestCase;
67

78
abstract class BaseZenTest extends TestCase
89
{

tests/Zen/FunctionalBaseZenTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use Clue\React\Zenity\Zen\BaseZen;
55
use React\EventLoop\Factory;
66
use React\ChildProcess\Process;
7+
use Clue\Tests\React\Zenity\TestCase;
78

89
class FunctionalBaseZenTest extends TestCase
910
{

0 commit comments

Comments
 (0)