Laravel 5.6 updates

Travis config update

Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
Manish Verma
2018-08-06 20:08:55 +05:30
parent 126fbb0255
commit 1ac0f42a58
2464 changed files with 65239 additions and 46734 deletions

View File

@@ -1,34 +0,0 @@
<?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\Routing\Tests\Matcher\Dumper;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Routing\Matcher\Dumper\DumperCollection;
class DumperCollectionTest extends TestCase
{
public function testGetRoot()
{
$a = new DumperCollection();
$b = new DumperCollection();
$a->add($b);
$c = new DumperCollection();
$b->add($c);
$d = new DumperCollection();
$c->add($d);
$this->assertSame($a, $c->getRoot());
}
}

View File

@@ -46,24 +46,6 @@ class PhpMatcherDumperTest extends TestCase
@unlink($this->dumpPath);
}
/**
* @expectedException \LogicException
*/
public function testDumpWhenSchemeIsUsedWithoutAProperDumper()
{
$collection = new RouteCollection();
$collection->add('secure', new Route(
'/secure',
array(),
array(),
array(),
'',
array('https')
));
$dumper = new PhpMatcherDumper($collection);
$dumper->dump();
}
public function testRedirectPreservesUrlEncoding()
{
$collection = new RouteCollection();
@@ -181,7 +163,7 @@ class PhpMatcherDumperTest extends TestCase
// prefixes
$collection1 = new RouteCollection();
$collection1->add('overridden', new Route('/overridden1'));
$collection1->add('foo1', new Route('/{foo}'));
$collection1->add('foo1', (new Route('/{foo}'))->setMethods('PUT'));
$collection1->add('bar1', new Route('/{bar}'));
$collection1->addPrefix('/b\'b');
$collection2 = new RouteCollection();
@@ -399,6 +381,7 @@ class PhpMatcherDumperTest extends TestCase
$groupOptimisedCollection->add('slashed_b', new Route('/slashed/group/b/'));
$groupOptimisedCollection->add('slashed_c', new Route('/slashed/group/c/'));
/* test case 6 & 7 */
$trailingSlashCollection = new RouteCollection();
$trailingSlashCollection->add('simple_trailing_slash_no_methods', new Route('/trailing/simple/no-methods/', array(), array(), array(), '', array(), array()));
$trailingSlashCollection->add('simple_trailing_slash_GET_method', new Route('/trailing/simple/get-method/', array(), array(), array(), '', array(), array('GET')));
@@ -418,6 +401,59 @@ class PhpMatcherDumperTest extends TestCase
$trailingSlashCollection->add('regex_not_trailing_slash_HEAD_method', new Route('/not-trailing/regex/head-method/{param}', array(), array(), array(), '', array(), array('HEAD')));
$trailingSlashCollection->add('regex_not_trailing_slash_POST_method', new Route('/not-trailing/regex/post-method/{param}', array(), array(), array(), '', array(), array('POST')));
/* test case 8 */
$unicodeCollection = new RouteCollection();
$unicodeCollection->add('a', new Route('/{a}', array(), array('a' => 'a'), array('utf8' => false)));
$unicodeCollection->add('b', new Route('/{a}', array(), array('a' => '.'), array('utf8' => true)));
$unicodeCollection->add('c', new Route('/{a}', array(), array('a' => '.'), array('utf8' => false)));
/* test case 9 */
$hostTreeCollection = new RouteCollection();
$hostTreeCollection->add('a', (new Route('/'))->setHost('{d}.e.c.b.a'));
$hostTreeCollection->add('b', (new Route('/'))->setHost('d.c.b.a'));
$hostTreeCollection->add('c', (new Route('/'))->setHost('{e}.e.c.b.a'));
/* test case 10 */
$chunkedCollection = new RouteCollection();
for ($i = 0; $i < 1000; ++$i) {
$h = substr(md5($i), 0, 6);
$chunkedCollection->add('_'.$i, new Route('/'.$h.'/{a}/{b}/{c}/'.$h));
}
/* test case 11 */
$demoCollection = new RouteCollection();
$demoCollection->add('a', new Route('/admin/post/'));
$demoCollection->add('b', new Route('/admin/post/new'));
$demoCollection->add('c', (new Route('/admin/post/{id}'))->setRequirements(array('id' => '\d+')));
$demoCollection->add('d', (new Route('/admin/post/{id}/edit'))->setRequirements(array('id' => '\d+')));
$demoCollection->add('e', (new Route('/admin/post/{id}/delete'))->setRequirements(array('id' => '\d+')));
$demoCollection->add('f', new Route('/blog/'));
$demoCollection->add('g', new Route('/blog/rss.xml'));
$demoCollection->add('h', (new Route('/blog/page/{page}'))->setRequirements(array('id' => '\d+')));
$demoCollection->add('i', (new Route('/blog/posts/{page}'))->setRequirements(array('id' => '\d+')));
$demoCollection->add('j', (new Route('/blog/comments/{id}/new'))->setRequirements(array('id' => '\d+')));
$demoCollection->add('k', new Route('/blog/search'));
$demoCollection->add('l', new Route('/login'));
$demoCollection->add('m', new Route('/logout'));
$demoCollection->addPrefix('/{_locale}');
$demoCollection->add('n', new Route('/{_locale}'));
$demoCollection->addRequirements(array('_locale' => 'en|fr'));
$demoCollection->addDefaults(array('_locale' => 'en'));
/* test case 12 */
$suffixCollection = new RouteCollection();
$suffixCollection->add('r1', new Route('abc{foo}/1'));
$suffixCollection->add('r2', new Route('abc{foo}/2'));
$suffixCollection->add('r10', new Route('abc{foo}/10'));
$suffixCollection->add('r20', new Route('abc{foo}/20'));
$suffixCollection->add('r100', new Route('abc{foo}/100'));
$suffixCollection->add('r200', new Route('abc{foo}/200'));
/* test case 13 */
$hostCollection = new RouteCollection();
$hostCollection->add('r1', (new Route('abc{foo}'))->setHost('{foo}.exampple.com'));
$hostCollection->add('r2', (new Route('abc{foo}'))->setHost('{foo}.exampple.com'));
return array(
array(new RouteCollection(), 'url_matcher0.php', array()),
array($collection, 'url_matcher1.php', array()),
@@ -427,6 +463,12 @@ class PhpMatcherDumperTest extends TestCase
array($groupOptimisedCollection, 'url_matcher5.php', array('base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher')),
array($trailingSlashCollection, 'url_matcher6.php', array()),
array($trailingSlashCollection, 'url_matcher7.php', array('base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher')),
array($unicodeCollection, 'url_matcher8.php', array()),
array($hostTreeCollection, 'url_matcher9.php', array()),
array($chunkedCollection, 'url_matcher10.php', array()),
array($demoCollection, 'url_matcher11.php', array('base_class' => 'Symfony\Component\Routing\Tests\Fixtures\RedirectableUrlMatcher')),
array($suffixCollection, 'url_matcher12.php', array()),
array($hostCollection, 'url_matcher13.php', array()),
);
}
@@ -449,6 +491,18 @@ class PhpMatcherDumperTest extends TestCase
return $this->matcherClass;
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Symfony\Component\Routing\Route cannot contain objects
*/
public function testGenerateDumperMatcherWithObject()
{
$routeCollection = new RouteCollection();
$routeCollection->add('_', new Route('/', array(new \stdClass())));
$dumper = new PhpMatcherDumper($routeCollection);
$dumper->dump();
}
}
abstract class RedirectableUrlMatcherStub extends UrlMatcher implements RedirectableUrlMatcherInterface

View File

@@ -18,10 +18,9 @@ class StaticPrefixCollectionTest extends TestCase
foreach ($routes as $route) {
list($path, $name) = $route;
$staticPrefix = (new Route($path))->compile()->getStaticPrefix();
$collection->addRoute($staticPrefix, $name);
$collection->addRoute($staticPrefix, array($name));
}
$collection->optimizeGroups();
$dumped = $this->dumpCollection($collection);
$this->assertEquals($expected, $dumped);
}
@@ -36,21 +35,22 @@ class StaticPrefixCollectionTest extends TestCase
array('/leading/segment/', 'leading_segment'),
),
<<<EOF
/ root
/prefix/segment prefix_segment
/leading/segment leading_segment
root
prefix_segment
leading_segment
EOF
),
'Not nested - group too small' => array(
'Nested - small group' => array(
array(
array('/', 'root'),
array('/prefix/segment/aa', 'prefix_segment'),
array('/prefix/segment/bb', 'leading_segment'),
),
<<<EOF
/ root
/prefix/segment/aa prefix_segment
/prefix/segment/bb leading_segment
root
/prefix/segment/
-> prefix_segment
-> leading_segment
EOF
),
'Nested - contains item at intersection' => array(
@@ -60,10 +60,10 @@ EOF
array('/prefix/segment/bb', 'leading_segment'),
),
<<<EOF
/ root
/prefix/segment
-> /prefix/segment prefix_segment
-> /prefix/segment/bb leading_segment
root
/prefix/segment/
-> prefix_segment
-> leading_segment
EOF
),
'Simple one level nesting' => array(
@@ -74,11 +74,11 @@ EOF
array('/group/other/', 'other_segment'),
),
<<<EOF
/ root
/group
-> /group/segment nested_segment
-> /group/thing some_segment
-> /group/other other_segment
root
/group/
-> nested_segment
-> some_segment
-> other_segment
EOF
),
'Retain matching order with groups' => array(
@@ -86,21 +86,21 @@ EOF
array('/group/aa/', 'aa'),
array('/group/bb/', 'bb'),
array('/group/cc/', 'cc'),
array('/', 'root'),
array('/(.*)', 'root'),
array('/group/dd/', 'dd'),
array('/group/ee/', 'ee'),
array('/group/ff/', 'ff'),
),
<<<EOF
/group
-> /group/aa aa
-> /group/bb bb
-> /group/cc cc
/ root
/group
-> /group/dd dd
-> /group/ee ee
-> /group/ff ff
/group/
-> aa
-> bb
-> cc
root
/group/
-> dd
-> ee
-> ff
EOF
),
'Retain complex matching order with groups at base' => array(
@@ -109,28 +109,30 @@ EOF
array('/prefixed/group/aa/', 'aa'),
array('/prefixed/group/bb/', 'bb'),
array('/prefixed/group/cc/', 'cc'),
array('/prefixed/', 'root'),
array('/prefixed/(.*)', 'root'),
array('/prefixed/group/dd/', 'dd'),
array('/prefixed/group/ee/', 'ee'),
array('/prefixed/', 'parent'),
array('/prefixed/group/ff/', 'ff'),
array('/aaa/222/', 'second_aaa'),
array('/aaa/333/', 'third_aaa'),
),
<<<EOF
/aaa
-> /aaa/111 first_aaa
-> /aaa/222 second_aaa
-> /aaa/333 third_aaa
/prefixed
-> /prefixed/group
-> -> /prefixed/group/aa aa
-> -> /prefixed/group/bb bb
-> -> /prefixed/group/cc cc
-> /prefixed root
-> /prefixed/group
-> -> /prefixed/group/dd dd
-> -> /prefixed/group/ee ee
-> -> /prefixed/group/ff ff
/aaa/
-> first_aaa
-> second_aaa
-> third_aaa
/prefixed/
-> /prefixed/group/
-> -> aa
-> -> bb
-> -> cc
-> root
-> /prefixed/group/
-> -> dd
-> -> ee
-> -> ff
-> parent
EOF
),
@@ -145,13 +147,13 @@ EOF
),
<<<EOF
/aaa-
-> /aaa-111 a1
-> /aaa-222 a2
-> /aaa-333 a3
-> a1
-> a2
-> a3
/group-
-> /group-aa g1
-> /group-bb g2
-> /group-cc g3
-> g1
-> g2
-> g3
EOF
),
);
@@ -161,7 +163,7 @@ EOF
{
$lines = array();
foreach ($collection->getItems() as $item) {
foreach ($collection->getRoutes() as $item) {
if ($item instanceof StaticPrefixCollection) {
$lines[] = $prefix.$item->getPrefix();
$lines[] = $this->dumpCollection($item, $prefix.'-> ');