Laravel version update
Laravel version update
This commit is contained in:
67
vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php
vendored
Normal file
67
vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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\Component\HttpKernel\Tests\Debug;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
|
||||
|
||||
class FileLinkFormatterTest extends TestCase
|
||||
{
|
||||
public function testWhenNoFileLinkFormatAndNoRequest()
|
||||
{
|
||||
$sut = new FileLinkFormatter();
|
||||
|
||||
$this->assertFalse($sut->format('/kernel/root/src/my/very/best/file.php', 3));
|
||||
}
|
||||
|
||||
public function testWhenFileLinkFormatAndNoRequest()
|
||||
{
|
||||
$file = __DIR__.\DIRECTORY_SEPARATOR.'file.php';
|
||||
|
||||
$sut = new FileLinkFormatter('debug://open?url=file://%f&line=%l', new RequestStack());
|
||||
|
||||
$this->assertSame("debug://open?url=file://$file&line=3", $sut->format($file, 3));
|
||||
}
|
||||
|
||||
public function testWhenFileLinkFormatAndRequest()
|
||||
{
|
||||
$file = __DIR__.\DIRECTORY_SEPARATOR.'file.php';
|
||||
$baseDir = __DIR__;
|
||||
$requestStack = new RequestStack();
|
||||
$request = new Request();
|
||||
$requestStack->push($request);
|
||||
|
||||
$sut = new FileLinkFormatter('debug://open?url=file://%f&line=%l', $requestStack, __DIR__, '/_profiler/open?file=%f&line=%l#line%l');
|
||||
|
||||
$this->assertSame("debug://open?url=file://$file&line=3", $sut->format($file, 3));
|
||||
}
|
||||
|
||||
public function testWhenNoFileLinkFormatAndRequest()
|
||||
{
|
||||
$file = __DIR__.\DIRECTORY_SEPARATOR.'file.php';
|
||||
$requestStack = new RequestStack();
|
||||
$request = new Request();
|
||||
$requestStack->push($request);
|
||||
|
||||
$request->server->set('SERVER_NAME', 'www.example.org');
|
||||
$request->server->set('SERVER_PORT', 80);
|
||||
$request->server->set('SCRIPT_NAME', '/app.php');
|
||||
$request->server->set('SCRIPT_FILENAME', '/web/app.php');
|
||||
$request->server->set('REQUEST_URI', '/app.php/example');
|
||||
|
||||
$sut = new FileLinkFormatter(null, $requestStack, __DIR__, '/_profiler/open?file=%f&line=%l#line%l');
|
||||
|
||||
$this->assertSame('http://www.example.org/app.php/_profiler/open?file=file.php&line=3#line3', $sut->format($file, 3));
|
||||
}
|
||||
}
|
||||
@@ -11,14 +11,16 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Tests\Debug;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher;
|
||||
use Symfony\Component\HttpKernel\HttpKernel;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
|
||||
class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
class TraceableEventDispatcherTest extends TestCase
|
||||
{
|
||||
public function testStopwatchSections()
|
||||
{
|
||||
@@ -33,6 +35,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
'__section__',
|
||||
'kernel.request',
|
||||
'kernel.controller',
|
||||
'kernel.controller_arguments',
|
||||
'controller',
|
||||
'kernel.response',
|
||||
'kernel.terminate',
|
||||
@@ -108,10 +111,11 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function getHttpKernel($dispatcher, $controller)
|
||||
{
|
||||
$resolver = $this->getMock('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface');
|
||||
$resolver->expects($this->once())->method('getController')->will($this->returnValue($controller));
|
||||
$resolver->expects($this->once())->method('getArguments')->will($this->returnValue(array()));
|
||||
$controllerResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface')->getMock();
|
||||
$controllerResolver->expects($this->once())->method('getController')->will($this->returnValue($controller));
|
||||
$argumentResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface')->getMock();
|
||||
$argumentResolver->expects($this->once())->method('getArguments')->will($this->returnValue(array()));
|
||||
|
||||
return new HttpKernel($dispatcher, $resolver);
|
||||
return new HttpKernel($dispatcher, $controllerResolver, new RequestStack(), $argumentResolver);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user