OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
firebase
/
vendor
/
monolog
/
monolog
/
tests
/
Monolog
/
Handler
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
π
..
-
08/12/2024 10:36:02 AM
rwxr-xr-x
π
AbstractHandlerTest.php
2.53 KB
08/12/2024 10:35:59 AM
rw-r--r--
π
AbstractProcessingHandlerTest.php
4.88 KB
08/12/2024 10:35:59 AM
rw-r--r--
π
AmqpHandlerTest.php
4.3 KB
08/12/2024 10:35:59 AM
rw-r--r--
π
BrowserConsoleHandlerTest.php
4.88 KB
08/12/2024 10:35:59 AM
rw-r--r--
π
BufferHandlerTest.php
5.39 KB
08/12/2024 10:35:59 AM
rw-r--r--
π
ChromePHPHandlerTest.php
4.9 KB
08/12/2024 10:35:59 AM
rw-r--r--
π
CouchDBHandlerTest.php
805 bytes
08/12/2024 10:35:59 AM
rw-r--r--
π
DeduplicationHandlerTest.php
6.2 KB
08/12/2024 10:35:59 AM
rw-r--r--
π
DoctrineCouchDBHandlerTest.php
1.49 KB
08/12/2024 10:35:59 AM
rw-r--r--
π
DynamoDbHandlerTest.php
2.31 KB
08/12/2024 10:35:59 AM
rw-r--r--
π
ElasticaHandlerTest.php
7.74 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
ElasticsearchHandlerTest.php
7.78 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
ErrorLogHandlerTest.php
2.22 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
ExceptionTestHandler.php
567 bytes
08/12/2024 10:36:00 AM
rw-r--r--
π
FallbackGroupHandlerTest.php
6.17 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
FilterHandlerTest.php
7.43 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
FingersCrossedHandlerTest.php
11.28 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
FirePHPHandlerTest.php
3.12 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
Fixtures
-
08/12/2024 10:36:32 AM
rwxr-xr-x
π
FleepHookHandlerTest.php
1.99 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
FlowdockHandlerTest.php
2.74 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
GelfHandlerTest.php
3.59 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
GroupHandlerTest.php
4.97 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
HandlerWrapperTest.php
2.12 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
InsightOpsHandlerTest.php
2.58 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
LogEntriesHandlerTest.php
2.6 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
LogmaticHandlerTest.php
2.87 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
MailHandlerTest.php
2.29 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
MongoDBHandlerTest.php
2.27 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
NativeMailerHandlerTest.php
3.78 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
NewRelicHandlerTest.php
6.04 KB
08/12/2024 10:36:00 AM
rw-r--r--
π
NoopHandlerTest.php
1.08 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
NullHandlerTest.php
1.27 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
OverflowHandlerTest.php
3.62 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
PHPConsoleHandlerTest.php
10.37 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
ProcessHandlerTest.php
6.91 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
PsrHandlerTest.php
2.47 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
PushoverHandlerTest.php
5.59 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
RedisHandlerTest.php
4.29 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
RedisPubSubHandlerTest.php
2.18 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
RollbarHandlerTest.php
2.52 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
RotatingFileHandlerTest.php
12.63 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
SamplingHandlerTest.php
909 bytes
08/12/2024 10:36:01 AM
rw-r--r--
π
Slack
-
08/12/2024 10:36:32 AM
rwxr-xr-x
π
SlackHandlerTest.php
5.68 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
SlackWebhookHandlerTest.php
5 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
SocketHandlerTest.php
9.69 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
StreamHandlerTest.php
9.85 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
SymfonyMailerHandlerTest.php
3.34 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
SyslogHandlerTest.php
1.32 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
SyslogUdpHandlerTest.php
3.97 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
TelegramBotHandlerTest.php
1.87 KB
08/12/2024 10:36:01 AM
rw-r--r--
π
TestHandlerTest.php
4.05 KB
08/12/2024 10:36:02 AM
rw-r--r--
π
UdpSocketTest.php
1.79 KB
08/12/2024 10:36:02 AM
rw-r--r--
π
WhatFailureGroupHandlerTest.php
5.8 KB
08/12/2024 10:36:02 AM
rw-r--r--
π
ZendMonitorHandlerTest.php
2.21 KB
08/12/2024 10:36:02 AM
rw-r--r--
Editing: PushoverHandlerTest.php
Close
<?php declare(strict_types=1); /* * This file is part of the Monolog package. * * (c) Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Monolog\Handler; use Monolog\Test\TestCase; use Monolog\Level; use PHPUnit\Framework\MockObject\MockObject; /** * Almost all examples (expected header, titles, messages) taken from * https://www.pushover.net/api * @author Sebastian GΓΆttschkes <sebastian.goettschkes@googlemail.com> * @see https://www.pushover.net/api */ class PushoverHandlerTest extends TestCase { /** @var resource */ private $res; private PushoverHandler&MockObject $handler; public function tearDown(): void { parent::tearDown(); unset($this->res); } public function testWriteHeader() { $this->createHandler(); $this->handler->setHighPriorityLevel(Level::Emergency); // skip priority notifications $this->handler->handle($this->getRecord(Level::Critical, 'test1')); fseek($this->res, 0); $content = fread($this->res, 1024); $this->assertMatchesRegularExpression('/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); return $content; } /** * @depends testWriteHeader */ public function testWriteContent($content) { $this->assertMatchesRegularExpression('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}$/', $content); } public function testWriteWithComplexTitle() { $this->createHandler('myToken', 'myUser', 'Backup finished - SQL1'); $this->handler->handle($this->getRecord(Level::Critical, 'test1')); fseek($this->res, 0); $content = fread($this->res, 1024); $this->assertMatchesRegularExpression('/title=Backup\+finished\+-\+SQL1/', $content); } public function testWriteWithComplexMessage() { $this->createHandler(); $this->handler->setHighPriorityLevel(Level::Emergency); // skip priority notifications $this->handler->handle($this->getRecord(Level::Critical, 'Backup of database "example" finished in 16 minutes.')); fseek($this->res, 0); $content = fread($this->res, 1024); $this->assertMatchesRegularExpression('/message=Backup\+of\+database\+%22example%22\+finished\+in\+16\+minutes\./', $content); } public function testWriteWithTooLongMessage() { $message = str_pad('test', 520, 'a'); $this->createHandler(); $this->handler->setHighPriorityLevel(Level::Emergency); // skip priority notifications $this->handler->handle($this->getRecord(Level::Critical, $message)); fseek($this->res, 0); $content = fread($this->res, 1024); $expectedMessage = substr($message, 0, 505); $this->assertMatchesRegularExpression('/message=' . $expectedMessage . '&title/', $content); } public function testWriteWithHighPriority() { $this->createHandler(); $this->handler->handle($this->getRecord(Level::Critical, 'test1')); fseek($this->res, 0); $content = fread($this->res, 1024); $this->assertMatchesRegularExpression('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=1$/', $content); } public function testWriteWithEmergencyPriority() { $this->createHandler(); $this->handler->handle($this->getRecord(Level::Emergency, 'test1')); fseek($this->res, 0); $content = fread($this->res, 1024); $this->assertMatchesRegularExpression('/token=myToken&user=myUser&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content); } public function testWriteToMultipleUsers() { $this->createHandler('myToken', ['userA', 'userB']); $this->handler->handle($this->getRecord(Level::Emergency, 'test1')); fseek($this->res, 0); $content = fread($this->res, 1024); $this->assertMatchesRegularExpression('/token=myToken&user=userA&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200POST/', $content); $this->assertMatchesRegularExpression('/token=myToken&user=userB&message=test1&title=Monolog×tamp=\d{10}&priority=2&retry=30&expire=25200$/', $content); } private function createHandler($token = 'myToken', $user = 'myUser', $title = 'Monolog') { $constructorArgs = [$token, $user, $title]; $this->res = fopen('php://memory', 'a'); $this->handler = $this->getMockBuilder(PushoverHandler::class) ->setConstructorArgs($constructorArgs) ->onlyMethods(['fsockopen', 'streamSetTimeout', 'closeSocket']) ->getMock(); $reflectionProperty = new \ReflectionProperty('Monolog\Handler\SocketHandler', 'connectionString'); $reflectionProperty->setAccessible(true); $reflectionProperty->setValue($this->handler, 'localhost:1234'); $this->handler->expects($this->any()) ->method('fsockopen') ->willReturn($this->res); $this->handler->expects($this->any()) ->method('streamSetTimeout') ->willReturn(true); $this->handler->expects($this->any()) ->method('closeSocket'); $this->handler->setFormatter($this->getIdentityFormatter()); } }