!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/apex_led/php/vendor/monolog/monolog/tests/Monolog/Handler/   drwxrwxr-x
Free 15.56 GB of 61.93 GB (25.13%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     NewRelicHandlerTest.php (5.92 KB)      -rwxrwxr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/*
 * 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\Formatter\LineFormatter;
use 
Monolog\TestCase;
use 
Monolog\Logger;

class 
NewRelicHandlerTest extends TestCase
{
    public static 
$appname;
    public static 
$customParameters;
    public static 
$transactionName;

    public function 
setUp()
    {
        
self::$appname null;
        
self::$customParameters = array();
        
self::$transactionName null;
    }

    
/**
     * @expectedException Monolog\Handler\MissingExtensionException
     */
    
public function testThehandlerThrowsAnExceptionIfTheNRExtensionIsNotLoaded()
    {
        
$handler = new StubNewRelicHandlerWithoutExtension();
        
$handler->handle($this->getRecord(Logger::ERROR));
    }

    public function 
testThehandlerCanHandleTheRecord()
    {
        
$handler = new StubNewRelicHandler();
        
$handler->handle($this->getRecord(Logger::ERROR));
    }

    public function 
testThehandlerCanAddContextParamsToTheNewRelicTrace()
    {
        
$handler = new StubNewRelicHandler();
        
$handler->handle($this->getRecord(Logger::ERROR'log message', array('a' => 'b')));
        
$this->assertEquals(array('context_a' => 'b'), self::$customParameters);
    }

    public function 
testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace()
    {
        
$handler = new StubNewRelicHandler(Logger::ERRORtrueself::$appnametrue);
        
$handler->handle($this->getRecord(
            
Logger::ERROR,
            
'log message',
            array(
'a' => array('key1' => 'value1''key2' => 'value2'))
        ));
        
$this->assertEquals(
            array(
'context_a_key1' => 'value1''context_a_key2' => 'value2'),
            
self::$customParameters
        
);
    }

    public function 
testThehandlerCanAddExtraParamsToTheNewRelicTrace()
    {
        
$record $this->getRecord(Logger::ERROR'log message');
        
$record['extra'] = array('c' => 'd');

        
$handler = new StubNewRelicHandler();
        
$handler->handle($record);

        
$this->assertEquals(array('extra_c' => 'd'), self::$customParameters);
    }

    public function 
testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace()
    {
        
$record $this->getRecord(Logger::ERROR'log message');
        
$record['extra'] = array('c' => array('key1' => 'value1''key2' => 'value2'));

        
$handler = new StubNewRelicHandler(Logger::ERRORtrueself::$appnametrue);
        
$handler->handle($record);

        
$this->assertEquals(
            array(
'extra_c_key1' => 'value1''extra_c_key2' => 'value2'),
            
self::$customParameters
        
);
    }

    public function 
testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace()
    {
        
$record $this->getRecord(Logger::ERROR'log message', array('a' => 'b'));
        
$record['extra'] = array('c' => 'd');

        
$handler = new StubNewRelicHandler();
        
$handler->handle($record);

        
$expected = array(
            
'context_a' => 'b',
            
'extra_c' => 'd',
        );

        
$this->assertEquals($expectedself::$customParameters);
    }

    public function 
testThehandlerCanHandleTheRecordsFormattedUsingTheLineFormatter()
    {
        
$handler = new StubNewRelicHandler();
        
$handler->setFormatter(new LineFormatter());
        
$handler->handle($this->getRecord(Logger::ERROR));
    }

    public function 
testTheAppNameIsNullByDefault()
    {
        
$handler = new StubNewRelicHandler();
        
$handler->handle($this->getRecord(Logger::ERROR'log message'));

        
$this->assertEquals(nullself::$appname);
    }

    public function 
testTheAppNameCanBeInjectedFromtheConstructor()
    {
        
$handler = new StubNewRelicHandler(Logger::DEBUGfalse'myAppName');
        
$handler->handle($this->getRecord(Logger::ERROR'log message'));

        
$this->assertEquals('myAppName'self::$appname);
    }

    public function 
testTheAppNameCanBeOverriddenFromEachLog()
    {
        
$handler = new StubNewRelicHandler(Logger::DEBUGfalse'myAppName');
        
$handler->handle($this->getRecord(Logger::ERROR'log message', array('appname' => 'logAppName')));

        
$this->assertEquals('logAppName'self::$appname);
    }

    public function 
testTheTransactionNameIsNullByDefault()
    {
        
$handler = new StubNewRelicHandler();
        
$handler->handle($this->getRecord(Logger::ERROR'log message'));

        
$this->assertEquals(nullself::$transactionName);
    }

    public function 
testTheTransactionNameCanBeInjectedFromTheConstructor()
    {
        
$handler = new StubNewRelicHandler(Logger::DEBUGfalsenullfalse'myTransaction');
        
$handler->handle($this->getRecord(Logger::ERROR'log message'));

        
$this->assertEquals('myTransaction'self::$transactionName);
    }

    public function 
testTheTransactionNameCanBeOverriddenFromEachLog()
    {
        
$handler = new StubNewRelicHandler(Logger::DEBUGfalsenullfalse'myTransaction');
        
$handler->handle($this->getRecord(Logger::ERROR'log message', array('transaction_name' => 'logTransactName')));

        
$this->assertEquals('logTransactName'self::$transactionName);
    }
}

class 
StubNewRelicHandlerWithoutExtension extends NewRelicHandler
{
    protected function 
isNewRelicEnabled()
    {
        return 
false;
    }
}

class 
StubNewRelicHandler extends NewRelicHandler
{
    protected function 
isNewRelicEnabled()
    {
        return 
true;
    }
}

function 
newrelic_notice_error()
{
    return 
true;
}

function 
newrelic_set_appname($appname)
{
    return 
NewRelicHandlerTest::$appname $appname;
}

function 
newrelic_name_transaction($transactionName)
{
    return 
NewRelicHandlerTest::$transactionName $transactionName;
}

function 
newrelic_add_custom_parameter($key$value)
{
    
NewRelicHandlerTest::$customParameters[$key] = $value;

    return 
true;
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.2801 ]--