forked from clue/reactphp-zlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFunctionalExamplesTest.php
36 lines (28 loc) · 1008 Bytes
/
FunctionalExamplesTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace Clue\Tests\React\Zlib;
class FunctionalExamplesTest extends TestCase
{
public function setUp()
{
if (DIRECTORY_SEPARATOR === '\\') {
$this->markTestSkipped('Non-blocking console I/O not supported on Windows');
}
}
public function testChain()
{
$in = 'hello world';
chdir(__DIR__ . '/../examples');
$out = exec('echo ' . escapeshellarg($in) . ' | php gzip.php | php gunzip.php');
$this->assertEquals('hello world', $out);
}
public function testEmpty()
{
$out = exec('cat ' . escapeshellarg(__DIR__ . '/fixtures/empty.gz') . ' | php ' . escapeshellarg(__DIR__ . '/../examples/gunzip.php'));
$this->assertEquals('', $out);
}
public function testHelloWorld()
{
$out = exec('cat ' . escapeshellarg(__DIR__ . '/fixtures/helloworld.gz') . ' | php ' . escapeshellarg(__DIR__ . '/../examples/gunzip.php'));
$this->assertEquals('hello world', $out);
}
}