Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test against PHP 7.4 and simplify test setup and test matrix #147

Merged
merged 2 commits into from
Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
language: php

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

# 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
install:
- composer require phpunit/phpunit:^5 --dev --no-interaction # requires legacy phpunit
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,11 +13,14 @@
"autoload": {
"psr-4": { "Clue\\React\\Buzz\\": "src/" }
},
"autoload-dev": {
"psr-4": { "Clue\\Tests\\React\\Buzz\\": "tests/" }
},
"require": {
"php": ">=5.3",
"psr/http-message": "^1.0",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
"react/http-client": "^0.5.8",
"react/http-client": "^0.5.10",
"react/promise": "^2.2.1 || ^1.2.1",
"react/promise-stream": "^1.0 || ^0.1.1",
"react/promise-timer": "^1.2",
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="tests/bootstrap.php"
<phpunit bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
Expand Down
5 changes: 4 additions & 1 deletion tests/BrowserTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php

namespace Clue\Tests\React\Buzz;

use Clue\React\Block;
use Clue\React\Buzz\Browser;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\RequestInterface;
use React\Promise\Promise;
use RingCentral\Psr7\Uri;
Expand All @@ -18,7 +21,7 @@ public function setUp()
$this->sender = $this->getMockBuilder('Clue\React\Buzz\Io\Transaction')->disableOriginalConstructor()->getMock();
$this->browser = new Browser($this->loop);

$ref = new ReflectionProperty($this->browser, 'transaction');
$ref = new \ReflectionProperty($this->browser, 'transaction');
$ref->setAccessible(true);
$ref->setValue($this->browser, $this->sender);
}
Expand Down
3 changes: 3 additions & 0 deletions tests/FunctionalBrowserTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php

namespace Clue\Tests\React\Buzz;

use Clue\React\Block;
use Clue\React\Buzz\Browser;
use Clue\React\Buzz\Message\ResponseException;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ServerRequestInterface;
use React\EventLoop\Factory;
use React\Http\Response;
Expand Down
5 changes: 4 additions & 1 deletion tests/Io/SenderTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php

namespace Clue\Tests\React\Buzz\Io;

use Clue\React\Block;
use Clue\React\Buzz\Io\Sender;
use Clue\React\Buzz\Message\ReadableBodyStream;
use PHPUnit\Framework\TestCase;
use React\HttpClient\Client as HttpClient;
use React\HttpClient\RequestData;
use React\Promise;
Expand Down Expand Up @@ -48,7 +51,7 @@ public function testSenderRejectsInvalidUri()
public function testSenderConnectorRejection()
{
$connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock();
$connector->expects($this->once())->method('connect')->willReturn(Promise\reject(new RuntimeException('Rejected')));
$connector->expects($this->once())->method('connect')->willReturn(Promise\reject(new \RuntimeException('Rejected')));

$sender = new Sender(new HttpClient($this->loop, $connector), $this->getMockBuilder('Clue\React\Buzz\Message\MessageFactory')->getMock());

Expand Down
9 changes: 6 additions & 3 deletions tests/Io/TransactionTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?php

namespace Clue\Tests\React\Buzz\Io;

use Clue\React\Block;
use Clue\React\Buzz\Io\Transaction;
use Clue\React\Buzz\Message\MessageFactory;
use Clue\React\Buzz\Message\ResponseException;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\RequestInterface;
use React\EventLoop\Factory;
use React\Promise;
Expand All @@ -25,7 +28,7 @@ public function testWithOptionsReturnsNewInstanceWithChangedOption()
$this->assertInstanceOf('Clue\React\Buzz\Io\Transaction', $new);
$this->assertNotSame($transaction, $new);

$ref = new ReflectionProperty($new, 'followRedirects');
$ref = new \ReflectionProperty($new, 'followRedirects');
$ref->setAccessible(true);

$this->assertFalse($ref->getValue($new));
Expand All @@ -39,7 +42,7 @@ public function testWithOptionsDoesNotChangeOriginalInstance()

$transaction->withOptions(array('followRedirects' => false));

$ref = new ReflectionProperty($transaction, 'followRedirects');
$ref = new \ReflectionProperty($transaction, 'followRedirects');
$ref->setAccessible(true);

$this->assertTrue($ref->getValue($transaction));
Expand All @@ -54,7 +57,7 @@ public function testWithOptionsNullValueReturnsNewInstanceWithDefaultOption()
$transaction = $transaction->withOptions(array('followRedirects' => false));
$transaction = $transaction->withOptions(array('followRedirects' => null));

$ref = new ReflectionProperty($transaction, 'followRedirects');
$ref = new \ReflectionProperty($transaction, 'followRedirects');
$ref->setAccessible(true);

$this->assertTrue($ref->getValue($transaction));
Expand Down
3 changes: 3 additions & 0 deletions tests/Message/MessageFactoryTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

namespace Clue\Tests\React\Buzz\Message;

use Clue\React\Buzz\Message\MessageFactory;
use PHPUnit\Framework\TestCase;

class MessageFactoryTest extends TestCase
{
Expand Down
3 changes: 3 additions & 0 deletions tests/Message/ReadableBodyStreamTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

namespace Clue\Tests\React\Buzz\Message;

use Clue\React\Buzz\Message\ReadableBodyStream;
use PHPUnit\Framework\TestCase;
use React\Stream\ThroughStream;

class ReadableBodyStreamTest extends TestCase
Expand Down
3 changes: 3 additions & 0 deletions tests/Message/ResponseExceptionTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

namespace Clue\Tests\React\Buzz\Message;

use Clue\React\Buzz\Message\ResponseException;
use PHPUnit\Framework\TestCase;
use RingCentral\Psr7\Response;

class ResponseExceptionTest extends TestCase
Expand Down
11 changes: 0 additions & 11 deletions tests/bootstrap.php

This file was deleted.