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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"require": {
"php": ">=5.3",
"react/event-loop": "~0.4.0|~0.3.0",
"react/event-loop": "^0.4 || ^0.3.5",
"react/promise": "~2.1|~1.2"
}
}
16 changes: 16 additions & 0 deletions tests/FunctionRejectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ public function testPromiseIsPendingWithoutRunningLoop()
$this->expectPromisePending($promise);
}

public function testPromiseExpiredIsPendingWithoutRunningLoop()
{
$promise = Timer\reject(-1, $this->loop);

$this->expectPromisePending($promise);
}

public function testPromiseWillBeRejectedOnTimeout()
{
$promise = Timer\reject(0.01, $this->loop);
Expand All @@ -22,6 +29,15 @@ public function testPromiseWillBeRejectedOnTimeout()
$this->expectPromiseRejected($promise);
}

public function testPromiseExpiredWillBeRejectedOnTimeout()
{
$promise = Timer\reject(-1, $this->loop);

$this->loop->run();

$this->expectPromiseRejected($promise);
}

public function testCancelingPromiseWillRejectTimer()
{
$promise = Timer\reject(0.01, $this->loop);
Expand Down
16 changes: 16 additions & 0 deletions tests/FunctionResolveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ public function testPromiseIsPendingWithoutRunningLoop()
$this->expectPromisePending($promise);
}

public function testPromiseExpiredIsPendingWithoutRunningLoop()
{
$promise = Timer\resolve(-1, $this->loop);

$this->expectPromisePending($promise);
}

public function testPromiseWillBeResolvedOnTimeout()
{
$promise = Timer\resolve(0.01, $this->loop);
Expand All @@ -22,6 +29,15 @@ public function testPromiseWillBeResolvedOnTimeout()
$this->expectPromiseResolved($promise);
}

public function testPromiseExpiredWillBeResolvedOnTimeout()
{
$promise = Timer\resolve(-1, $this->loop);

$this->loop->run();

$this->expectPromiseResolved($promise);
}

public function testWillStartLoopTimer()
{
$loop = $this->getMock('React\EventLoop\LoopInterface');
Expand Down
9 changes: 9 additions & 0 deletions tests/FunctionTimeoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ public function testResolvedWillResolveRightAway()
$this->expectPromiseResolved($promise);
}

public function testResolvedExpiredWillResolveRightAway()
{
$promise = Promise\resolve();

$promise = Timer\timeout($promise, -1, $this->loop);

$this->expectPromiseResolved($promise);
}

public function testResolvedWillNotStartTimer()
{
$promise = Promise\resolve();
Expand Down