Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parts with multiple parameters #5

Open
mindplay-dk opened this issue Jul 14, 2015 · 1 comment
Open

parts with multiple parameters #5

mindplay-dk opened this issue Jul 14, 2015 · 1 comment

Comments

@mindplay-dk
Copy link

URL parts with multiple parameters is a common scenario, supported by every router I know of - for some reason, it doesn't work with this router.

I wrote the following failing test case:

        $this->specify('should match multiple regexp in params', function () use ($router) {
            $router->get('/archive/{year:^[0-9]+$}-{month:^[0-9]+$}-{day:^[0-9]+$}', 'archive');
            $result = $router->resolve('GET', '/archive/2015-31-01');
            $this->assertEquals('archive', $result['handler']);
            $this->assertEquals('2015', $result['params']['year']);
            $this->assertEquals('31', $result['params']['month']);
            $this->assertEquals('01', $result['params']['day']);
        });

Of course, you can work around this, by further parsing a matched parameter like for example {date:^[0-9]+\-[0-9]+\-[0-9]+$}, but it shouldn't be necessary. I think the assumption that every part is either a fixed string or a single parameter is too limited.

@mindplay-dk
Copy link
Author

Added support for that in my fork here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant