34 $content = fread($this->res, 1024);
36 $this->assertRegexp(
'/POST \/1\/messages.json HTTP\/1.1\\r\\nHost: api.pushover.net\\r\\nContent-Type: application\/x-www-form-urlencoded\\r\\nContent-Length: \d{2,4}\\r\\n\\r\\n/', $content);
46 $this->assertRegexp(
'/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}$/', $content);
51 $this->
createHandler(
'myToken',
'myUser',
'Backup finished - SQL1');
54 $content = fread($this->res, 1024);
56 $this->assertRegexp(
'/title=Backup\+finished\+-\+SQL1/', $content);
65 $content = fread($this->res, 1024);
67 $this->assertRegexp(
'/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content);
72 $message = str_pad(
'test', 520,
'a');
77 $content = fread($this->res, 1024);
79 $expectedMessage = substr($message, 0, 505);
81 $this->assertRegexp(
'/message=' . $expectedMessage .
'&title/', $content);
89 $content = fread($this->res, 1024);
91 $this->assertRegexp(
'/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=1$/', $content);
99 $content = fread($this->res, 1024);
101 $this->assertRegexp(
'/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content);
108 fseek($this->res, 0);
109 $content = fread($this->res, 1024);
111 $this->assertRegexp(
'/token=myToken&user=userA&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200POST/', $content);
112 $this->assertRegexp(
'/token=myToken&user=userB&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content);
118 $this->res = fopen(
'php://memory',
'a');
119 $this->handler = $this->getMock(
120 '\Monolog\Handler\PushoverHandler',
121 array(
'fsockopen',
'streamSetTimeout',
'closeSocket'),
125 $reflectionProperty = new \ReflectionProperty(
'\Monolog\Handler\SocketHandler',
'connectionString');
126 $reflectionProperty->setAccessible(
true);
127 $reflectionProperty->setValue($this->handler,
'localhost:1234');
129 $this->handler->expects($this->any())
130 ->method(
'fsockopen')
131 ->will($this->returnValue($this->res));
132 $this->handler->expects($this->any())
133 ->method(
'streamSetTimeout')
134 ->will($this->returnValue(
true));
135 $this->handler->expects($this->any())
136 ->method(
'closeSocket')
137 ->will($this->returnValue(
true));
testWriteToMultipleUsers()
testWriteWithComplexTitle()
getRecord($level=Logger::WARNING, $message='test', $context=array())
testWriteWithTooLongMessage()
createHandler($token='myToken', $user='myUser', $title='Monolog')
testWriteWithEmergencyPriority()
const EMERGENCY
Urgent alert.
Create styles array
The data for the language used.
const CRITICAL
Critical conditions.
testWriteWithComplexMessage()
Almost all examples (expected header, titles, messages) taken from https://www.pushover.net/api.
testWriteContent($content)
testWriteHeader
testWriteWithHighPriority()