From 27b55a78c81e95d49a3c09445cd7a5b7e5423182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Sat, 8 Jul 2017 16:58:31 +0200 Subject: [PATCH 1/3] Add TOC --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 8b0ad70..fcb1c61 100644 --- a/README.md +++ b/README.md @@ -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 From 8b00112d37d3e1fd6cc7d0c8ddc118a24958f8db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Sat, 8 Jul 2017 17:00:16 +0200 Subject: [PATCH 2/3] Add PHPUnit to require-dev --- .travis.yml | 2 +- README.md | 15 +++++++++++++++ composer.json | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cd41581..5a04437 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,4 +16,4 @@ install: - composer install --prefer-source --no-interaction script: - - phpunit --coverage-text + - vendor/bin/phpunit --coverage-text diff --git a/README.md b/README.md index fcb1c61..c6eb4cd 100644 --- a/README.md +++ b/README.md @@ -327,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 diff --git a/composer.json b/composer.json index dadb43a..af7bfbf 100644 --- a/composer.json +++ b/composer.json @@ -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": "^4.8" }, "autoload": { "psr-4": { "Clue\\React\\Zenity\\": "src/" } From 9720d7e67c1540d1dcec4d30fa51584cb7034107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Sat, 8 Jul 2017 17:03:00 +0200 Subject: [PATCH 3/3] Compatibility with PHPUnit v5 --- composer.json | 2 +- tests/FunctionalLauncherTest.php | 2 +- tests/Zen/BaseZenTest.php | 6 +++--- tests/bootstrap.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index af7bfbf..08b0984 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ }, "require-dev": { "clue/block-react": "^1.1", - "phpunit/phpunit": "^4.8" + "phpunit/phpunit": "^5.0 || ^4.8" }, "autoload": { "psr-4": { "Clue\\React\\Zenity\\": "src/" } diff --git a/tests/FunctionalLauncherTest.php b/tests/FunctionalLauncherTest.php index 614de24..e7f2dad 100644 --- a/tests/FunctionalLauncherTest.php +++ b/tests/FunctionalLauncherTest.php @@ -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); diff --git a/tests/Zen/BaseZenTest.php b/tests/Zen/BaseZenTest.php index 596d281..3d3aa8c 100644 --- a/tests/Zen/BaseZenTest.php +++ b/tests/Zen/BaseZenTest.php @@ -13,7 +13,7 @@ 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; })); @@ -21,8 +21,8 @@ public function setUp() $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() diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 8117eec..af1aac8 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -42,7 +42,7 @@ protected function expectCallableNever() */ protected function createCallableMock() { - return $this->getMock('CallableStub'); + return $this->getMockBuilder('CallableStub')->getMock(); } protected function expectPromiseResolve($promise)