Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ install:
- composer install --no-interaction

script:
- phpunit --coverage-text
- vendor/bin/phpunit --coverage-text
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Streaming newline delimited JSON ([NDJSON](http://ndjson.org/)) parser and encod
* [Decoder](#decoder)
* [Encoder](#encoder)
* [Install](#install)
* [Tests](#tests)
* [License](#license)
* [More](#more)

Expand Down Expand Up @@ -197,6 +198,20 @@ $ composer require clue/ndjson-react:^0.1

See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.

## Tests

To run the test suite, you first need to clone this repo and then install all dependencies [through Composer](http://getcomposer.org):

```bash
$ composer install
```

To run the test suite, go to the project root and run:

```bash
$ php vendor/bin/phpunit
```

## License

MIT
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"react/stream": "^0.4 || ^0.3"
},
"require-dev": {
"react/event-loop": " ^0.4 || ^0.3"
"react/event-loop": " ^0.4 || ^0.3",
"phpunit/phpunit": "^5.0 || ^4.8"
}
}
6 changes: 3 additions & 3 deletions tests/DecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function testEmitErrorEventWillForwardAndClose()

public function testPipeReturnsDestStream()
{
$dest = $this->getMock('React\Stream\WritableStreamInterface');
$dest = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();

$ret = $this->decoder->pipe($dest);

Expand All @@ -189,7 +189,7 @@ public function testPipeReturnsDestStream()

public function testForwardPauseToInput()
{
$this->input = $this->getMock('React\Stream\ReadableStreamInterface');
$this->input = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
$this->input->expects($this->once())->method('pause');

$this->decoder = new Decoder($this->input);
Expand All @@ -198,7 +198,7 @@ public function testForwardPauseToInput()

public function testForwardResumeToInput()
{
$this->input = $this->getMock('React\Stream\ReadableStreamInterface');
$this->input = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
$this->input->expects($this->once())->method('resume');

$this->decoder = new Decoder($this->input);
Expand Down
14 changes: 7 additions & 7 deletions tests/EncoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testPrettyPrintDoesNotMakeSenseForNDJson()

public function testWriteString()
{
$this->output = $this->getMock('React\Stream\WritableStreamInterface');
$this->output = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();
$this->output->expects($this->once())->method('isWritable')->willReturn(true);
$this->encoder = new Encoder($this->output);

Expand All @@ -39,7 +39,7 @@ public function testWriteString()

public function testWriteNull()
{
$this->output = $this->getMock('React\Stream\WritableStreamInterface');
$this->output = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();
$this->output->expects($this->once())->method('isWritable')->willReturn(true);
$this->encoder = new Encoder($this->output);

Expand All @@ -50,7 +50,7 @@ public function testWriteNull()

public function testWriteInfiniteWillEmitErrorAndClose()
{
$this->output = $this->getMock('React\Stream\WritableStreamInterface');
$this->output = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();
$this->output->expects($this->once())->method('isWritable')->willReturn(true);
$this->encoder = new Encoder($this->output);

Expand All @@ -66,7 +66,7 @@ public function testWriteInfiniteWillEmitErrorAndClose()

public function testEndWithoutDataWillEndOutputWithoutData()
{
$this->output = $this->getMock('React\Stream\WritableStreamInterface');
$this->output = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();
$this->output->expects($this->once())->method('isWritable')->willReturn(true);
$this->encoder = new Encoder($this->output);

Expand All @@ -78,7 +78,7 @@ public function testEndWithoutDataWillEndOutputWithoutData()

public function testEndWithDataWillForwardDataAndEndOutputWithoutData()
{
$this->output = $this->getMock('React\Stream\WritableStreamInterface');
$this->output = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();
$this->output->expects($this->once())->method('isWritable')->willReturn(true);
$this->encoder = new Encoder($this->output);

Expand Down Expand Up @@ -106,7 +106,7 @@ public function testClosingOutputClosesEncoder()

public function testPassingClosedStreamToEncoderWillCloseImmediately()
{
$this->output = $this->getMock('React\Stream\WritableStreamInterface');
$this->output = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();
$this->output->expects($this->once())->method('isWritable')->willReturn(false);
$this->encoder = new Encoder($this->output);

Expand All @@ -115,7 +115,7 @@ public function testPassingClosedStreamToEncoderWillCloseImmediately()

public function testWritingToClosedStreamWillNotForwardData()
{
$this->output = $this->getMock('React\Stream\WritableStreamInterface');
$this->output = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();
$this->output->expects($this->once())->method('isWritable')->willReturn(false);
$this->encoder = new Encoder($this->output);

Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function expectCallableOnceParameter($type)
*/
protected function createCallableMock()
{
return $this->getMock('CallableStub');
return $this->getMockBuilder('CallableStub')->getMock();
}
}

Expand Down