Skip to content

Commit 5099262

Browse files
authored
Merge pull request #19 from clue-labs/tests
Add PHPUnit to require-dev
2 parents bb87842 + 84682d3 commit 5099262

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ install:
1414
- composer install --no-interaction
1515

1616
script:
17-
- phpunit --coverage-text
17+
- vendor/bin/phpunit --coverage-text

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Streaming terminal emulator, built on top of React PHP
77
* [Usage](#usage)
88
* [ControlCodeParser](#controlcodeparser)
99
* [Install](#install)
10+
* [Tests](#tests)
1011
* [License](#license)
1112
* [More](#more)
1213

@@ -113,6 +114,21 @@ $ composer require clue/term-react:^0.1
113114

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

117+
## Tests
118+
119+
To run the test suite, you first need to clone this repo and then install all
120+
dependencies [through Composer](http://getcomposer.org):
121+
122+
```bash
123+
$ composer install
124+
```
125+
126+
To run the test suite, go to the project root and run:
127+
128+
```bash
129+
$ php vendor/bin/phpunit
130+
```
131+
116132
## License
117133

118134
MIT

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"react/stream": "^0.4 || ^0.3"
1919
},
2020
"require-dev": {
21+
"phpunit/phpunit": "^5.0 || ^4.8",
2122
"react/event-loop": "^0.4 || ^0.3"
2223
}
2324
}

tests/ControlCodeParserTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public function testClosingInputWillRemoveAllDataListeners()
250250

251251
public function testClosingParserWillCloseInput()
252252
{
253-
$this->input = $this->getMock('React\Stream\ReadableStreamInterface');
253+
$this->input = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
254254
$this->input->expects($this->once())->method('isReadable')->willReturn(true);
255255
$this->input->expects($this->once())->method('close');
256256

@@ -277,7 +277,7 @@ public function testClosingParserWillRemoveAllDataListeners()
277277

278278
public function testClosingParserMultipleTimesWillOnlyCloseOnce()
279279
{
280-
$this->input = $this->getMock('React\Stream\ReadableStreamInterface');
280+
$this->input = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
281281
$this->input->expects($this->once())->method('isReadable')->willReturn(true);
282282
$this->input->expects($this->once())->method('close');
283283

@@ -290,7 +290,7 @@ public function testClosingParserMultipleTimesWillOnlyCloseOnce()
290290

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

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

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

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

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

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

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

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

tests/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function expectCallableOnceParameter($type)
5353
*/
5454
protected function createCallableMock()
5555
{
56-
return $this->getMock('CallableStub');
56+
return $this->getMockBuilder('CallableStub')->getMock();
5757
}
5858
}
5959

0 commit comments

Comments
 (0)