Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
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
Yeray Santana Hualde
syncEnrollments
Commits
4e21cfce
Commit
4e21cfce
authored
Sep 02, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing a double slash bug in URL generation with languages. add tests.
parent
cfe5fa10
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
2 deletions
+40
-2
url.test.php
laravel/tests/cases/url.test.php
+24
-0
url.php
laravel/url.php
+7
-2
phpunit.xml
phpunit.xml
+9
-0
No files found.
laravel/tests/cases/url.test.php
View file @
4e21cfce
...
@@ -84,6 +84,8 @@ class URLTest extends PHPUnit_Framework_TestCase {
...
@@ -84,6 +84,8 @@ class URLTest extends PHPUnit_Framework_TestCase {
Request
::
foundation
()
->
server
->
add
(
array
(
'HTTPS'
=>
'on'
));
Request
::
foundation
()
->
server
->
add
(
array
(
'HTTPS'
=>
'on'
));
$this
->
assertEquals
(
'https://localhost/image.jpg'
,
URL
::
to_asset
(
'image.jpg'
));
$this
->
assertEquals
(
'https://localhost/image.jpg'
,
URL
::
to_asset
(
'image.jpg'
));
Request
::
foundation
()
->
server
->
add
(
array
(
'HTTPS'
=>
'off'
));
}
}
/**
/**
...
@@ -103,4 +105,26 @@ class URLTest extends PHPUnit_Framework_TestCase {
...
@@ -103,4 +105,26 @@ class URLTest extends PHPUnit_Framework_TestCase {
$this
->
assertEquals
(
'http://localhost/index.php/url/test/taylor/otwell'
,
URL
::
to_route
(
'url-test-2'
,
array
(
'taylor'
,
'otwell'
)));
$this
->
assertEquals
(
'http://localhost/index.php/url/test/taylor/otwell'
,
URL
::
to_route
(
'url-test-2'
,
array
(
'taylor'
,
'otwell'
)));
}
}
/**
* Test language based URL generation.
*
* @group laravel
*/
public
function
testUrlsGeneratedWithLanguages
()
{
Config
::
set
(
'application.languages'
,
array
(
'sp'
,
'fr'
));
Config
::
set
(
'application.language'
,
'sp'
);
$this
->
assertEquals
(
'http://localhost/index.php/sp/foo'
,
URL
::
to
(
'foo'
));
$this
->
assertEquals
(
'http://localhost/foo.jpg'
,
URL
::
to_asset
(
'foo.jpg'
));
Config
::
set
(
'application.index'
,
''
);
$this
->
assertEquals
(
'http://localhost/sp/foo'
,
URL
::
to
(
'foo'
));
Config
::
set
(
'application.index'
,
'index.php'
);
Config
::
set
(
'application.language'
,
'en'
);
$this
->
assertEquals
(
'http://localhost/index.php/foo'
,
URL
::
to
(
'foo'
));
Config
::
set
(
'application.languages'
,
array
());
}
}
}
\ No newline at end of file
laravel/url.php
View file @
4e21cfce
...
@@ -114,9 +114,14 @@ class URL {
...
@@ -114,9 +114,14 @@ class URL {
$root
.=
'/'
.
Config
::
get
(
'application.index'
);
$root
.=
'/'
.
Config
::
get
(
'application.index'
);
}
}
if
(
!
$asset
and
$locale
and
count
(
Config
::
get
(
'application.languages'
))
>
0
)
$languages
=
Config
::
get
(
'application.languages'
);
if
(
!
$asset
and
$locale
and
count
(
$languages
)
>
0
)
{
if
(
in_array
(
$default
=
Config
::
get
(
'application.language'
),
$languages
))
{
{
$root
.=
'/'
.
Config
::
get
(
'application.language'
);
$root
=
rtrim
(
$root
,
'/'
)
.
'/'
.
$default
;
}
}
}
// Since SSL is not often used while developing the application, we allow the
// Since SSL is not often used while developing the application, we allow the
...
...
phpunit.xml
0 → 100644
View file @
4e21cfce
<phpunit
colors=
"true"
bootstrap=
"/Users/taylor/Code/Laravel/framework/laravel/tests/phpunit.php"
backupGlobals=
"false"
>
<testsuites>
<testsuite
name=
"Test Suite"
>
<directory
suffix=
".test.php"
>
/Users/taylor/Code/Laravel/framework/laravel/tests/cases
</directory>
</testsuite>
</testsuites>
</phpunit>
\ No newline at end of file
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