Skip to content

Created Unit tests for getRoutesByName with defined idPrefix. #189

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

Merged
merged 4 commits into from Oct 8, 2013

Conversation

ghost
Copy link

@ghost ghost commented Oct 7, 2013

[Doctrine] [Phpcr] [RoutePrivder] Fixed LSmith's early optimizations, and added Unit tests to cover.

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT

Fixed getRoutesByName to work if $idPrefix is not defined.
Added Tests to cover those cases.
@ghost
Copy link
Author

ghost commented Oct 7, 2013

@dbu Here are the tests and the fixes... As Requested.

}
} else {
$routes = $names;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change in getRoutesByNames should not be needed. the loop is only needed if there actually is a prefix. what you propose ends up in a complicated way to copy $names into $routes.

…es the foreach loop.

 Removed the .idea file from .gitignore
 Added Back the missing getRoutesByNames skipped test.
@ghost
Copy link
Author

ghost commented Oct 7, 2013

@dbu Took care of those notes you requested. Have a good night.

@@ -60,7 +60,7 @@ public function setPrefix($prefix)
*/
public function getRouteCollectionForRequest(Request $request)
{
$url = $request->getPathInfo();
$url = $request->getPathInfo();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra whitespace

@ghost
Copy link
Author

ghost commented Oct 7, 2013

@dbu fixed the code style fauxpa.

@lsmith77
Copy link
Member

lsmith77 commented Oct 7, 2013

PHP Parse error:  syntax error, unexpected '}', expecting T_CATCH in /home/travis/build/symfony-cmf/RoutingBundle/Doctrine/Phpcr/RouteProvider.php on line 81

// $name is the route document path
if ($this->idPrefix && 0 === strpos($name, $this->idPrefix)) {
if ( '' === $this->idPrefix || 0 === strpos($name, $this->idPrefix) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces should be removed before and after the condition.

@wouterj
Copy link
Member

wouterj commented Oct 7, 2013

Please add the pr template to your pr description

@ghost
Copy link
Author

ghost commented Oct 7, 2013

@dbu Fixed those notes.

foreach ($names as $name) {
if (0 === strpos($name, $this->idPrefix)) {
if ('' === $this->idPrefix || 0 === strpos($name, $this->idPrefix)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, but you still need to undo the changes here, the existing code was correct.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove the idPrefix check here .. since its redundant

@lsmith77
Copy link
Member

lsmith77 commented Oct 8, 2013

ok merging this .. will fix those last details myself. thank you for your work. just want to get this in quickly due to our upcoming stable release schedule

lsmith77 added a commit that referenced this pull request Oct 8, 2013
Created Unit tests for getRoutesByName with defined idPrefix.
@lsmith77 lsmith77 merged commit b1b3bb6 into symfony-cmf:optimize_get_route_by_name Oct 8, 2013
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

Successfully merging this pull request may close these issues.

4 participants