Skip to content

Commit

Permalink
Merge pull request #235 from clue-labs/tests
Browse files Browse the repository at this point in the history
Simplify Travis CI test matrix for Mac OS X setup and skip all TLS tests on legacy HHVM
  • Loading branch information
jsor authored May 21, 2020
2 parents b3de2a0 + 8e2f1d7 commit 59730c4
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 45 deletions.
21 changes: 5 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,19 @@ matrix:
- php: 7.4
- php: hhvm-3.18
install: composer require phpunit/phpunit:^5 --dev --no-interaction # requires legacy phpunit
- os: osx
- name: Mac OS X
os: osx
language: generic
php: 7.0 # just to look right on travis
env:
- PACKAGE: php70
before_install:
- curl -s http://getcomposer.org/installer | php
- mv composer.phar /usr/local/bin/composer
allow_failures:
- php: hhvm-3.18
- os: osx

sudo: false

install:
# OSX install inspired by https://github.com/kiler129/TravisCI-OSX-PHP
- |
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
brew tap homebrew/homebrew-php
echo "Installing PHP ..."
brew install "${PACKAGE}"
brew install "${PACKAGE}"-xdebug
brew link "${PACKAGE}"
echo "Installing composer ..."
curl -s http://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
fi
- composer install --no-interaction

script:
Expand Down
5 changes: 2 additions & 3 deletions tests/FunctionalConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ public function connectionToTcpServerShouldSucceedWithLocalhost()
$loop = Factory::create();

$server = new TcpServer(9998, $loop);
$server->on('connection', $this->expectCallableOnce());
$server->on('connection', array($server, 'close'));

$connector = new Connector($loop);

$connection = Block\await($connector->connect('localhost:9998'), $loop, self::TIMEOUT);

$server->close();

$this->assertInstanceOf('React\Socket\ConnectionInterface', $connection);

$connection->close();
$server->close();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/FunctionalSecureServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class FunctionalSecureServerTest extends TestCase

public function setUp()
{
if (!function_exists('stream_socket_enable_crypto')) {
$this->markTestSkipped('Not supported on your platform (outdated HHVM?)');
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Not supported on legacy HHVM');
}
}

Expand Down
16 changes: 8 additions & 8 deletions tests/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public function gettingStuffFromGoogleShouldWork()
/** @test */
public function gettingEncryptedStuffFromGoogleShouldWork()
{
if (!function_exists('stream_socket_enable_crypto')) {
$this->markTestSkipped('Not supported on your platform (outdated HHVM?)');
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Not supported on legacy HHVM');
}

$loop = Factory::create();
Expand All @@ -55,8 +55,8 @@ public function gettingEncryptedStuffFromGoogleShouldWork()
/** @test */
public function gettingEncryptedStuffFromGoogleShouldWorkIfHostIsResolvedFirst()
{
if (!function_exists('stream_socket_enable_crypto')) {
$this->markTestSkipped('Not supported on your platform (outdated HHVM?)');
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Not supported on legacy HHVM');
}

$loop = Factory::create();
Expand Down Expand Up @@ -363,8 +363,8 @@ public function testConnectingFailsIfTimeoutIsTooSmall()

public function testSelfSignedRejectsIfVerificationIsEnabled()
{
if (!function_exists('stream_socket_enable_crypto')) {
$this->markTestSkipped('Not supported on your platform (outdated HHVM?)');
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Not supported on legacy HHVM');
}

$loop = Factory::create();
Expand All @@ -381,8 +381,8 @@ public function testSelfSignedRejectsIfVerificationIsEnabled()

public function testSelfSignedResolvesIfVerificationIsDisabled()
{
if (!function_exists('stream_socket_enable_crypto')) {
$this->markTestSkipped('Not supported on your platform (outdated HHVM?)');
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Not supported on legacy HHVM');
}

$loop = Factory::create();
Expand Down
4 changes: 2 additions & 2 deletions tests/SecureConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class SecureConnectorTest extends TestCase

public function setUp()
{
if (!function_exists('stream_socket_enable_crypto')) {
$this->markTestSkipped('Not supported on your platform (outdated HHVM?)');
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Not supported on legacy HHVM');
}

$this->loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
Expand Down
4 changes: 2 additions & 2 deletions tests/SecureIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class SecureIntegrationTest extends TestCase

public function setUp()
{
if (!function_exists('stream_socket_enable_crypto')) {
$this->markTestSkipped('Not supported on your platform (outdated HHVM?)');
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Not supported on legacy HHVM');
}

$this->loop = LoopFactory::create();
Expand Down
4 changes: 2 additions & 2 deletions tests/SecureServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class SecureServerTest extends TestCase
{
public function setUp()
{
if (!function_exists('stream_socket_enable_crypto')) {
$this->markTestSkipped('Not supported on your platform (outdated HHVM?)');
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Not supported on legacy HHVM');
}
}

Expand Down
7 changes: 5 additions & 2 deletions tests/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public function testConstructorCreatesExpectedTcpServer()

public function testConstructorCreatesExpectedUnixServer()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Not supported on legacy HHVM');
}
if (!in_array('unix', stream_get_transports())) {
$this->markTestSkipped('Unix domain sockets (UDS) not supported on your platform (Windows?)');
}
Expand Down Expand Up @@ -199,8 +202,8 @@ public function testEmitsConnectionWithInheritedContextOptions()

public function testDoesNotEmitSecureConnectionForNewPlaintextConnectionThatIsIdle()
{
if (!function_exists('stream_socket_enable_crypto')) {
$this->markTestSkipped('Not supported on your platform (outdated HHVM?)');
if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Not supported on legacy HHVM');
}

$loop = Factory::create();
Expand Down
13 changes: 5 additions & 8 deletions tests/TcpConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public function connectionToTcpServerShouldSucceed()
$loop = Factory::create();

$server = new TcpServer(9999, $loop);
$server->on('connection', $this->expectCallableOnce());
$server->on('connection', array($server, 'close'));

$connector = new TcpConnector($loop);

Expand All @@ -62,6 +60,7 @@ public function connectionToTcpServerShouldSucceed()
$this->assertInstanceOf('React\Socket\ConnectionInterface', $connection);

$connection->close();
$server->close();
}

/**
Expand Down Expand Up @@ -101,7 +100,6 @@ public function connectionToTcpServerShouldSucceedWithRemoteAdressSameAsTarget()
$loop = Factory::create();

$server = new TcpServer(9999, $loop);
$server->on('connection', array($server, 'close'));

$connector = new TcpConnector($loop);

Expand All @@ -111,6 +109,7 @@ public function connectionToTcpServerShouldSucceedWithRemoteAdressSameAsTarget()
$this->assertEquals('tcp://127.0.0.1:9999', $connection->getRemoteAddress());

$connection->close();
$server->close();
}

/** @test */
Expand All @@ -119,7 +118,6 @@ public function connectionToTcpServerShouldSucceedWithLocalAdressOnLocalhost()
$loop = Factory::create();

$server = new TcpServer(9999, $loop);
$server->on('connection', array($server, 'close'));

$connector = new TcpConnector($loop);

Expand All @@ -130,6 +128,7 @@ public function connectionToTcpServerShouldSucceedWithLocalAdressOnLocalhost()
$this->assertNotEquals('tcp://127.0.0.1:9999', $connection->getLocalAddress());

$connection->close();
$server->close();
}

/** @test */
Expand All @@ -138,13 +137,13 @@ public function connectionToTcpServerShouldSucceedWithNullAddressesAfterConnecti
$loop = Factory::create();

$server = new TcpServer(9999, $loop);
$server->on('connection', array($server, 'close'));

$connector = new TcpConnector($loop);

$connection = Block\await($connector->connect('127.0.0.1:9999'), $loop, self::TIMEOUT);
/* @var $connection ConnectionInterface */

$server->close();
$connection->close();

$this->assertNull($connection->getRemoteAddress());
Expand Down Expand Up @@ -197,9 +196,6 @@ public function connectionToIp6TcpServerShouldSucceed()
$this->markTestSkipped('Unable to start IPv6 server socket (IPv6 not supported on this system?)');
}

$server->on('connection', $this->expectCallableOnce());
$server->on('connection', array($server, 'close'));

$connector = new TcpConnector($loop);

$connection = Block\await($connector->connect('[::1]:9999'), $loop, self::TIMEOUT);
Expand All @@ -211,6 +207,7 @@ public function connectionToIp6TcpServerShouldSucceed()
$this->assertNotEquals('tcp://[::1]:9999', $connection->getLocalAddress());

$connection->close();
$server->close();
}

/** @test */
Expand Down

0 comments on commit 59730c4

Please sign in to comment.