ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
UdpSocketTest.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of the Monolog package.
5 *
6 * (c) Jordi Boggiano <j.boggiano@seld.be>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Monolog\Handler;
13
16
21{
23 {
24 $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol'));
25
26 $socket->expects($this->at(0))
27 ->method('send')
28 ->with("HEADER: The quick brown fox jumps over the lazy dog");
29
30 $socket->write("The quick brown fox jumps over the lazy dog", "HEADER: ");
31 }
32
34 {
35 $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol'));
36
37 $truncatedString = str_repeat("derp", 16254).'d';
38
39 $socket->expects($this->exactly(1))
40 ->method('send')
41 ->with("HEADER" . $truncatedString);
42
43 $longString = str_repeat("derp", 20000);
44
45 $socket->write($longString, "HEADER");
46 }
47
49 {
50 $socket = new UdpSocket('127.0.0.1', 514);
51 $socket->close();
52 $socket->close();
53 }
54
58 public function testWriteAfterCloseErrors()
59 {
60 $socket = new UdpSocket('127.0.0.1', 514);
61 $socket->close();
62 $socket->write('foo', "HEADER");
63 }
64}
An exception for terminatinating execution or to throw for unit testing.
@requires extension sockets
testWriteAfterCloseErrors()
@expectedException LogicException