Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -11,13 +11,14 @@
namespace Symfony\Component\Routing\Tests\Generator\Dumper;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
class PhpGeneratorDumperTest extends TestCase
{
/**
* @var RouteCollection
@@ -45,8 +46,8 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
$this->routeCollection = new RouteCollection();
$this->generatorDumper = new PhpGeneratorDumper($this->routeCollection);
$this->testTmpFilepath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.php';
$this->largeTestTmpFilepath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.large.php';
$this->testTmpFilepath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.php';
$this->largeTestTmpFilepath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.large.php';
@unlink($this->testTmpFilepath);
@unlink($this->largeTestTmpFilepath);
}
@@ -77,15 +78,15 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
$relativeUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH);
$relativeUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
$this->assertEquals($absoluteUrlWithParameter, 'http://localhost/app.php/testing/bar');
$this->assertEquals($absoluteUrlWithoutParameter, 'http://localhost/app.php/testing2');
$this->assertEquals($relativeUrlWithParameter, '/app.php/testing/bar');
$this->assertEquals($relativeUrlWithoutParameter, '/app.php/testing2');
$this->assertEquals('http://localhost/app.php/testing/bar', $absoluteUrlWithParameter);
$this->assertEquals('http://localhost/app.php/testing2', $absoluteUrlWithoutParameter);
$this->assertEquals('/app.php/testing/bar', $relativeUrlWithParameter);
$this->assertEquals('/app.php/testing2', $relativeUrlWithoutParameter);
}
public function testDumpWithTooManyRoutes()
{
if (defined('HHVM_VERSION_ID')) {
if (\defined('HHVM_VERSION_ID')) {
$this->markTestSkipped('HHVM consumes too much memory on this test.');
}
@@ -108,10 +109,10 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
$relativeUrlWithParameter = $projectUrlGenerator->generate('Test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_PATH);
$relativeUrlWithoutParameter = $projectUrlGenerator->generate('Test2', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
$this->assertEquals($absoluteUrlWithParameter, 'http://localhost/app.php/testing/bar');
$this->assertEquals($absoluteUrlWithoutParameter, 'http://localhost/app.php/testing2');
$this->assertEquals($relativeUrlWithParameter, '/app.php/testing/bar');
$this->assertEquals($relativeUrlWithoutParameter, '/app.php/testing2');
$this->assertEquals('http://localhost/app.php/testing/bar', $absoluteUrlWithParameter);
$this->assertEquals('http://localhost/app.php/testing2', $absoluteUrlWithoutParameter);
$this->assertEquals('/app.php/testing/bar', $relativeUrlWithParameter);
$this->assertEquals('/app.php/testing2', $relativeUrlWithoutParameter);
}
/**
@@ -151,7 +152,7 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
$projectUrlGenerator = new \DefaultRoutesUrlGenerator(new RequestContext());
$url = $projectUrlGenerator->generate('Test', array());
$this->assertEquals($url, '/testing');
$this->assertEquals('/testing', $url);
}
public function testDumpWithSchemeRequirement()
@@ -166,15 +167,15 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase
$absoluteUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_URL);
$relativeUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
$this->assertEquals($absoluteUrl, 'ftp://localhost/app.php/testing');
$this->assertEquals($relativeUrl, 'ftp://localhost/app.php/testing');
$this->assertEquals('ftp://localhost/app.php/testing', $absoluteUrl);
$this->assertEquals('ftp://localhost/app.php/testing', $relativeUrl);
$projectUrlGenerator = new \SchemeUrlGenerator(new RequestContext('/app.php', 'GET', 'localhost', 'https'));
$absoluteUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_URL);
$relativeUrl = $projectUrlGenerator->generate('Test1', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
$this->assertEquals($absoluteUrl, 'https://localhost/app.php/testing');
$this->assertEquals($relativeUrl, '/app.php/testing');
$this->assertEquals('https://localhost/app.php/testing', $absoluteUrl);
$this->assertEquals('/app.php/testing', $relativeUrl);
}
}

View File

@@ -11,13 +11,14 @@
namespace Symfony\Component\Routing\Tests\Generator;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
class UrlGeneratorTest extends TestCase
{
public function testAbsoluteUrlWithPort80()
{
@@ -208,7 +209,7 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
public function testGenerateForRouteWithInvalidOptionalParameterNonStrictWithLogger()
{
$routes = $this->getRoutes('test', new Route('/testing/{foo}', array('foo' => '1'), array('foo' => 'd+')));
$logger = $this->getMock('Psr\Log\LoggerInterface');
$logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
$logger->expects($this->once())
->method('error');
$generator = $this->getGenerator($routes, array(), $logger);
@@ -233,6 +234,15 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
$this->getGenerator($routes)->generate('test', array('foo' => 'bar'), UrlGeneratorInterface::ABSOLUTE_URL);
}
/**
* @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
*/
public function testGenerateForRouteWithInvalidUtf8Parameter()
{
$routes = $this->getRoutes('test', new Route('/testing/{foo}', array(), array('foo' => '\pL+'), array('utf8' => true)));
$this->getGenerator($routes)->generate('test', array('foo' => 'abc123'), UrlGeneratorInterface::ABSOLUTE_URL);
}
/**
* @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
*/
@@ -325,18 +335,18 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
public function testUrlEncoding()
{
$expectedPath = '/app.php/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id'
.'/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id'
.'?query=%40%3A%5B%5D/%28%29%2A%27%22%20%2B%2C%3B-._~%26%24%3C%3E%7C%7B%7D%25%5C%5E%60%21%3Ffoo%3Dbar%23id';
// This tests the encoding of reserved characters that are used for delimiting of URI components (defined in RFC 3986)
// and other special ASCII chars. These chars are tested as static text path, variable path and query param.
$chars = '@:[]/()*\'" +,;-._~&$<>|{}%\\^`!?foo=bar#id';
$routes = $this->getRoutes('test', new Route("/$chars/{varpath}", array(), array('varpath' => '.+')));
$this->assertSame('/app.php/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id'
.'/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id'
.'?query=%40%3A%5B%5D/%28%29%2A%27%22+%2B%2C%3B-._%7E%26%24%3C%3E%7C%7B%7D%25%5C%5E%60%21%3Ffoo%3Dbar%23id',
$this->getGenerator($routes)->generate('test', array(
'varpath' => $chars,
'query' => $chars,
))
);
$this->assertSame($expectedPath, $this->getGenerator($routes)->generate('test', array(
'varpath' => $chars,
'query' => $chars,
)));
}
public function testEncodingOfRelativePathSegments()
@@ -358,7 +368,7 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
// The default requirement for 'x' should not allow the separator '.' in this case because it would otherwise match everything
// and following optional variables like _format could never match.
$this->setExpectedException('Symfony\Component\Routing\Exception\InvalidParameterException');
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\InvalidParameterException');
$generator->generate('test', array('x' => 'do.t', 'y' => '123', 'z' => 'bar', '_format' => 'xml'));
}
@@ -468,6 +478,38 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
$this->assertSame('//EN.FooBar.com/app.php/', $generator->generate('test', array('locale' => 'EN'), UrlGeneratorInterface::NETWORK_PATH));
}
public function testDefaultHostIsUsedWhenContextHostIsEmpty()
{
$routes = $this->getRoutes('test', new Route('/route', array('domain' => 'my.fallback.host'), array('domain' => '.+'), array(), '{domain}', array('http')));
$generator = $this->getGenerator($routes);
$generator->getContext()->setHost('');
$this->assertSame('http://my.fallback.host/app.php/route', $generator->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL));
}
public function testDefaultHostIsUsedWhenContextHostIsEmptyAndSchemeIsNot()
{
$routes = $this->getRoutes('test', new Route('/route', array('domain' => 'my.fallback.host'), array('domain' => '.+'), array(), '{domain}', array('http', 'https')));
$generator = $this->getGenerator($routes);
$generator->getContext()->setHost('');
$generator->getContext()->setScheme('https');
$this->assertSame('https://my.fallback.host/app.php/route', $generator->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL));
}
public function testAbsoluteUrlFallbackToRelativeIfHostIsEmptyAndSchemeIsNot()
{
$routes = $this->getRoutes('test', new Route('/route', array(), array(), array(), '', array('http', 'https')));
$generator = $this->getGenerator($routes);
$generator->getContext()->setHost('');
$generator->getContext()->setScheme('https');
$this->assertSame('/app.php/route', $generator->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL));
}
public function testGenerateNetworkPath()
{
$routes = $this->getRoutes('test', new Route('/{name}', array(), array(), array(), '{locale}.example.com', array('http')));
@@ -634,6 +676,33 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase
);
}
public function testFragmentsCanBeAppendedToUrls()
{
$routes = $this->getRoutes('test', new Route('/testing'));
$url = $this->getGenerator($routes)->generate('test', array('_fragment' => 'frag ment'), UrlGeneratorInterface::ABSOLUTE_PATH);
$this->assertEquals('/app.php/testing#frag%20ment', $url);
$url = $this->getGenerator($routes)->generate('test', array('_fragment' => '0'), UrlGeneratorInterface::ABSOLUTE_PATH);
$this->assertEquals('/app.php/testing#0', $url);
}
public function testFragmentsDoNotEscapeValidCharacters()
{
$routes = $this->getRoutes('test', new Route('/testing'));
$url = $this->getGenerator($routes)->generate('test', array('_fragment' => '?/'), UrlGeneratorInterface::ABSOLUTE_PATH);
$this->assertEquals('/app.php/testing#?/', $url);
}
public function testFragmentsCanBeDefinedAsDefaults()
{
$routes = $this->getRoutes('test', new Route('/testing', array('_fragment' => 'fragment')));
$url = $this->getGenerator($routes)->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_PATH);
$this->assertEquals('/app.php/testing#fragment', $url);
}
protected function getGenerator(RouteCollection $routes, array $parameters = array(), $logger = null)
{
$context = new RequestContext('/app.php');