Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
],
"require": {
"php": ">=5.3",
"react/event-loop": "0.3.*|0.4.*",
"react/stream": "^0.4.2",
"clue/utf8-react": "^1.0 || ^0.1",
"clue/term-react": "^1.0 || ^0.1.1"
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
"react/stream": "^1.0 || ^0.7.2",
"clue/utf8-react": "^1.1",
"clue/term-react": "^1.1"
},
"suggest": {
"ext-mbstring": "Using ext-mbstring should provide slightly better performance for handling I/O"
Expand Down
97 changes: 0 additions & 97 deletions src/Stdin.php

This file was deleted.

6 changes: 4 additions & 2 deletions src/Stdio.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
use Evenement\EventEmitter;
use React\Stream\DuplexStreamInterface;
use React\EventLoop\LoopInterface;
use React\Stream\ReadableResourceStream;
use React\Stream\ReadableStreamInterface;
use React\Stream\WritableResourceStream;
use React\Stream\WritableStreamInterface;
use React\Stream\Util;

Expand All @@ -22,11 +24,11 @@ class Stdio extends EventEmitter implements DuplexStreamInterface
public function __construct(LoopInterface $loop, ReadableStreamInterface $input = null, WritableStreamInterface $output = null, Readline $readline = null)
{
if ($input === null) {
$input = new Stdin($loop);
$input = new ReadableResourceStream(STDIN, $loop);
}

if ($output === null) {
$output = new Stdout();
$output = new WritableResourceStream(STDOUT, $loop);
}

if ($readline === null) {
Expand Down
31 changes: 0 additions & 31 deletions src/Stdout.php

This file was deleted.

3 changes: 2 additions & 1 deletion tests/ReadlineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Clue\React\Stdio\Readline;
use React\Stream\ReadableStream;
use React\Stream\ThroughStream;

class ReadlineTest extends TestCase
{
Expand All @@ -11,7 +12,7 @@ class ReadlineTest extends TestCase

public function setUp()
{
$this->input = new ReadableStream();
$this->input = new ThroughStream();
$this->output = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();

$this->readline = new Readline($this->input, $this->output);
Expand Down
20 changes: 17 additions & 3 deletions tests/StdioTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Clue\React\Stdio\Stdio;
use Clue\React\Stdio\Readline;
use React\Stream\ReadableStream;
use React\Stream\ThroughStream;
use React\Stream\WritableStream;

class StdioTest extends TestCase
Expand All @@ -18,6 +19,19 @@ public function setUp()
public function testCtorDefaultArgs()
{
$stdio = new Stdio($this->loop);

$input = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
$input->expects($this->once())->method('close');
$inputProperty = new ReflectionProperty($stdio, 'input');
$inputProperty->setAccessible(true);
$inputProperty->setValue($stdio, $input);

$output = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();
$output->expects($this->once())->method('close');
$outputProperty = new ReflectionProperty($stdio, 'output');
$outputProperty->setAccessible(true);
$outputProperty->setValue($stdio, $output);

$stdio->close();
}

Expand Down Expand Up @@ -461,7 +475,7 @@ public function testDataEventWillBeForwarded()

public function testEndEventWillBeForwarded()
{
$input = new ReadableStream();
$input = new ThroughStream();
$output = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();

//$readline = $this->getMockBuilder('Clue\React\Stdio\Readline')->disableOriginalConstructor()->getMock();
Expand All @@ -476,7 +490,7 @@ public function testEndEventWillBeForwarded()

public function testErrorEventFromInputWillBeForwarded()
{
$input = new ReadableStream();
$input = new ThroughStream();
$output = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();

//$readline = $this->getMockBuilder('Clue\React\Stdio\Readline')->disableOriginalConstructor()->getMock();
Expand All @@ -492,7 +506,7 @@ public function testErrorEventFromInputWillBeForwarded()
public function testErrorEventFromOutputWillBeForwarded()
{
$input = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
$output = new WritableStream();
$output = new ThroughStream();

//$readline = $this->getMockBuilder('Clue\React\Stdio\Readline')->disableOriginalConstructor()->getMock();
$readline = new Readline($input, $output);
Expand Down