/**
* Tests retrieving multiple connections by their hostmasks.
*
* @return void
*/
public function testGetConnectionsWithMultipleConnections()
{
$hostmasks = $hostmaskStrings = $connections = array();
$connection = $this->getMockConnection();
foreach (range(1, 2) as $index) {
$hostmasks[$index] = $this->getMockHostmask('nick' . $index, 'username' . $index, 'host' . $index);
$hostmaskStrings[$index] = (string) $hostmasks[$index];
$connections[$index] = clone $connection;
$connections[$index]->expects($this->any())->method('getHostmask')->will($this->returnValue($hostmasks[$index]));
$this->connections->addConnection($connections[$index]);
}
$returned = $this->connections->getConnections($hostmaskStrings);
$this->assertInternalType('array', $returned);
$this->assertEquals(2, count($returned));
foreach ($hostmaskStrings as $index => $hostmaskString) {
$this->assertArrayHasKey($hostmaskString, $returned);
$this->assertSame($connections[$index], $returned[$hostmaskString]);
}
}