Skip to content

Commit e726b52

Browse files
authored
Merge pull request #23 from clue-labs/windows
Run tests on Windows
2 parents 361682d + 7cfd13e commit e726b52

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@ matrix:
1717
- php: 7.2
1818
- php: 7.3
1919
- php: 7.4
20+
- name: "Windows"
21+
os: windows
22+
language: shell # no built-in php support
23+
before_install:
24+
- choco install php
25+
- choco install composer
26+
- export PATH="$(powershell -Command '("Process", "Machine" | % { [Environment]::GetEnvironmentVariable("PATH", $_) -Split ";" -Replace "\\$", "" } | Select -Unique | % { cygpath $_ }) -Join ":"')"
2027
- php: hhvm-3.18
2128
allow_failures:
29+
- os: windows
2230
- php: hhvm-3.18
2331

2432
install:

examples/gunzip.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
require __DIR__ . '/../vendor/autoload.php';
44

5+
if (DIRECTORY_SEPARATOR === '\\') {
6+
fwrite(STDERR, 'Non-blocking console I/O not supported on Windows' . PHP_EOL);
7+
exit(1);
8+
}
9+
510
if (!defined('ZLIB_ENCODING_GZIP')) {
611
fwrite(STDERR, 'Requires PHP 5.4+ with ext-zlib enabled' . PHP_EOL);
712
exit(1);

examples/gzip.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
require __DIR__ . '/../vendor/autoload.php';
44

5+
if (DIRECTORY_SEPARATOR === '\\') {
6+
fwrite(STDERR, 'Non-blocking console I/O not supported on Windows' . PHP_EOL);
7+
exit(1);
8+
}
9+
510
if (!defined('ZLIB_ENCODING_GZIP')) {
611
fwrite(STDERR, 'Requires PHP 5.4+ with ext-zlib enabled' . PHP_EOL);
712
exit(1);

tests/FunctionalExamplesTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ class FunctionalExamplesTest extends TestCase
44
{
55
public function setUp()
66
{
7-
if (defined('HHVM_VERSION')) $this->markTestSkipped('Not supported on HHVM (ignores window size / encoding format)');
7+
if (DIRECTORY_SEPARATOR === '\\') {
8+
$this->markTestSkipped('Non-blocking console I/O not supported on Windows');
9+
}
10+
if (defined('HHVM_VERSION')) {
11+
$this->markTestSkipped('Not supported on HHVM (ignores window size / encoding format)');
12+
}
813
}
914
public function testChain()
1015
{

tests/ZlibFilterGzipCompressorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function setUp()
1515

1616
public function testCompressEmpty()
1717
{
18-
$os = "\x03"; // UNIX (0x03) or UNKNOWN (0xFF)
18+
$os = DIRECTORY_SEPARATOR === '\\' ? "\x0a" : "\x03"; // NTFS(0x0a) or UNIX (0x03)
1919
$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"));
2020
$this->compressor->on('end', $this->expectCallableOnce());
2121

0 commit comments

Comments
 (0)