Skip to content

Commit 834aff1

Browse files
authored
Merge pull request #46 from clue-labs/tests
Add PHPUnit to require-dev
2 parents 988f7ce + 9720d7e commit 834aff1

6 files changed

Lines changed: 53 additions & 7 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ install:
1616
- composer install --prefer-source --no-interaction
1717

1818
script:
19-
- phpunit --coverage-text
19+
- vendor/bin/phpunit --coverage-text

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,36 @@ Zenity](#install) yourself.
1111

1212
![https://help.gnome.org/users/zenity/stable/question.html](https://help.gnome.org/users/zenity/stable/figures/zenity-question-screenshot.png)
1313

14+
**Table of contents**
15+
16+
* [Quickstart example](#quickstart-example)
17+
* [Usage](#usage)
18+
* [Launcher](#launcher)
19+
* [setBin()](#setbin)
20+
* [waitFor()](#waitfor)
21+
* [launch()](#launch)
22+
* [launchZen()](#launchzen)
23+
* [Mixing synchronous and asynchronous PHP](#mixing-synchronous-and-asynchronous-php)
24+
* [Builder](#builder)
25+
* [Dialog](#dialog)
26+
* [AbstractDialog](#abstractdialog)
27+
* [CalendarDialog](#calendardialog)
28+
* [ColorSelectionDialog](#colorselectiondialog)
29+
* [EntryDialog](#entrydialog)
30+
* [ErrorDialog](#errordialog)
31+
* [FileSelectionDialog](#fileselectiondialog)
32+
* [FormsDialog](#formsdialog)
33+
* [InfoDialog](#infodialog)
34+
* [ListDialog](#listdialog)
35+
* [NotificationDialog](#notificationdialog)
36+
* [PasswordDialog](#passworddialog)
37+
* [QuestionDialog](#questiondialog)
38+
* [ScaleDialog](#scaledialog)
39+
* [TextInfoDialog](#textinfodialog)
40+
* [WarningDialog](#warningdialog)
41+
* [Install](#install)
42+
* [License](#license)
43+
1444
## Quickstart example
1545

1646
Once [installed](#install), you can use the following code to open a prompt
@@ -297,6 +327,21 @@ $launcher = new Launcher($loop);
297327
$launcher->setBin('/path/to/zenity');
298328
```
299329

330+
## Tests
331+
332+
To run the test suite, you first need to clone this repo and then install all
333+
dependencies [through Composer](https://getcomposer.org):
334+
335+
```bash
336+
$ composer install
337+
```
338+
339+
To run the test suite, go to the project root and run:
340+
341+
```bash
342+
$ php vendor/bin/phpunit
343+
```
344+
300345
## License
301346

302347
MIT

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"react/child-process": "~0.4.0|~0.3.0"
1818
},
1919
"require-dev": {
20-
"clue/block-react": "^1.1"
20+
"clue/block-react": "^1.1",
21+
"phpunit/phpunit": "^5.0 || ^4.8"
2122
},
2223
"autoload": {
2324
"psr-4": { "Clue\\React\\Zenity\\": "src/" }

tests/FunctionalLauncherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function setUp()
1515
{
1616
$this->loop = Factory::create();
1717

18-
$this->dialog = $this->getMock('Clue\React\Zenity\Dialog\AbstractDialog');
18+
$this->dialog = $this->getMockBuilder('Clue\React\Zenity\Dialog\AbstractDialog')->getMock();
1919
$this->dialog->expects($this->once())->method('createZen')->will($this->returnValue(new BaseZen()));
2020

2121
$this->launcher = new Launcher($this->loop);

tests/Zen/BaseZenTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ abstract class BaseZenTest extends TestCase
1313
public function setUp()
1414
{
1515
$inbuffer =& $this->stdin;
16-
$this->instream = $this->getMock('React\Stream\WritableStreamInterface');
16+
$this->instream = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();
1717
$this->instream->expects($this->any())->method('write')->will($this->returnCallback(function ($value) use (&$inbuffer) {
1818
$inbuffer .= $value;
1919
}));
2020

2121
$this->process = $this->getMockBuilder('React\ChildProcess\Process')->disableOriginalConstructor()->getMock();
2222
$this->process->stdin = $this->instream;
2323

24-
$this->process->stdout = $this->getMock('React\Stream\ReadableStreamInterface');
25-
$this->process->stderr = $this->getMock('React\Stream\ReadableStreamInterface');
24+
$this->process->stdout = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
25+
$this->process->stderr = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
2626
}
2727

2828
public function testClosingZenTerminatesProcess()

tests/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function expectCallableNever()
4242
*/
4343
protected function createCallableMock()
4444
{
45-
return $this->getMock('CallableStub');
45+
return $this->getMockBuilder('CallableStub')->getMock();
4646
}
4747

4848
protected function expectPromiseResolve($promise)

0 commit comments

Comments
 (0)