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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/vendor
/composer.lock
20 changes: 16 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
language: php

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

sudo: false

install:
- composer install --prefer-source --no-interaction
- composer install --no-interaction

script:
- vendor/bin/phpunit --coverage-text
5 changes: 3 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit colors="true"
<phpunit bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
Expand All @@ -15,4 +16,4 @@
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>
</phpunit>
21 changes: 14 additions & 7 deletions tests/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
use Socket\Raw\Factory;
use Socket\Raw\Socket;

(include_once __DIR__.'/../vendor/autoload.php') OR die(PHP_EOL.'ERROR: composer autoloader not found, run "composer install" or see README for instructions'.PHP_EOL);

class FactoryTest extends PHPUnit_Framework_TestCase{

class FactoryTest extends PHPUnit_Framework_TestCase
{
/**
* @var Socket\Raw\Factory
* @type Factory
Expand All @@ -20,15 +18,24 @@ public function setUp()

public function testSupportsIpv6()
{
// TODO: check this check
if (!defined('AF_INET6')) {
static $available = null;
if ($available === null) {
$test = @stream_socket_client('udp://[::1]:0');
if ($test === false) {
$available = false;
} else {
fclose($test);
$available = true;
}
}

if (!$available) {
$this->markTestSkipped('This system does not seem to support IPv6 sockets / addressing');
}
}

public function testSupportsUnix()
{
// TODO: check this check
if (!defined('AF_UNIX')) {
$this->markTestSkipped('This system does not seem to support UNIX and UDG sockets');
}
Expand Down
12 changes: 5 additions & 7 deletions tests/SocketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
use Socket\Raw\Socket;
use Socket\Raw\Factory;

(include_once __DIR__.'/../vendor/autoload.php') OR die(PHP_EOL.'ERROR: composer autoloader not found, run "composer install" or see README for instructions'.PHP_EOL);

class SocketTest extends PHPUnit_Framework_TestCase{

class SocketTest extends PHPUnit_Framework_TestCase
{
/**
* @var Socket\Raw\Factory
* @type Factory
Expand Down Expand Up @@ -161,7 +159,7 @@ public function testConnectTimeoutFailTimeout()
{
$socket = $this->factory->createTcp4();

$this->setExpectedException('Socket\Raw\Exception', '', SOCKET_ETIMEDOUT);
$this->setExpectedException('Socket\Raw\Exception', null, SOCKET_ETIMEDOUT);

$socket->connectTimeout('default.com:81', 0.001);
}
Expand All @@ -170,7 +168,7 @@ public function testConnectTimeoutFailUnbound()
{
$socket = $this->factory->createTcp4();

$this->setExpectedException('Socket\Raw\Exception', '', SOCKET_ECONNREFUSED);
$this->setExpectedException('Socket\Raw\Exception', null, SOCKET_ECONNREFUSED);

$socket->connectTimeout('localhost:2', 0.5);
}
Expand All @@ -179,7 +177,7 @@ public function testConnectTimeoutFailAlreadyConnected()
{
$socket = $this->factory->createClient('google.com:80');

$this->setExpectedException('Socket\Raw\Exception', '', SOCKET_EISCONN);
$this->setExpectedException('Socket\Raw\Exception', null, SOCKET_EISCONN);

$socket->connectTimeout('google.com:8000', 10);
}
Expand Down