Server IP : 66.29.132.122 / Your IP : 18.118.9.196 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/proc/self/root/proc/thread-self/root/proc/self/root/opt/alt/php54/usr/share/pear/test/MonologBridge/Symfony/Bridge/Monolog/Tests/Processor/ |
Upload File : |
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Monolog\Tests\Processor; use Monolog\Logger; use Symfony\Bridge\Monolog\Processor\WebProcessor; use Symfony\Component\HttpFoundation\Request; class WebProcessorTest extends \PHPUnit_Framework_TestCase { public function testUsesRequestServerData() { $server = array( 'REQUEST_URI' => 'A', 'REMOTE_ADDR' => 'B', 'REQUEST_METHOD' => 'C', 'SERVER_NAME' => 'D', 'HTTP_REFERER' => 'E' ); $request = new Request(); $request->server->replace($server); $event = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent') ->disableOriginalConstructor() ->getMock(); $event->expects($this->any()) ->method('isMasterRequest') ->will($this->returnValue(true)); $event->expects($this->any()) ->method('getRequest') ->will($this->returnValue($request)); $processor = new WebProcessor(); $processor->onKernelRequest($event); $record = $processor($this->getRecord()); $this->assertEquals($server['REQUEST_URI'], $record['extra']['url']); $this->assertEquals($server['REMOTE_ADDR'], $record['extra']['ip']); $this->assertEquals($server['REQUEST_METHOD'], $record['extra']['http_method']); $this->assertEquals($server['SERVER_NAME'], $record['extra']['server']); $this->assertEquals($server['HTTP_REFERER'], $record['extra']['referrer']); } /** * @param integer $level * @param string $message * * @return array Record */ protected function getRecord($level = Logger::WARNING, $message = 'test') { return array( 'message' => $message, 'context' => array(), 'level' => $level, 'level_name' => Logger::getLevelName($level), 'channel' => 'test', 'datetime' => new \DateTime(), 'extra' => array(), ); } }