diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0925d33 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.travis.yml b/.travis.yml index 04f51ad..0a5430e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,5 @@ 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 @@ -15,8 +7,17 @@ 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 diff --git a/composer.json b/composer.json index 72e4a8f..e0315eb 100644 --- a/composer.json +++ b/composer.json @@ -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", @@ -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" } diff --git a/tests/AbstractTestCase.php b/tests/AbstractTestCase.php index a77a882..b145410 100644 --- a/tests/AbstractTestCase.php +++ b/tests/AbstractTestCase.php @@ -1,10 +1,10 @@ getMockBuilder('Tests\\Clue\\React\\HttpProxy\\CallableStub')->getMock(); - } -} - -class CallableStub -{ - public function __invoke() - { + return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock(); } } diff --git a/tests/FunctionalTest.php b/tests/FunctionalTest.php index 074792d..f0b0a88 100644 --- a/tests/FunctionalTest.php +++ b/tests/FunctionalTest.php @@ -1,6 +1,6 @@ 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(); @@ -104,4 +105,17 @@ public function testCancelWhileConnectingShouldNotCreateGarbageCycles() $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); + } + } } diff --git a/tests/ProxyConnectorTest.php b/tests/ProxyConnectorTest.php index 9893daa..f6f6276 100644 --- a/tests/ProxyConnectorTest.php +++ b/tests/ProxyConnectorTest.php @@ -1,6 +1,6 @@