/**
* Tests addConnection() with a concrete write stream, where most other
* tests have it mocked out.
*/
public function testAddConnectionWithConcreteWriteStream()
{
$connection = $this->getMockConnectionForAddConnection();
$logger = $this->client->getLogger();
$logger->popHandler();
$stream = fopen('php://memory', 'w+');
$handler = new StreamHandler($stream, Logger::DEBUG);
$handler->setFormatter(new LineFormatter("%message%\r\n"));
$logger->pushHandler($handler);
$this->client->setResolver($this->getMockResolver());
$this->client->addConnection($connection);
$mask = '[email protected]';
$expected = "{$mask} PASS :password\r\n{$mask} USER username hostname servername :realname\r\n{$mask} NICK :nickname\r\n";
fseek($stream, 0);
$actual = stream_get_contents($stream);
$this->assertSame($expected, $actual);
}