From 9c8f54fefb261746a461982017dee701e7a9db2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Sun, 5 Jul 2015 02:05:52 +0200 Subject: [PATCH] Rename awaitOne() to await() This is done in order to emphasize this is the underlying operation for all other functions operating on promise collections. --- README.md | 4 ++-- src/Blocker.php | 2 +- tests/BlockerTest.php | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 902e118..3e21098 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,9 @@ $blocker = new Blocker($loop); The `wait($seconds)` method can be used to wait/sleep for $time seconds. -#### awaitOne() +#### await() -The `awaitOne(PromiseInterface $promise)` method can be used to block waiting for the given $promise to resolve. +The `await(PromiseInterface $promise)` method can be used to block waiting for the given $promise to resolve. #### awaitRace() diff --git a/src/Blocker.php b/src/Blocker.php index 63f3761..0d3cb01 100644 --- a/src/Blocker.php +++ b/src/Blocker.php @@ -43,7 +43,7 @@ public function wait($time) * @return mixed returns whatever the promise resolves to * @throws Exception when the promise is rejected */ - public function awaitOne(PromiseInterface $promise) + public function await(PromiseInterface $promise) { $wait = true; $resolved = null; diff --git a/tests/BlockerTest.php b/tests/BlockerTest.php index e0629e6..abc127b 100644 --- a/tests/BlockerTest.php +++ b/tests/BlockerTest.php @@ -28,14 +28,14 @@ public function testAwaitOneRejected() $promise = $this->createPromiseRejected(new Exception('test')); $this->setExpectedException('Exception', 'test'); - $this->block->awaitOne($promise); + $this->block->await($promise); } public function testAwaitOneResolved() { $promise = $this->createPromiseResolved(2); - $this->assertEquals(2, $this->block->awaitOne($promise)); + $this->assertEquals(2, $this->block->await($promise)); } public function testAwaitOneInterrupted() @@ -43,7 +43,7 @@ public function testAwaitOneInterrupted() $promise = $this->createPromiseResolved(2, 0.02); $this->createTimerInterrupt(0.01); - $this->assertEquals(2, $this->block->awaitOne($promise)); + $this->assertEquals(2, $this->block->await($promise)); } /**