diff options
Diffstat (limited to 'tests/Unit')
| -rw-r--r-- | tests/Unit/PathSegmentTest.php | 6 | ||||
| -rw-r--r-- | tests/Unit/RouterTest.php | 24 |
2 files changed, 15 insertions, 15 deletions
diff --git a/tests/Unit/PathSegmentTest.php b/tests/Unit/PathSegmentTest.php index ffad95f..5c4788f 100644 --- a/tests/Unit/PathSegmentTest.php +++ b/tests/Unit/PathSegmentTest.php @@ -42,7 +42,7 @@ it('gets key for type :dataset', function (PathSegmentType $type, ?string $res) ($t = PathSegmentType::Parameter)->name => [$t, '<parameter>'], ]); -it('gets raw keys lowercase', function() { +it('gets raw keys lowercase', function () { $seg = new PathSegment('TesTiNg'); expect($seg->getType())->toBe(PathSegmentType::Raw); expect($seg->getKey())->toBe('testing'); @@ -178,7 +178,7 @@ it('can build full path') ->expect(fn () => $testChain()->getPath()) ->toBe('/test1/test2/test3'); -it('can build path with parameters', function() { +it('can build path with parameters', function () { $seg = new PathSegment(type: PathSegmentType::Root); $child = $seg->child('test1') ->child('test2', PathSegmentType::Parameter) @@ -191,7 +191,7 @@ it('can build path with parameters', function() { ]))->toBe('/test1/a/b/test4'); }); -it('throws when building path with missing parameters', function() { +it('throws when building path with missing parameters', function () { $seg = new PathSegment(type: PathSegmentType::Root); $child = $seg->child('test1') ->child('test2', PathSegmentType::Parameter) diff --git a/tests/Unit/RouterTest.php b/tests/Unit/RouterTest.php index 497772d..9e9de88 100644 --- a/tests/Unit/RouterTest.php +++ b/tests/Unit/RouterTest.php @@ -70,7 +70,7 @@ it('finds segment one falls back to parameter', function () { ->parameters->{'test2'}->toBe('anything'); }); -it('finds segment case insentive', function() { +it('finds segment case insentive', function () { $router = new Router(); $r = $router->root(); @@ -209,9 +209,9 @@ it('make a route', function () { ->toBeInstanceOf(RouteMatch::class); }); -it('make a route with parameter', function() { +it('make a route with parameter', function () { $router = new Router(); - $router->make(HttpMethod::Get, '/test/{test1}/hello', fn() => null); + $router->make(HttpMethod::Get, '/test/{test1}/hello', fn () => null); expect($router->findSegment('/test/hello')) ->not->toBeNull() @@ -281,32 +281,32 @@ it('overrides existing named routes', function () { ->toBe($route2); }); -it('generates route from name', function() { +it('generates route from name', function () { $router = new Router(); - $router->get('/test', fn() => null)->name('test'); + $router->get('/test', fn () => null)->name('test'); expect($router->route('test'))->toBe('/test'); }); -it('generates route with parameters from name', function() { +it('generates route with parameters from name', function () { $router = new Router(); - $router->get('/test/{test1}/hello', fn() => null)->name('test'); + $router->get('/test/{test1}/hello', fn () => null)->name('test'); expect($router->route('test', [ - 'test1' => 'world' + 'test1' => 'world', ]))->toBe('/test/world/hello'); }); -it('throws when generating route with missing parameter from name', function() { +it('throws when generating route with missing parameter from name', function () { $router = new Router(); - $router->get('/test/{test1}/hello', fn() => null)->name('test'); + $router->get('/test/{test1}/hello', fn () => null)->name('test'); $router->route('test', []); })->throws(MissingParameterException::class); -it('throws when generating route with non string parameter from name', function() { +it('throws when generating route with non string parameter from name', function () { $router = new Router(); - $router->get('/test/{test1}/hello', fn() => null)->name('test'); + $router->get('/test/{test1}/hello', fn () => null)->name('test'); $router->route('test', ['test1' => 123]); })->throws(InvalidArgumentException::class); |
