Skip to content

Commit

Permalink
Merge pull request #23 from clue-labs/windows
Browse files Browse the repository at this point in the history
Run tests on Windows
  • Loading branch information
clue authored Apr 18, 2020
2 parents 361682d + 7cfd13e commit e726b52
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions examples/gunzip.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions examples/gzip.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion tests/FunctionalExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/ZlibFilterGzipCompressorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit e726b52

Please sign in to comment.