Skip to content
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
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
19 changes: 10 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
language: php

php:
# - 5.3 # requires old distro, see below
- 5.4
- 5.5
- 5.6
- 7
- 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
allow_failures:
- php: hhvm
- php: hhvm-3.18

sudo: false

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"psr-4": { "Clue\\React\\HttpProxy\\": "src/" }
},
"autoload-dev": {
"psr-4": { "Tests\\Clue\\React\\HttpProxy\\": "tests/" }
"psr-4": { "Clue\\Tests\\React\\HttpProxy\\": "tests/" }
},
"require": {
"php": ">=5.3",
Expand All @@ -23,7 +23,7 @@
"ringcentral/psr7": "^1.2"
},
"require-dev": {
"phpunit/phpunit": "^5.0 || ^4.8",
"phpunit/phpunit": "^7.0 || ^5.0 || ^4.8",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
"clue/block-react": "^1.1"
}
Expand Down
15 changes: 4 additions & 11 deletions tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Tests\Clue\React\HttpProxy;
namespace Clue\Tests\React\HttpProxy;

use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

abstract class AbstractTestCase extends PHPUnit_Framework_TestCase
abstract class AbstractTestCase extends \PHPUnit\Framework\TestCase
{
protected function expectCallableNever()
{
Expand Down Expand Up @@ -52,14 +52,7 @@ protected function expectCallableOnceWithException($class, $message, $code)
*/
protected function createCallableMock()
{
return $this->getMockBuilder('Tests\\Clue\\React\\HttpProxy\\CallableStub')->getMock();
}
}

class CallableStub
{
public function __invoke()
{
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
}
}

16 changes: 15 additions & 1 deletion tests/FunctionalTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Tests\Clue\React\HttpProxy;
namespace Clue\Tests\React\HttpProxy;

use React\EventLoop\Factory;
use Clue\React\HttpProxy\ProxyConnector;
Expand Down Expand Up @@ -97,11 +97,25 @@ public function testCancelWhileConnectingShouldNotCreateGarbageCycles()
$proxy = new ProxyConnector('google.com', $this->dnsConnector);

gc_collect_cycles();
gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on

$promise = $proxy->connect('google.com:80');
$promise->cancel();
unset($promise);

$this->assertEquals(0, gc_collect_cycles());
}

public function setExpectedException($exception, $message = '', $code = 0)
{
if (method_exists($this, 'expectException')) {
$this->expectException($exception);
if ($message !== null) {
$this->expectExceptionMessage($message);
}
$this->expectExceptionCode($code);
} else {
parent::setExpectedException($exception, $message, $code);
}
}
}
2 changes: 1 addition & 1 deletion tests/ProxyConnectorTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Tests\Clue\React\HttpProxy;
namespace Clue\Tests\React\HttpProxy;

use Clue\React\HttpProxy\ProxyConnector;
use React\Promise\Promise;
Expand Down