Skip to content

Commit

Permalink
Merge pull request #56 from SimonFrings/tests
Browse files Browse the repository at this point in the history
Clean up test suite, add .gitattributes to exclude dev files from exports and run tests on PHP 7.4 and simplify test matrix
  • Loading branch information
clue authored May 28, 2020
2 parents f49e18f + 9575f97 commit 040093d
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 32 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/examples/ export-ignore
/phpunit.xml.dist export-ignore
/tests/ export-ignore
26 changes: 12 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
language: php

php:
# - 5.3 # requires old distro, see below
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- hhvm # ignore errors, see below

sudo: false

# lock distro so new future defaults will not break the build
dist: trusty

matrix:
include:
- php: 5.3
dist: precise
- php: 5.4
- php: 5.5
- php: 5.6
- php: 7.0
- php: 7.1
- php: 7.2
- php: 7.3
- php: 7.4
- php: hhvm-3.18
allow_failures:
- php: hhvm
- php: hhvm-3.18

sudo: false

install:
- composer install --no-interaction
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
},
"require-dev": {
"clue/block-react": "^1.1",
"phpunit/phpunit": "^5.0 || ^4.8"
"phpunit/phpunit": "^7.0 || ^5.0 || ^4.8"
},
"autoload": {
"psr-4": { "Clue\\React\\Zenity\\": "src/" }
},
"autoload-dev": {
"psr-4": { "Clue\\Tests\\React\\Zenity\\": "tests/" }
}
}
7 changes: 1 addition & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
>
<phpunit bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Zenity React Test Suite">
<directory>./tests/</directory>
Expand Down
1 change: 1 addition & 0 deletions tests/Dialog/AbstractDialogTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Clue\React\Zenity\Dialog\AbstractDialog;
use Clue\Tests\React\Zenity\TestCase;

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

namespace Clue\Tests\React\Zenity;

use Clue\React\Block;
use Clue\React\Zenity\Launcher;
use Clue\React\Zenity\Zen\BaseZen;
Expand Down
16 changes: 5 additions & 11 deletions tests/bootstrap.php → tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

require_once __DIR__ . '/../vendor/autoload.php';
namespace Clue\Tests\React\Zenity;

class TestCase extends PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase as BaseTestCase;

class TestCase extends BaseTestCase
{
protected function expectCallableOnce()
{
Expand Down Expand Up @@ -42,7 +44,7 @@ protected function expectCallableNever()
*/
protected function createCallableMock()
{
return $this->getMockBuilder('CallableStub')->getMock();
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
}

protected function expectPromiseResolve($promise)
Expand All @@ -63,11 +65,3 @@ protected function expectPromiseReject($promise)
return $promise;
}
}

class CallableStub
{
public function __invoke()
{
}
}

1 change: 1 addition & 0 deletions tests/Zen/BaseZenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use Clue\React\Zenity\Zen\BaseZen;
use React\EventLoop\Factory;
use React\ChildProcess\Process;
use Clue\Tests\React\Zenity\TestCase;

abstract class BaseZenTest extends TestCase
{
Expand Down
1 change: 1 addition & 0 deletions tests/Zen/FunctionalBaseZenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Clue\React\Zenity\Zen\BaseZen;
use React\EventLoop\Factory;
use React\ChildProcess\Process;
use Clue\Tests\React\Zenity\TestCase;

class FunctionalBaseZenTest extends TestCase
{
Expand Down

0 comments on commit 040093d

Please sign in to comment.