diff --git a/.travis.yml b/.travis.yml index 7635499..f9fa957 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,16 @@ matrix: - php: 7.2 - php: 7.3 - php: 7.4 + - name: "Windows" + os: windows + language: shell # no built-in php support + before_install: + - choco install php + - choco install composer + - export PATH="$(powershell -Command '("Process", "Machine" | % { [Environment]::GetEnvironmentVariable("PATH", $_) -Split ";" -Replace "\\$", "" } | Select -Unique | % { cygpath $_ }) -Join ":"')" - php: hhvm-3.18 allow_failures: + - os: windows - php: hhvm-3.18 install: diff --git a/examples/gunzip.php b/examples/gunzip.php index a140572..98b70bf 100644 --- a/examples/gunzip.php +++ b/examples/gunzip.php @@ -2,6 +2,11 @@ require __DIR__ . '/../vendor/autoload.php'; +if (DIRECTORY_SEPARATOR === '\\') { + fwrite(STDERR, 'Non-blocking console I/O not supported on Windows' . PHP_EOL); + exit(1); +} + if (!defined('ZLIB_ENCODING_GZIP')) { fwrite(STDERR, 'Requires PHP 5.4+ with ext-zlib enabled' . PHP_EOL); exit(1); diff --git a/examples/gzip.php b/examples/gzip.php index 901b72f..f09c464 100644 --- a/examples/gzip.php +++ b/examples/gzip.php @@ -2,6 +2,11 @@ require __DIR__ . '/../vendor/autoload.php'; +if (DIRECTORY_SEPARATOR === '\\') { + fwrite(STDERR, 'Non-blocking console I/O not supported on Windows' . PHP_EOL); + exit(1); +} + if (!defined('ZLIB_ENCODING_GZIP')) { fwrite(STDERR, 'Requires PHP 5.4+ with ext-zlib enabled' . PHP_EOL); exit(1); diff --git a/tests/FunctionalExamplesTest.php b/tests/FunctionalExamplesTest.php index bce7652..41eaa08 100644 --- a/tests/FunctionalExamplesTest.php +++ b/tests/FunctionalExamplesTest.php @@ -4,7 +4,12 @@ class FunctionalExamplesTest extends TestCase { public function setUp() { - if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (ignores window size / encoding format)'); + if (DIRECTORY_SEPARATOR === '\\') { + $this->markTestSkipped('Non-blocking console I/O not supported on Windows'); + } + if (defined('HHVM_VERSION')) { + $this->markTestSkipped('Not supported on HHVM (ignores window size / encoding format)'); + } } public function testChain() { diff --git a/tests/ZlibFilterGzipCompressorTest.php b/tests/ZlibFilterGzipCompressorTest.php index 8a86a27..e1817f0 100644 --- a/tests/ZlibFilterGzipCompressorTest.php +++ b/tests/ZlibFilterGzipCompressorTest.php @@ -15,7 +15,7 @@ public function setUp() public function testCompressEmpty() { - $os = "\x03"; // UNIX (0x03) or UNKNOWN (0xFF) + $os = DIRECTORY_SEPARATOR === '\\' ? "\x0a" : "\x03"; // NTFS(0x0a) or UNIX (0x03) $this->compressor->on('data', $this->expectCallableOnceWith("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00" . $os . "\x03\x00" . "\x00\x00\x00\x00\x00\x00\x00\x00")); $this->compressor->on('end', $this->expectCallableOnce());