Skip to content

Commit

Permalink
Merge pull request #15 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 Jun 5, 2020
2 parents e151291 + 317d474 commit 743c865
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 26 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
23 changes: 11 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
language: php

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

# lock distro so future defaults will not break the build
# 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

Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
"autoload": {
"psr-4": { "Clue\\React\\Multicast\\": "src/" }
},
"autoload-dev": {
"psr-4": { "Clue\\Tests\\React\\Multicast\\": "tests/" }
},
"require": {
"php": ">=5.3",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
"react/datagram": "~1.0"
},
"require-dev": {
"clue/hexdump": "0.2.*",
"phpunit/phpunit": "^6.0 || ^5.7 || ^4.8.35"
"phpunit/phpunit": "^9.0 ||^6.0 || ^5.7 || ^4.8.35"
},
"suggest": {
"ext-sockets": "Requires PHP 5.4+ and the low level socket API for listening on multicast addresses (socket options to send IGMP announcements)"
Expand Down
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="Multicast React Test Suite">
<directory>./tests/</directory>
Expand Down
11 changes: 8 additions & 3 deletions tests/FunctionalTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Clue\Tests\React\Multicast;

use Clue\React\Multicast\Factory;

class FunctionalTest extends TestCase
Expand All @@ -9,9 +11,12 @@ class FunctionalTest extends TestCase

private $address = '224.224.244.244:2244';

public function setUp()
/**
* @before
*/
public function setUpMocks()
{
$this->loop = React\EventLoop\Factory::create();
$this->loop = \React\EventLoop\Factory::create();
$this->factory = new Factory($this->loop);
}

Expand All @@ -31,7 +36,7 @@ public function testMultipleReceivers()
{
try {
$receiver1 = $this->factory->createReceiver($this->address);
} catch (BadMethodCallException $e) {
} catch (\BadMethodCallException $e) {
$this->markTestSkipped('No multicast support');
}

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

require __DIR__ . '/../vendor/autoload.php';
namespace Clue\Tests\React\Multicast;

error_reporting(-1);

class TestCase extends PHPUnit\Framework\TestCase
class TestCase extends \PHPUnit\Framework\TestCase
{
protected function expectCallableOnce()
{
Expand Down

0 comments on commit 743c865

Please sign in to comment.