diff --git a/.travis.yml b/.travis.yml index 41921e3..a27e7f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ php: - 7.0 - 7.1 - 7.2 - - hhvm # ignore errors, see below +# - hhvm # requires legacy phpunit & ignore errors, see below # lock distro so new future defaults will not break the build dist: trusty @@ -17,6 +17,8 @@ matrix: include: - php: 5.3 dist: precise + - php: hhvm + install: composer require phpunit/phpunit:^5 --dev --no-interaction allow_failures: - php: hhvm diff --git a/composer.json b/composer.json index 3460282..873d5ec 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,6 @@ "php": ">=5.3" }, "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.2" + "phpunit/phpunit": "^7.0 || ^6.0 || ^5.2 || ^4.8.35" } } diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php index 3391b8f..a18979b 100644 --- a/tests/FactoryTest.php +++ b/tests/FactoryTest.php @@ -1,9 +1,10 @@ factory = new Factory(); } + /** + * @doesNotPerformAssertions + */ public function testSupportsIpv6() { static $available = null; @@ -34,6 +38,9 @@ public function testSupportsIpv6() } } + /** + * @doesNotPerformAssertions + */ public function testSupportsUnix() { if (!defined('AF_UNIX')) { @@ -81,6 +88,7 @@ public function testCreateClientWithSmallTimeoutToUnboundPortTimesOut() * the target address should not be bound, so connecting via TCP should fail * * @see self::testCreateClientUdp4UnboundWorks() + * @doesNotPerformAssertions */ public function testCreateClientTcp4UnboundFails() { @@ -163,6 +171,7 @@ public function testCreateServerUnix() /** * @depends testSupportsUnix + * @doesNotPerformAssertions */ public function testCreateServerUnixFailInvalidPath() { @@ -319,7 +328,7 @@ public function testCreateIcmp6() } /** - * @dataProvider testCreateProvider + * @dataProvider provideCreateArguments */ public function testCreate($domain, $type, $protocol) { @@ -328,7 +337,7 @@ public function testCreate($domain, $type, $protocol) $this->assertInstanceOf('Socket\Raw\Socket', $socket); } - public static function testCreateProvider() + public static function provideCreateArguments() { // only return TCP/IP and UDP/IP as the above tests should already cover other sockets return array( @@ -337,6 +346,9 @@ public static function testCreateProvider() ); } + /** + * @doesNotPerformAssertions + */ public function testCreateInvalid() { try { @@ -360,6 +372,9 @@ public function testCreatePair() $this->assertInstanceOf('Socket\Raw\Socket', $sockets[1]); } + /** + * @doesNotPerformAssertions + */ public function testCreatePairInvalid() { try { @@ -450,6 +465,8 @@ public function testCreateFromStringSchemelessTcp6() /** * creating socket for invalid scheme should fail + * + * @doesNotPerformAssertions */ public function testCreateFromStringInvalid() { @@ -463,4 +480,16 @@ public function testCreateFromStringInvalid() $this->fail('Creating socket for invalid scheme should fail'); } + 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/SocketTest.php b/tests/SocketTest.php index 0837f10..e5f55b4 100644 --- a/tests/SocketTest.php +++ b/tests/SocketTest.php @@ -1,9 +1,10 @@ close(); } - /** @group internet */ + /** + * @group internet + * @doesNotPerformAssertions + */ public function testConnectTimeoutUdpImmediately() { $socket = $this->factory->createUdp4(); @@ -239,4 +243,17 @@ public function testServerNonBlockingAcceptClient(Socket $server) $peer->close(); } + + 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); + } + } }