Skip to content
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion src/Blocker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions tests/BlockerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ 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()
{
$promise = $this->createPromiseResolved(2, 0.02);
$this->createTimerInterrupt(0.01);

$this->assertEquals(2, $this->block->awaitOne($promise));
$this->assertEquals(2, $this->block->await($promise));
}

/**
Expand Down