From f51e71cffded4cf68676b94e5538b8ea3f1bc26d Mon Sep 17 00:00:00 2001 From: toimtoimtoim Date: Sun, 27 Nov 2016 13:13:05 +0200 Subject: [PATCH] bump php version to 5.5+, update readme --- README.md | 14 ++++++++++++-- composer.json | 2 +- tests/ModbusMaster/MockServerTestCase.php | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f478cd8..2349b3b 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ Implementation of the basic functionality of the Modbus TCP and UDP based protocol using PHP. -**NOTE: This is a fork to fix & update the library code (and code alone). Notably, the tests are probably all broken.** +**NOTE: This is a fork to fix & update the library code (and code alone).** > **What's new** > -> This fork adds a namespace and fixes issues encountered when porting to PHP 7 +> This fork adds a namespace and fixes issues encountered when porting to PHP 7, fixes old MS Windows specific tests ## Implemented features @@ -26,6 +26,7 @@ Implementation of the basic functionality of the Modbus TCP and UDP based protoc ## Requirements * The PHP extension php_sockets.dll should be enabled (server php.ini file) + * PHP 5.5+ ## Example @@ -53,6 +54,15 @@ Use the `setTimeout($seconds)` and `setSocketTimeout($read_timeout_sec, $write_t Most of the code is (to some extent) commented and documented with PhpDoc. You should get useful tooltips in your IDE. +## Tests + +To run the test suite, you need install the dependencies via composer, then +run PHPUnit. + +NB: PHP 5.6+ is required for tests + + composer install + vendor/bin/phpunit ## GoogleCode legacy docs & downloads diff --git a/composer.json b/composer.json index d52d076..f643d4a 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "description": "PhpModbus with namespaces and updated to PHP 7", "license": "LGPL", "require": { - "php": "^5.3.2 || ^7.0", + "php": "^5.5 || ^7.0", "ext-sockets": "*" }, "require-dev": { diff --git a/tests/ModbusMaster/MockServerTestCase.php b/tests/ModbusMaster/MockServerTestCase.php index b22f309..43d902f 100644 --- a/tests/ModbusMaster/MockServerTestCase.php +++ b/tests/ModbusMaster/MockServerTestCase.php @@ -23,7 +23,7 @@ abstract class MockServerTestCase extends TestCase $clientData[] = $output; }); - if ('WIN' !== strtoupper(substr(PHP_OS, 0, 3))) { + if (strpos(PHP_OS, 'WIN') === false) { // wait to spin up. needed for linux. unnessecary on Windows 10. // Ugly but even with 150ms sleep test run faster on Linux usleep(150000);