composer update
This commit is contained in:
parent
9ac51e0523
commit
623395064f
279 changed files with 4458 additions and 16328 deletions
|
@ -327,6 +327,72 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase {
|
|||
|
||||
$cases[] = ['GET', '/user.json', $callback, 'handler1', ['entity' => 'user']];
|
||||
|
||||
// 16 ----
|
||||
|
||||
$callback = function(RouteCollector $r) {
|
||||
$r->addRoute('GET', '', 'handler0');
|
||||
};
|
||||
|
||||
$cases[] = ['GET', '', $callback, 'handler0', []];
|
||||
|
||||
// 17 ----
|
||||
|
||||
$callback = function(RouteCollector $r) {
|
||||
$r->addRoute('HEAD', '/a/{foo}', 'handler0');
|
||||
$r->addRoute('GET', '/b/{foo}', 'handler1');
|
||||
};
|
||||
|
||||
$cases[] = ['HEAD', '/b/bar', $callback, 'handler1', ['foo' => 'bar']];
|
||||
|
||||
// 18 ----
|
||||
|
||||
$callback = function(RouteCollector $r) {
|
||||
$r->addRoute('HEAD', '/a', 'handler0');
|
||||
$r->addRoute('GET', '/b', 'handler1');
|
||||
};
|
||||
|
||||
$cases[] = ['HEAD', '/b', $callback, 'handler1', []];
|
||||
|
||||
// 19 ----
|
||||
|
||||
$callback = function(RouteCollector $r) {
|
||||
$r->addRoute('GET', '/foo', 'handler0');
|
||||
$r->addRoute('HEAD', '/{bar}', 'handler1');
|
||||
};
|
||||
|
||||
$cases[] = ['HEAD', '/foo', $callback, 'handler1', ['bar' => 'foo']];
|
||||
|
||||
// 20 ----
|
||||
|
||||
$callback = function(RouteCollector $r) {
|
||||
$r->addRoute('*', '/user', 'handler0');
|
||||
$r->addRoute('*', '/{user}', 'handler1');
|
||||
$r->addRoute('GET', '/user', 'handler2');
|
||||
};
|
||||
|
||||
$cases[] = ['GET', '/user', $callback, 'handler2', []];
|
||||
|
||||
// 21 ----
|
||||
|
||||
$callback = function(RouteCollector $r) {
|
||||
$r->addRoute('*', '/user', 'handler0');
|
||||
$r->addRoute('GET', '/user', 'handler1');
|
||||
};
|
||||
|
||||
$cases[] = ['POST', '/user', $callback, 'handler0', []];
|
||||
|
||||
// 22 ----
|
||||
|
||||
$cases[] = ['HEAD', '/user', $callback, 'handler1', []];
|
||||
|
||||
// 23 ----
|
||||
|
||||
$callback = function(RouteCollector $r) {
|
||||
$r->addRoute('GET', '/{bar}', 'handler0');
|
||||
$r->addRoute('*', '/foo', 'handler1');
|
||||
};
|
||||
|
||||
$cases[] = ['GET', '/foo', $callback, 'handler0', ['bar' => 'foo']];
|
||||
|
||||
// x -------------------------------------------------------------------------------------->
|
||||
|
||||
|
@ -430,6 +496,7 @@ abstract class DispatcherTest extends \PHPUnit_Framework_TestCase {
|
|||
$r->addRoute('GET', '/resource/123/456', 'handler0');
|
||||
$r->addRoute('POST', '/resource/123/456', 'handler1');
|
||||
$r->addRoute('PUT', '/resource/123/456', 'handler2');
|
||||
$r->addRoute('*', '/', 'handler3');
|
||||
};
|
||||
|
||||
$method = 'DELETE';
|
||||
|
|
39
vendor/nikic/fast-route/test/HackTypechecker/HackTypecheckerTest.php
vendored
Normal file
39
vendor/nikic/fast-route/test/HackTypechecker/HackTypecheckerTest.php
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace FastRoute;
|
||||
|
||||
class HackTypecheckerTest extends \PhpUnit_Framework_TestCase {
|
||||
const SERVER_ALREADY_RUNNING_CODE = 77;
|
||||
public function testTypechecks($recurse = true) {
|
||||
if (!defined('HHVM_VERSION')) {
|
||||
$this->markTestSkipped("HHVM only");
|
||||
}
|
||||
if (!version_compare(HHVM_VERSION, '3.9.0', '>=')) {
|
||||
$this->markTestSkipped('classname<T> requires HHVM 3.9+');
|
||||
}
|
||||
|
||||
// The typechecker recurses the whole tree, so it makes sure
|
||||
// that everything in fixtures/ is valid when this runs.
|
||||
|
||||
$output = array();
|
||||
$exit_code = null;
|
||||
exec(
|
||||
'hh_server --check '.escapeshellarg(__DIR__.'/../../').' 2>&1',
|
||||
$output,
|
||||
$exit_code
|
||||
);
|
||||
if ($exit_code === self::SERVER_ALREADY_RUNNING_CODE) {
|
||||
$this->assertTrue(
|
||||
$recurse,
|
||||
"Typechecker still running after running hh_client stop"
|
||||
);
|
||||
// Server already running - 3.10 => 3.11 regression:
|
||||
// https://github.com/facebook/hhvm/issues/6646
|
||||
exec('hh_client stop 2>/dev/null');
|
||||
$this->testTypechecks(/* recurse = */ false);
|
||||
return;
|
||||
|
||||
}
|
||||
$this->assertSame(0, $exit_code, implode("\n", $output));
|
||||
}
|
||||
}
|
29
vendor/nikic/fast-route/test/HackTypechecker/fixtures/all_options.php
vendored
Normal file
29
vendor/nikic/fast-route/test/HackTypechecker/fixtures/all_options.php
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?hh
|
||||
|
||||
namespace FastRoute\TestFixtures;
|
||||
|
||||
function all_options_simple(): \FastRoute\Dispatcher {
|
||||
return \FastRoute\simpleDispatcher(
|
||||
$collector ==> {},
|
||||
shape(
|
||||
'routeParser' => \FastRoute\RouteParser\Std::class,
|
||||
'dataGenerator' => \FastRoute\DataGenerator\GroupCountBased::class,
|
||||
'dispatcher' => \FastRoute\Dispatcher\GroupCountBased::class,
|
||||
'routeCollector' => \FastRoute\RouteCollector::class,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function all_options_cached(): \FastRoute\Dispatcher {
|
||||
return \FastRoute\cachedDispatcher(
|
||||
$collector ==> {},
|
||||
shape(
|
||||
'routeParser' => \FastRoute\RouteParser\Std::class,
|
||||
'dataGenerator' => \FastRoute\DataGenerator\GroupCountBased::class,
|
||||
'dispatcher' => \FastRoute\Dispatcher\GroupCountBased::class,
|
||||
'routeCollector' => \FastRoute\RouteCollector::class,
|
||||
'cacheFile' => '/dev/null',
|
||||
'cacheDisabled' => false,
|
||||
),
|
||||
);
|
||||
}
|
11
vendor/nikic/fast-route/test/HackTypechecker/fixtures/empty_options.php
vendored
Normal file
11
vendor/nikic/fast-route/test/HackTypechecker/fixtures/empty_options.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?hh
|
||||
|
||||
namespace FastRoute\TestFixtures;
|
||||
|
||||
function empty_options_simple(): \FastRoute\Dispatcher {
|
||||
return \FastRoute\simpleDispatcher($collector ==> {}, shape());
|
||||
}
|
||||
|
||||
function empty_options_cached(): \FastRoute\Dispatcher {
|
||||
return \FastRoute\cachedDispatcher($collector ==> {}, shape());
|
||||
}
|
11
vendor/nikic/fast-route/test/HackTypechecker/fixtures/no_options.php
vendored
Normal file
11
vendor/nikic/fast-route/test/HackTypechecker/fixtures/no_options.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?hh
|
||||
|
||||
namespace FastRoute\TestFixtures;
|
||||
|
||||
function no_options_simple(): \FastRoute\Dispatcher {
|
||||
return \FastRoute\simpleDispatcher($collector ==> {});
|
||||
}
|
||||
|
||||
function no_options_cached(): \FastRoute\Dispatcher {
|
||||
return \FastRoute\cachedDispatcher($collector ==> {});
|
||||
}
|
35
vendor/nikic/fast-route/test/RouteCollectorTest.php
vendored
Normal file
35
vendor/nikic/fast-route/test/RouteCollectorTest.php
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace FastRoute;
|
||||
|
||||
class RouteCollectorTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testShortcuts() {
|
||||
$r = new DummyRouteCollector();
|
||||
|
||||
$r->delete('/delete', 'delete');
|
||||
$r->get('/get', 'get');
|
||||
$r->head('/head', 'head');
|
||||
$r->patch('/patch', 'patch');
|
||||
$r->post('/post', 'post');
|
||||
$r->put('/put', 'put');
|
||||
|
||||
$expected = [
|
||||
['DELETE', '/delete', 'delete'],
|
||||
['GET', '/get', 'get'],
|
||||
['HEAD', '/head', 'head'],
|
||||
['PATCH', '/patch', 'patch'],
|
||||
['POST', '/post', 'post'],
|
||||
['PUT', '/put', 'put'],
|
||||
];
|
||||
|
||||
$this->assertSame($expected, $r->routes);
|
||||
}
|
||||
}
|
||||
|
||||
class DummyRouteCollector extends RouteCollector {
|
||||
public $routes = [];
|
||||
public function __construct() {}
|
||||
public function addRoute($method, $route, $handler) {
|
||||
$this->routes[] = [$method, $route, $handler];
|
||||
}
|
||||
}
|
|
@ -84,6 +84,31 @@ class StdTest extends \PhpUnit_Framework_TestCase {
|
|||
['/test/', ['name', '[^/]+'], '/', ['id', '[0-9]+']],
|
||||
]
|
||||
],
|
||||
[
|
||||
'',
|
||||
[
|
||||
[''],
|
||||
]
|
||||
],
|
||||
[
|
||||
'[test]',
|
||||
[
|
||||
[''],
|
||||
['test'],
|
||||
]
|
||||
],
|
||||
[
|
||||
'/{foo-bar}',
|
||||
[
|
||||
['/', ['foo-bar', '[^/]+']]
|
||||
]
|
||||
],
|
||||
[
|
||||
'/{_foo:.*}',
|
||||
[
|
||||
['/', ['_foo', '.*']]
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -109,6 +134,14 @@ class StdTest extends \PhpUnit_Framework_TestCase {
|
|||
'/test[[opt]]',
|
||||
"Empty optional part"
|
||||
],
|
||||
[
|
||||
'[[test]]',
|
||||
"Empty optional part"
|
||||
],
|
||||
[
|
||||
'/test[/opt]/required',
|
||||
"Optional segments can only occur at the end of a route"
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue