Skip to content

Commit

Permalink
Merge pull request #19 from clue-labs/tests
Browse files Browse the repository at this point in the history
Add PHPUnit to require-dev
  • Loading branch information
clue authored Apr 6, 2017
2 parents bb87842 + 84682d3 commit 5099262
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
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
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Streaming terminal emulator, built on top of React PHP
* [Usage](#usage)
* [ControlCodeParser](#controlcodeparser)
* [Install](#install)
* [Tests](#tests)
* [License](#license)
* [More](#more)

Expand Down Expand Up @@ -113,6 +114,21 @@ $ composer require clue/term-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
1 change: 1 addition & 0 deletions 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": {
"phpunit/phpunit": "^5.0 || ^4.8",
"react/event-loop": "^0.4 || ^0.3"
}
}
12 changes: 6 additions & 6 deletions tests/ControlCodeParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public function testClosingInputWillRemoveAllDataListeners()

public function testClosingParserWillCloseInput()
{
$this->input = $this->getMock('React\Stream\ReadableStreamInterface');
$this->input = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
$this->input->expects($this->once())->method('isReadable')->willReturn(true);
$this->input->expects($this->once())->method('close');

Expand All @@ -277,7 +277,7 @@ public function testClosingParserWillRemoveAllDataListeners()

public function testClosingParserMultipleTimesWillOnlyCloseOnce()
{
$this->input = $this->getMock('React\Stream\ReadableStreamInterface');
$this->input = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
$this->input->expects($this->once())->method('isReadable')->willReturn(true);
$this->input->expects($this->once())->method('close');

Expand All @@ -290,7 +290,7 @@ public function testClosingParserMultipleTimesWillOnlyCloseOnce()

public function testPassingClosedInputToParserWillCloseParser()
{
$this->input = $this->getMock('React\Stream\ReadableStreamInterface');
$this->input = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
$this->input->expects($this->once())->method('isReadable')->willReturn(false);

$this->parser = new ControlCodeParser($this->input);
Expand All @@ -311,7 +311,7 @@ public function testPassingClosedInputToParserWillNotAddAnyDataListeners()

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

$this->parser = new ControlCodeParser($this->input);
Expand All @@ -321,7 +321,7 @@ public function testWillForwardPauseToInput()

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

$this->parser = new ControlCodeParser($this->input);
Expand All @@ -331,7 +331,7 @@ public function testWillForwardResumeToInput()

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

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

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

0 comments on commit 5099262

Please sign in to comment.