Created
August 13, 2012 13:27
-
-
Save pelshoff/3340754 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Listen to the given stream and register incoming log hits | |
* @param resource $stream A stream with log lines | |
*/ | |
public function listenTo($stream) | |
{ | |
$lastFlushTime = time(); | |
$stopConditionCallback = $this->stopConditionCallback; | |
while ($stopConditionCallback($stream)) { | |
$this->receiveLine($stream); | |
$lastFlushTime = $this->flushIfNeeded($lastFlushTime); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah, this is somewhat complicated to test. Here are my thoughts:
Then your test would be making sure that whatever is happening inside receiveLine() is meeting your expectations.