/** * A connection with a mock socket, configured to return the given line. * @return Pheanstalk_Connection */ private function _connection($line) { $socket = new MockSocket(); $socket->setReturnValue('getLine', $line); $connection = new \Pheanstalk\Connection(null, null); $connection->setSocket($socket); return $connection; }