Skip to content

Commit 6af417b

Browse files
authored
Merge pull request #147 from clue-labs/php7.4
Test against PHP 7.4 and simplify test setup and test matrix
2 parents 398b5a9 + 16c6c37 commit 6af417b

11 files changed

+43
-30
lines changed

.travis.yml

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

3-
php:
4-
# - 5.3 # requires old distro
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 new 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
19+
install:
20+
- composer require phpunit/phpunit:^5 --dev --no-interaction # requires legacy phpunit
2121
allow_failures:
22-
- php: hhvm
22+
- php: hhvm-3.18
2323

2424
sudo: false
2525

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
"autoload": {
1414
"psr-4": { "Clue\\React\\Buzz\\": "src/" }
1515
},
16+
"autoload-dev": {
17+
"psr-4": { "Clue\\Tests\\React\\Buzz\\": "tests/" }
18+
},
1619
"require": {
1720
"php": ">=5.3",
1821
"psr/http-message": "^1.0",
1922
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
20-
"react/http-client": "^0.5.8",
23+
"react/http-client": "^0.5.10",
2124
"react/promise": "^2.2.1 || ^1.2.1",
2225
"react/promise-stream": "^1.0 || ^0.1.1",
2326
"react/promise-timer": "^1.2",

phpunit.xml.dist

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

3-
<phpunit bootstrap="tests/bootstrap.php"
3+
<phpunit bootstrap="vendor/autoload.php"
44
colors="true"
55
convertErrorsToExceptions="true"
66
convertNoticesToExceptions="true"

tests/BrowserTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<?php
22

3+
namespace Clue\Tests\React\Buzz;
4+
35
use Clue\React\Block;
46
use Clue\React\Buzz\Browser;
7+
use PHPUnit\Framework\TestCase;
58
use Psr\Http\Message\RequestInterface;
69
use React\Promise\Promise;
710
use RingCentral\Psr7\Uri;
@@ -18,7 +21,7 @@ public function setUp()
1821
$this->sender = $this->getMockBuilder('Clue\React\Buzz\Io\Transaction')->disableOriginalConstructor()->getMock();
1922
$this->browser = new Browser($this->loop);
2023

21-
$ref = new ReflectionProperty($this->browser, 'transaction');
24+
$ref = new \ReflectionProperty($this->browser, 'transaction');
2225
$ref->setAccessible(true);
2326
$ref->setValue($this->browser, $this->sender);
2427
}

tests/FunctionalBrowserTest.php

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

3+
namespace Clue\Tests\React\Buzz;
4+
35
use Clue\React\Block;
46
use Clue\React\Buzz\Browser;
57
use Clue\React\Buzz\Message\ResponseException;
8+
use PHPUnit\Framework\TestCase;
69
use Psr\Http\Message\ServerRequestInterface;
710
use React\EventLoop\Factory;
811
use React\Http\Response;

tests/Io/SenderTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?php
22

3+
namespace Clue\Tests\React\Buzz\Io;
4+
35
use Clue\React\Block;
46
use Clue\React\Buzz\Io\Sender;
57
use Clue\React\Buzz\Message\ReadableBodyStream;
8+
use PHPUnit\Framework\TestCase;
69
use React\HttpClient\Client as HttpClient;
710
use React\HttpClient\RequestData;
811
use React\Promise;
@@ -48,7 +51,7 @@ public function testSenderRejectsInvalidUri()
4851
public function testSenderConnectorRejection()
4952
{
5053
$connector = $this->getMockBuilder('React\Socket\ConnectorInterface')->getMock();
51-
$connector->expects($this->once())->method('connect')->willReturn(Promise\reject(new RuntimeException('Rejected')));
54+
$connector->expects($this->once())->method('connect')->willReturn(Promise\reject(new \RuntimeException('Rejected')));
5255

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

tests/Io/TransactionTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?php
22

3+
namespace Clue\Tests\React\Buzz\Io;
4+
35
use Clue\React\Block;
46
use Clue\React\Buzz\Io\Transaction;
57
use Clue\React\Buzz\Message\MessageFactory;
68
use Clue\React\Buzz\Message\ResponseException;
79
use PHPUnit\Framework\MockObject\MockObject;
10+
use PHPUnit\Framework\TestCase;
811
use Psr\Http\Message\RequestInterface;
912
use React\EventLoop\Factory;
1013
use React\Promise;
@@ -25,7 +28,7 @@ public function testWithOptionsReturnsNewInstanceWithChangedOption()
2528
$this->assertInstanceOf('Clue\React\Buzz\Io\Transaction', $new);
2629
$this->assertNotSame($transaction, $new);
2730

28-
$ref = new ReflectionProperty($new, 'followRedirects');
31+
$ref = new \ReflectionProperty($new, 'followRedirects');
2932
$ref->setAccessible(true);
3033

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

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

42-
$ref = new ReflectionProperty($transaction, 'followRedirects');
45+
$ref = new \ReflectionProperty($transaction, 'followRedirects');
4346
$ref->setAccessible(true);
4447

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

57-
$ref = new ReflectionProperty($transaction, 'followRedirects');
60+
$ref = new \ReflectionProperty($transaction, 'followRedirects');
5861
$ref->setAccessible(true);
5962

6063
$this->assertTrue($ref->getValue($transaction));

tests/Message/MessageFactoryTest.php

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

3+
namespace Clue\Tests\React\Buzz\Message;
4+
35
use Clue\React\Buzz\Message\MessageFactory;
6+
use PHPUnit\Framework\TestCase;
47

58
class MessageFactoryTest extends TestCase
69
{

tests/Message/ReadableBodyStreamTest.php

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

3+
namespace Clue\Tests\React\Buzz\Message;
4+
35
use Clue\React\Buzz\Message\ReadableBodyStream;
6+
use PHPUnit\Framework\TestCase;
47
use React\Stream\ThroughStream;
58

69
class ReadableBodyStreamTest extends TestCase

tests/Message/ResponseExceptionTest.php

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

3+
namespace Clue\Tests\React\Buzz\Message;
4+
35
use Clue\React\Buzz\Message\ResponseException;
6+
use PHPUnit\Framework\TestCase;
47
use RingCentral\Psr7\Response;
58

69
class ResponseExceptionTest extends TestCase

0 commit comments

Comments
 (0)