ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 
15 
19 class UdpSocketTest extends TestCase
20 {
22  {
23  $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol'));
24 
25  $socket->expects($this->at(0))
26  ->method('send')
27  ->with("HEADER: The quick brown fox jumps over the lazy dog");
28 
29  $socket->write("The quick brown fox jumps over the lazy dog", "HEADER: ");
30  }
31 
32  public function testLongMessagesAreTruncated()
33  {
34  $socket = $this->getMock('\Monolog\Handler\SyslogUdp\UdpSocket', array('send'), array('lol', 'lol'));
35 
36  $truncatedString = str_repeat("derp", 16254).'d';
37 
38  $socket->expects($this->exactly(1))
39  ->method('send')
40  ->with("HEADER" . $truncatedString);
41 
42  $longString = str_repeat("derp", 20000);
43 
44  $socket->write($longString, "HEADER");
45  }
46 }