use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Monolog\Processor\WebProcessor;
use Symfony\Bridge\Monolog\Tests\RecordFactory;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
class WebProcessorTest extends TestCase
{ public function testUsesRequestServerData() { [$event,
$server] =
$this->
createRequestEvent();
$processor =
new WebProcessor();
$processor->
onKernelRequest($event);
$record =
$processor($this->
getRecord());
$this->
assertCount(5,
$record['extra'
]);
$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'
]);
}