Fix tests on Linux (Ubuntu 16.4/Php7)

pull/2/head
toimtoimtoim 8 years ago
parent 8637a19572
commit 030f0d526b
  1. 5
      tests/ModbusMaster/MockServerTestCase.php
  2. 2
      tests/ModbusMaster/ModbusExceptionTest.php

@ -23,6 +23,11 @@ abstract class MockServerTestCase extends TestCase
$clientData[] = $output; $clientData[] = $output;
}); });
if ('WIN' !== strtoupper(substr(PHP_OS, 0, 3))) {
// wait to spin up. needed for linux. unnessecary on Windows 10.
// Ugly but even with 150ms sleep test run faster on Linux
usleep(150000);
}
$closure($port); $closure($port);
}); });

@ -21,7 +21,7 @@ class ModbusExceptionTest extends MockServerTestCase
public function testPortClosedException() public function testPortClosedException()
{ {
$this->expectException(IOException::class); $this->expectException(IOException::class);
$this->expectExceptionMessage('socket_connect() failed. Reason: ()No connection could be made because the target machine actively refused it.'); $this->expectExceptionMessage('socket_connect() failed. Reason:');
$modbus = new ModbusMasterTcp('127.0.0.1'); $modbus = new ModbusMasterTcp('127.0.0.1');
$modbus->setSocketTimeout(0.2, 0.2); $modbus->setSocketTimeout(0.2, 0.2);

Loading…
Cancel
Save