Comments (3)
The error is expected. You've named parameter null
but provided value for test
. How about the following?
$routes = [
Route::get('/view/{test:\w+}')->name('view')->defaults([
'test' => 'test'
]),
];
$routerCollector = $this->createRouterCollector($routes);
$url = $routerCollector->generate('view', ['test' => null]);
$this->assertEquals('/view/test', $url);
from router-fastroute.
How about the following?
sorry, i typed the parameter name incorrectly.
$routes = [
Route::get('/view/{test:\w+}')->name('view')->defaults([
'test' => 'test'
]),
];
$routerCollector = $this->createRouterCollector($routes);
$url = $routerCollector->generate('view', ['test' => null]);
$this->assertEquals('/view/test', $url);
1) Yiisoft\Router\FastRoute\Tests\FastRouteTest::testRouteWithParameterNull
RuntimeException: Route `view` expects at least parameter values for [test], but received [test]
from router-fastroute.
What would happen if you won't specify test
at all?
from router-fastroute.
Related Issues (18)
- Increase test coverage
- Add support `psr/simple-cache` version `3.0.0` HOT 1
- Groups works incorrect HOT 1
- Remove not substituted arguments HOT 1
- Unnecessary question mark HOT 2
- Add support of `psr/http-message` version 2.0
- Remove scrutinizer
- Error while route generating HOT 1
- Support host-matching HOT 1
- generateAbsolute not creating correct URL
- Use incorrect key in params
- Use class instead of array for configuring adapter HOT 1
- Use interface for cache instead of using FS directly HOT 4
- Localization don't work without `CurrentRoute` HOT 2
- Allow URL matcher to match static routes HOT 4
- Increase psalm level to 1
- UrlGenerator::generate and UrlGenerate::generateAbsolute with nested $parameters arguments. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from router-fastroute.