Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
b6fffeb0
Commit
b6fffeb0
authored
May 16, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed trailing slash in created URLs.
parent
e6b52b85
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
UrlManagerTest.php
tests/unit/framework/web/UrlManagerTest.php
+4
-4
UrlManager.php
yii/web/UrlManager.php
+1
-1
No files found.
tests/unit/framework/web/UrlManagerTest.php
View file @
b6fffeb0
...
...
@@ -14,9 +14,9 @@ class UrlManagerTest extends \yiiunit\TestCase
'cache'
=>
null
,
));
$url
=
$manager
->
createUrl
(
'post/view'
);
$this
->
assertEquals
(
'
/
?r=post/view'
,
$url
);
$this
->
assertEquals
(
'?r=post/view'
,
$url
);
$url
=
$manager
->
createUrl
(
'post/view'
,
array
(
'id'
=>
1
,
'title'
=>
'sample post'
));
$this
->
assertEquals
(
'
/
?r=post/view&id=1&title=sample+post'
,
$url
);
$this
->
assertEquals
(
'?r=post/view&id=1&title=sample+post'
,
$url
);
// default setting with '/test/' as base url
$manager
=
new
UrlManager
(
array
(
...
...
@@ -24,7 +24,7 @@ class UrlManagerTest extends \yiiunit\TestCase
'cache'
=>
null
,
));
$url
=
$manager
->
createUrl
(
'post/view'
,
array
(
'id'
=>
1
,
'title'
=>
'sample post'
));
$this
->
assertEquals
(
'/test
/
?r=post/view&id=1&title=sample+post'
,
$url
);
$this
->
assertEquals
(
'/test?r=post/view&id=1&title=sample+post'
,
$url
);
// pretty URL without rules
$manager
=
new
UrlManager
(
array
(
...
...
@@ -112,7 +112,7 @@ class UrlManagerTest extends \yiiunit\TestCase
'cache'
=>
null
,
));
$url
=
$manager
->
createAbsoluteUrl
(
'post/view'
,
array
(
'id'
=>
1
,
'title'
=>
'sample post'
));
$this
->
assertEquals
(
'http://www.example.com
/
?r=post/view&id=1&title=sample+post'
,
$url
);
$this
->
assertEquals
(
'http://www.example.com?r=post/view&id=1&title=sample+post'
,
$url
);
}
public
function
testParseRequest
()
...
...
yii/web/UrlManager.php
View file @
b6fffeb0
...
...
@@ -203,7 +203,7 @@ class UrlManager extends Component
}
return
"
$baseUrl
/
{
$route
}{
$anchor
}
"
;
}
else
{
$url
=
"
$baseUrl
/
?
{
$this
->
routeVar
}
=
$route
"
;
$url
=
"
$baseUrl
?
{
$this
->
routeVar
}
=
$route
"
;
if
(
!
empty
(
$params
))
{
$url
.=
'&'
.
http_build_query
(
$params
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment