Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHPUnit to require-dev #46

Merged
merged 3 commits into from
Jul 8, 2017
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 @@ -16,4 +16,4 @@ install:
- composer install --prefer-source --no-interaction

script:
- phpunit --coverage-text
- vendor/bin/phpunit --coverage-text
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,36 @@ Zenity](#install) yourself.

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

**Table of contents**

* [Quickstart example](#quickstart-example)
* [Usage](#usage)
* [Launcher](#launcher)
* [setBin()](#setbin)
* [waitFor()](#waitfor)
* [launch()](#launch)
* [launchZen()](#launchzen)
* [Mixing synchronous and asynchronous PHP](#mixing-synchronous-and-asynchronous-php)
* [Builder](#builder)
* [Dialog](#dialog)
* [AbstractDialog](#abstractdialog)
* [CalendarDialog](#calendardialog)
* [ColorSelectionDialog](#colorselectiondialog)
* [EntryDialog](#entrydialog)
* [ErrorDialog](#errordialog)
* [FileSelectionDialog](#fileselectiondialog)
* [FormsDialog](#formsdialog)
* [InfoDialog](#infodialog)
* [ListDialog](#listdialog)
* [NotificationDialog](#notificationdialog)
* [PasswordDialog](#passworddialog)
* [QuestionDialog](#questiondialog)
* [ScaleDialog](#scaledialog)
* [TextInfoDialog](#textinfodialog)
* [WarningDialog](#warningdialog)
* [Install](#install)
* [License](#license)

## Quickstart example

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

## Tests

To run the test suite, you first need to clone this repo and then install all
dependencies [through Composer](https://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 @@ -17,7 +17,8 @@
"react/child-process": "~0.4.0|~0.3.0"
},
"require-dev": {
"clue/block-react": "^1.1"
"clue/block-react": "^1.1",
"phpunit/phpunit": "^5.0 || ^4.8"
},
"autoload": {
"psr-4": { "Clue\\React\\Zenity\\": "src/" }
Expand Down
2 changes: 1 addition & 1 deletion tests/FunctionalLauncherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function setUp()
{
$this->loop = Factory::create();

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

$this->launcher = new Launcher($this->loop);
Expand Down
6 changes: 3 additions & 3 deletions tests/Zen/BaseZenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ abstract class BaseZenTest extends TestCase
public function setUp()
{
$inbuffer =& $this->stdin;
$this->instream = $this->getMock('React\Stream\WritableStreamInterface');
$this->instream = $this->getMockBuilder('React\Stream\WritableStreamInterface')->getMock();
$this->instream->expects($this->any())->method('write')->will($this->returnCallback(function ($value) use (&$inbuffer) {
$inbuffer .= $value;
}));

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

$this->process->stdout = $this->getMock('React\Stream\ReadableStreamInterface');
$this->process->stderr = $this->getMock('React\Stream\ReadableStreamInterface');
$this->process->stdout = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
$this->process->stderr = $this->getMockBuilder('React\Stream\ReadableStreamInterface')->getMock();
}

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

protected function expectPromiseResolve($promise)
Expand Down