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 
12 namespace Monolog\Handler;
13 
16 
20 class UdpSocketTest extends TestCase
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 
33  public function testLongMessagesAreTruncated()
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 
48  public function testDoubleCloseDoesNotError()
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 }
testWriteAfterCloseErrors()
LogicException
Create styles array
The data for the language used.