updated packages
This commit is contained in:
@@ -18,7 +18,7 @@ class StaticPrefixCollectionTest extends TestCase
|
||||
foreach ($routes as $route) {
|
||||
list($path, $name) = $route;
|
||||
$staticPrefix = (new Route($path))->compile()->getStaticPrefix();
|
||||
$collection->addRoute($staticPrefix, array($name));
|
||||
$collection->addRoute($staticPrefix, [$name]);
|
||||
}
|
||||
|
||||
$dumped = $this->dumpCollection($collection);
|
||||
@@ -27,52 +27,52 @@ class StaticPrefixCollectionTest extends TestCase
|
||||
|
||||
public function routeProvider()
|
||||
{
|
||||
return array(
|
||||
'Simple - not nested' => array(
|
||||
array(
|
||||
array('/', 'root'),
|
||||
array('/prefix/segment/', 'prefix_segment'),
|
||||
array('/leading/segment/', 'leading_segment'),
|
||||
),
|
||||
return [
|
||||
'Simple - not nested' => [
|
||||
[
|
||||
['/', 'root'],
|
||||
['/prefix/segment/', 'prefix_segment'],
|
||||
['/leading/segment/', 'leading_segment'],
|
||||
],
|
||||
<<<EOF
|
||||
root
|
||||
prefix_segment
|
||||
leading_segment
|
||||
EOF
|
||||
),
|
||||
'Nested - small group' => array(
|
||||
array(
|
||||
array('/', 'root'),
|
||||
array('/prefix/segment/aa', 'prefix_segment'),
|
||||
array('/prefix/segment/bb', 'leading_segment'),
|
||||
),
|
||||
],
|
||||
'Nested - small group' => [
|
||||
[
|
||||
['/', 'root'],
|
||||
['/prefix/segment/aa', 'prefix_segment'],
|
||||
['/prefix/segment/bb', 'leading_segment'],
|
||||
],
|
||||
<<<EOF
|
||||
root
|
||||
/prefix/segment/
|
||||
-> prefix_segment
|
||||
-> leading_segment
|
||||
EOF
|
||||
),
|
||||
'Nested - contains item at intersection' => array(
|
||||
array(
|
||||
array('/', 'root'),
|
||||
array('/prefix/segment/', 'prefix_segment'),
|
||||
array('/prefix/segment/bb', 'leading_segment'),
|
||||
),
|
||||
],
|
||||
'Nested - contains item at intersection' => [
|
||||
[
|
||||
['/', 'root'],
|
||||
['/prefix/segment/', 'prefix_segment'],
|
||||
['/prefix/segment/bb', 'leading_segment'],
|
||||
],
|
||||
<<<EOF
|
||||
root
|
||||
/prefix/segment/
|
||||
-> prefix_segment
|
||||
-> leading_segment
|
||||
EOF
|
||||
),
|
||||
'Simple one level nesting' => array(
|
||||
array(
|
||||
array('/', 'root'),
|
||||
array('/group/segment/', 'nested_segment'),
|
||||
array('/group/thing/', 'some_segment'),
|
||||
array('/group/other/', 'other_segment'),
|
||||
),
|
||||
],
|
||||
'Simple one level nesting' => [
|
||||
[
|
||||
['/', 'root'],
|
||||
['/group/segment/', 'nested_segment'],
|
||||
['/group/thing/', 'some_segment'],
|
||||
['/group/other/', 'other_segment'],
|
||||
],
|
||||
<<<EOF
|
||||
root
|
||||
/group/
|
||||
@@ -80,17 +80,17 @@ root
|
||||
-> some_segment
|
||||
-> other_segment
|
||||
EOF
|
||||
),
|
||||
'Retain matching order with groups' => array(
|
||||
array(
|
||||
array('/group/aa/', 'aa'),
|
||||
array('/group/bb/', 'bb'),
|
||||
array('/group/cc/', 'cc'),
|
||||
array('/(.*)', 'root'),
|
||||
array('/group/dd/', 'dd'),
|
||||
array('/group/ee/', 'ee'),
|
||||
array('/group/ff/', 'ff'),
|
||||
),
|
||||
],
|
||||
'Retain matching order with groups' => [
|
||||
[
|
||||
['/group/aa/', 'aa'],
|
||||
['/group/bb/', 'bb'],
|
||||
['/group/cc/', 'cc'],
|
||||
['/(.*)', 'root'],
|
||||
['/group/dd/', 'dd'],
|
||||
['/group/ee/', 'ee'],
|
||||
['/group/ff/', 'ff'],
|
||||
],
|
||||
<<<EOF
|
||||
/group/
|
||||
-> aa
|
||||
@@ -102,21 +102,21 @@ root
|
||||
-> ee
|
||||
-> ff
|
||||
EOF
|
||||
),
|
||||
'Retain complex matching order with groups at base' => array(
|
||||
array(
|
||||
array('/aaa/111/', 'first_aaa'),
|
||||
array('/prefixed/group/aa/', 'aa'),
|
||||
array('/prefixed/group/bb/', 'bb'),
|
||||
array('/prefixed/group/cc/', 'cc'),
|
||||
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'),
|
||||
),
|
||||
],
|
||||
'Retain complex matching order with groups at base' => [
|
||||
[
|
||||
['/aaa/111/', 'first_aaa'],
|
||||
['/prefixed/group/aa/', 'aa'],
|
||||
['/prefixed/group/bb/', 'bb'],
|
||||
['/prefixed/group/cc/', 'cc'],
|
||||
['/prefixed/(.*)', 'root'],
|
||||
['/prefixed/group/dd/', 'dd'],
|
||||
['/prefixed/group/ee/', 'ee'],
|
||||
['/prefixed/', 'parent'],
|
||||
['/prefixed/group/ff/', 'ff'],
|
||||
['/aaa/222/', 'second_aaa'],
|
||||
['/aaa/333/', 'third_aaa'],
|
||||
],
|
||||
<<<EOF
|
||||
/aaa/
|
||||
-> first_aaa
|
||||
@@ -134,17 +134,17 @@ EOF
|
||||
-> -> ff
|
||||
-> parent
|
||||
EOF
|
||||
),
|
||||
],
|
||||
|
||||
'Group regardless of segments' => array(
|
||||
array(
|
||||
array('/aaa-111/', 'a1'),
|
||||
array('/aaa-222/', 'a2'),
|
||||
array('/aaa-333/', 'a3'),
|
||||
array('/group-aa/', 'g1'),
|
||||
array('/group-bb/', 'g2'),
|
||||
array('/group-cc/', 'g3'),
|
||||
),
|
||||
'Group regardless of segments' => [
|
||||
[
|
||||
['/aaa-111/', 'a1'],
|
||||
['/aaa-222/', 'a2'],
|
||||
['/aaa-333/', 'a3'],
|
||||
['/group-aa/', 'g1'],
|
||||
['/group-bb/', 'g2'],
|
||||
['/group-cc/', 'g3'],
|
||||
],
|
||||
<<<EOF
|
||||
/aaa-
|
||||
-> a1
|
||||
@@ -155,13 +155,13 @@ EOF
|
||||
-> g2
|
||||
-> g3
|
||||
EOF
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
private function dumpCollection(StaticPrefixCollection $collection, $prefix = '')
|
||||
{
|
||||
$lines = array();
|
||||
$lines = [];
|
||||
|
||||
foreach ($collection->getRoutes() as $item) {
|
||||
if ($item instanceof StaticPrefixCollection) {
|
||||
|
||||
Reference in New Issue
Block a user