Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #68 from WyriHaximus-labs/alias-timer-interface
Browse files Browse the repository at this point in the history
Alias timer interface for event-loop 0.4 and 0.5 compatibility
  • Loading branch information
svpernova09 authored Jul 27, 2018
2 parents 2ed4602 + da43ed7 commit 7a05fd0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 44 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"phergie/phergie-irc-parser": "~2.0",
"phergie/phergie-irc-generator": "~1.5",
"phergie/phergie-irc-connection": "~2.0",
"react/event-loop": "^1.0 || ^0.5 || ^0.4.0",
"react/event-loop": "^1.0 || ^0.5",
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4",
"react/socket": "^1.0 || ^0.8 || ^0.7",
"react/dns": "~0.4.0",
Expand Down
24 changes: 12 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 1 addition & 15 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use React\Dns\Resolver\Factory;
use React\Dns\Resolver\Resolver;
use React\EventLoop\LoopInterface;
use React\EventLoop\Timer\TimerInterface;
use React\EventLoop\TimerInterface;
use React\Promise\Deferred;
use React\Promise\PromiseInterface;
use React\Stream\DuplexResourceStream;
Expand Down Expand Up @@ -822,20 +822,6 @@ public function cancelTimer(TimerInterface $timer)
$this->getLoop()->cancelTimer($timer);
}

/**
* Checks if a timer created using addTimer() or addPeriodicTimer() is
* active. Proxies to the isTimerActive() implementation of the event loop
* implementation returned by getLoop().
*
* @param \React\EventLoop\Timer\TimerInterface $timer Timer returned by
* addTimer() or addPeriodicTimer()
* @return boolean TRUE if the specified timer is active, FALSE otherwise
*/
public function isTimerActive(TimerInterface $timer)
{
return $this->getLoop()->isTimerActive($timer);
}

/**
* There are certain incoming events that the client processes internally.
* These functions are essential to the client-server relationship: for example,
Expand Down
18 changes: 2 additions & 16 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -821,20 +821,6 @@ public function testCancelTimer()
Phake::verify($loop)->cancelTimer($timer);
}

/**
* Tests isTimerActive().
*/
public function testIsTimerActive()
{
$timer = $this->getMockTimer();
$loop = $this->getMockLoop();
Phake::when($this->client)->getLoop()->thenReturn($loop);

$this->client->isTimerActive($timer);

Phake::verify($loop)->isTimerActive($timer);
}

/**
* Returns a mock logger.
*
Expand All @@ -848,11 +834,11 @@ protected function getMockLogger()
/**
* Returns a mock timer.
*
* @return \React\EventLoop\Timer\TimerInterface
* @return \React\EventLoop\TimerInterface
*/
protected function getMockTimer()
{
return Phake::mock('\React\EventLoop\Timer\TimerInterface');
return Phake::mock('\React\EventLoop\TimerInterface');
}

/**
Expand Down

0 comments on commit 7a05fd0

Please sign in to comment.