From 4e3a7598ef92a3f3e31e74724ae1b7f2be543a7e Mon Sep 17 00:00:00 2001 From: Daniel Lowrey Date: Thu, 6 Mar 2014 21:35:29 -0500 Subject: [PATCH] Test CHANGELOG and composer.json updates --- CHANGELOG.md | 15 +++++++++++++-- composer.json | 2 +- test/LibeventReactorTest.php | 20 ++++---------------- test/PromiseTest.php | 6 ++++-- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3faf5e2..6124363 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,18 @@ -v0.4.0 +v0.5.0 ------ -#### master +- Pare down the Promise/Future APIs +- Minor performance improvements + +> **BC BREAKS**: + +- Removed `Future::isPending()` +- Removed `Future::failed()` +- Removed `Future::onSuccess()` +- Removed `Future::onFailure()` + +v0.4.0 +------ - Altered watcher ID generation to avoid potential collisions - Added optional $onStart callback parameter to Reactor::run() implementations diff --git a/composer.json b/composer.json index 66951f0..ab70bb0 100755 --- a/composer.json +++ b/composer.json @@ -18,6 +18,6 @@ "files": ["src/bootstrap.php"] }, "branch-alias": { - "dev-master": "0.4.x-dev" + "dev-master": "0.5.x-dev" } } diff --git a/test/LibeventReactorTest.php b/test/LibeventReactorTest.php index 040e8c2..37eb703 100755 --- a/test/LibeventReactorTest.php +++ b/test/LibeventReactorTest.php @@ -146,7 +146,7 @@ class LibeventReactorTest extends \PHPUnit_Framework_TestCase { public function testReactorAllowsExceptionToBubbleUpDuringTick() { $this->skipIfMissingExtLibevent(); $reactor = new LibeventReactor; - $reactor->once(function(){ throw new RuntimeException('test'); }, $delay = 0); + $reactor->once(function(){ throw new \RuntimeException('test'); }, $delay = 0); $reactor->tick(); } @@ -157,7 +157,7 @@ class LibeventReactorTest extends \PHPUnit_Framework_TestCase { public function testReactorAllowsExceptionToBubbleUpDuringRun() { $this->skipIfMissingExtLibevent(); $reactor = new LibeventReactor; - $reactor->once(function(){ throw new RuntimeException('test'); }, $delay = 0); + $reactor->once(function(){ throw new \RuntimeException('test'); }, $delay = 0); $reactor->run(); } @@ -168,7 +168,7 @@ class LibeventReactorTest extends \PHPUnit_Framework_TestCase { public function testReactorAllowsExceptionToBubbleUpFromRepeatingAlarmDuringRun() { $this->skipIfMissingExtLibevent(); $reactor = new LibeventReactor; - $reactor->repeat(function(){ throw new RuntimeException('test'); }, $interval = 0); + $reactor->repeat(function(){ throw new \RuntimeException('test'); }, $interval = 0); $reactor->run(); } @@ -249,7 +249,7 @@ class LibeventReactorTest extends \PHPUnit_Framework_TestCase { $this->skipIfMissingExtLibevent(); $reactor = new LibeventReactor; - $reactor->onWritable(STDOUT, function() { throw new RuntimeException; }); + $reactor->onWritable(STDOUT, function() { throw new \RuntimeException; }); $reactor->once(function() use ($reactor) { $reactor->stop(); }, 0.05); $reactor->run(); } @@ -262,16 +262,4 @@ class LibeventReactorTest extends \PHPUnit_Framework_TestCase { $reactor->run(); } - public function testAfterForkReinitializesWatchers() { - $this->skipIfMissingExtLibevent(); - - $reactor = new LibeventReactor(); - - $reactor->onWritable(STDOUT, function() use ($reactor) { $reactor->stop(); }); - $reactor->beforeFork(); - $reactor->afterFork(); - - $reactor->run(); - } - } diff --git a/test/PromiseTest.php b/test/PromiseTest.php index 39278b7..cd29473 100755 --- a/test/PromiseTest.php +++ b/test/PromiseTest.php @@ -25,7 +25,7 @@ class PromiseTest extends \PHPUnit_Framework_TestCase { $reactor = new NativeReactor; $promise = new Promise; $future = $promise->getFuture(); - $future->onSuccess(function(Future $f) use ($reactor) { + $future->onComplete(function(Future $f) use ($reactor) { $this->assertSame(42, $f->getValue()); $reactor->stop(); }); @@ -40,7 +40,8 @@ class PromiseTest extends \PHPUnit_Framework_TestCase { $promise = new Promise; $future = $promise->getFuture(); $error = new \Exception("test"); - $future->onFailure(function(Future $f) use ($reactor, $error) { + $future->onComplete(function(Future $f) use ($reactor, $error) { + $this->assertFalse($f->succeeded()); $this->assertSame($error, $f->getError()); $reactor->stop(); }); @@ -56,6 +57,7 @@ class PromiseTest extends \PHPUnit_Framework_TestCase { $future = $promise->getFuture(); $error = new \Exception("test"); $future->onComplete(function(Future $f) use ($reactor, $error) { + $this->assertFalse($f->succeeded()); $this->assertSame($error, $f->getError()); $reactor->stop(); });