"Fossies" - the Fresh Open Source Software Archive

Member "seopanel/libs/google-api-php-client/vendor/monolog/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php" (22 Dec 2019, 2656 Bytes) of package /linux/www/seopanel.v.4.3.0.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code 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 
   14 use Monolog\TestCase;
   15 use Monolog\Logger;
   16 use Monolog\Processor\WebProcessor;
   17 
   18 class AbstractProcessingHandlerTest extends TestCase
   19 {
   20     /**
   21      * @covers Monolog\Handler\AbstractProcessingHandler::handle
   22      */
   23     public function testHandleLowerLevelMessage()
   24     {
   25         $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, true));
   26         $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
   27     }
   28 
   29     /**
   30      * @covers Monolog\Handler\AbstractProcessingHandler::handle
   31      */
   32     public function testHandleBubbling()
   33     {
   34         $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, true));
   35         $this->assertFalse($handler->handle($this->getRecord()));
   36     }
   37 
   38     /**
   39      * @covers Monolog\Handler\AbstractProcessingHandler::handle
   40      */
   41     public function testHandleNotBubbling()
   42     {
   43         $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, false));
   44         $this->assertTrue($handler->handle($this->getRecord()));
   45     }
   46 
   47     /**
   48      * @covers Monolog\Handler\AbstractProcessingHandler::handle
   49      */
   50     public function testHandleIsFalseWhenNotHandled()
   51     {
   52         $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, false));
   53         $this->assertTrue($handler->handle($this->getRecord()));
   54         $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
   55     }
   56 
   57     /**
   58      * @covers Monolog\Handler\AbstractProcessingHandler::processRecord
   59      */
   60     public function testProcessRecord()
   61     {
   62         $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler');
   63         $handler->pushProcessor(new WebProcessor(array(
   64             'REQUEST_URI' => '',
   65             'REQUEST_METHOD' => '',
   66             'REMOTE_ADDR' => '',
   67             'SERVER_NAME' => '',
   68             'UNIQUE_ID' => '',
   69         )));
   70         $handledRecord = null;
   71         $handler->expects($this->once())
   72             ->method('write')
   73             ->will($this->returnCallback(function ($record) use (&$handledRecord) {
   74                 $handledRecord = $record;
   75             }))
   76         ;
   77         $handler->handle($this->getRecord());
   78         $this->assertEquals(6, count($handledRecord['extra']));
   79     }
   80 }