404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@13.59.213.128: ~ $
<?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\Level;
use Monolog\Test\TestCase;
use Monolog\Formatter\LineFormatter;

/**
 * @covers Monolog\Handler\PsrHandler::handle
 */
class PsrHandlerTest extends TestCase
{
    public function logLevelProvider()
    {
        return array_map(
            fn (Level $level) => [$level->toPsrLogLevel(), $level],
            Level::cases()
        );
    }

    /**
     * @dataProvider logLevelProvider
     */
    public function testHandlesAllLevels(string $levelName, Level $level)
    {
        $message = 'Hello, world! ' . $level->value;
        $context = ['foo' => 'bar', 'level' => $level->value];

        $psrLogger = $this->createMock('Psr\Log\NullLogger');
        $psrLogger->expects($this->once())
            ->method('log')
            ->with($levelName, $message, $context);

        $handler = new PsrHandler($psrLogger);
        $handler->handle($this->getRecord($level, $message, context: $context));
    }

    public function testFormatter()
    {
        $message = 'Hello, world!';
        $context = ['foo' => 'bar'];
        $level = Level::Error;

        $psrLogger = $this->createMock('Psr\Log\NullLogger');
        $psrLogger->expects($this->once())
            ->method('log')
            ->with($level->toPsrLogLevel(), 'dummy', $context);

        $handler = new PsrHandler($psrLogger);
        $handler->setFormatter(new LineFormatter('dummy'));
        $handler->handle($this->getRecord($level, $message, context: $context, datetime: new \DateTimeImmutable()));
    }
}

Filemanager

Name Type Size Permission Actions
Fixtures Folder 0755
Slack Folder 0755
AbstractHandlerTest.php File 2.39 KB 0644
AbstractProcessingHandlerTest.php File 4.64 KB 0644
AmqpHandlerTest.php File 4.32 KB 0644
BrowserConsoleHandlerTest.php File 4.88 KB 0644
BufferHandlerTest.php File 5.39 KB 0644
ChromePHPHandlerTest.php File 4.86 KB 0644
CouchDBHandlerTest.php File 805 B 0644
DeduplicationHandlerTest.php File 6.2 KB 0644
DoctrineCouchDBHandlerTest.php File 1.49 KB 0644
DynamoDbHandlerTest.php File 2.89 KB 0644
ElasticaHandlerTest.php File 7.65 KB 0644
ElasticsearchHandlerTest.php File 8 KB 0644
ErrorLogHandlerTest.php File 2.21 KB 0644
ExceptionTestHandler.php File 601 B 0644
FallbackGroupHandlerTest.php File 5.2 KB 0644
FilterHandlerTest.php File 7.43 KB 0644
FingersCrossedHandlerTest.php File 11.05 KB 0644
FirePHPHandlerTest.php File 3.12 KB 0644
FleepHookHandlerTest.php File 1.99 KB 0644
FlowdockHandlerTest.php File 2.82 KB 0644
GelfHandlerTest.php File 3.59 KB 0644
GroupHandlerTest.php File 4.04 KB 0644
HandlerWrapperTest.php File 2.17 KB 0644
InsightOpsHandlerTest.php File 2.65 KB 0644
LogEntriesHandlerTest.php File 2.67 KB 0644
LogmaticHandlerTest.php File 2.94 KB 0644
MailHandlerTest.php File 2.33 KB 0644
MongoDBHandlerTest.php File 2.38 KB 0644
NativeMailerHandlerTest.php File 3.78 KB 0644
NewRelicHandlerTest.php File 6.04 KB 0644
NoopHandlerTest.php File 1.06 KB 0644
NullHandlerTest.php File 1.27 KB 0644
OverflowHandlerTest.php File 3.62 KB 0644
PHPConsoleHandlerTest.php File 10.37 KB 0644
ProcessHandlerTest.php File 6.68 KB 0644
PsrHandlerTest.php File 1.82 KB 0644
PushoverHandlerTest.php File 5.66 KB 0644
RedisHandlerTest.php File 4.27 KB 0644
RedisPubSubHandlerTest.php File 2.18 KB 0644
RollbarHandlerTest.php File 2.52 KB 0644
RotatingFileHandlerTest.php File 12.63 KB 0644
SamplingHandlerTest.php File 908 B 0644
SlackHandlerTest.php File 5.72 KB 0644
SlackWebhookHandlerTest.php File 5 KB 0644
SocketHandlerTest.php File 9.88 KB 0644
StreamHandlerTest.php File 9.79 KB 0644
SymfonyMailerHandlerTest.php File 3.34 KB 0644
SyslogHandlerTest.php File 1.32 KB 0644
SyslogUdpHandlerTest.php File 3.51 KB 0644
TelegramBotHandlerTest.php File 1.83 KB 0644
TestHandlerTest.php File 4.01 KB 0644
UdpSocketTest.php File 1.79 KB 0644
WhatFailureGroupHandlerTest.php File 4.84 KB 0644
ZendMonitorHandlerTest.php File 2.24 KB 0644