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
0cb81d85
Commit
0cb81d85
authored
Oct 11, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added request::uri tests.
parent
f2b9d1e2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
1 deletion
+41
-1
request.php
laravel/request.php
+1
-1
RequestTest.php
tests/Cases/RequestTest.php
+40
-0
No files found.
laravel/request.php
View file @
0cb81d85
...
@@ -14,7 +14,7 @@ class Request {
...
@@ -14,7 +14,7 @@ class Request {
*
*
* @var string
* @var string
*/
*/
p
rotected
static
$uri
;
p
ublic
static
$uri
;
/**
/**
* The request data key that is used to indicate a spoofed request method.
* The request data key that is used to indicate a spoofed request method.
...
...
tests/Cases/RequestTest.php
View file @
0cb81d85
...
@@ -2,10 +2,50 @@
...
@@ -2,10 +2,50 @@
class
RequestTest
extends
PHPUnit_Framework_TestCase
{
class
RequestTest
extends
PHPUnit_Framework_TestCase
{
public
function
setUp
()
{
$_SERVER
=
array
();
Laravel\Request
::
$uri
=
null
;
}
/**
* @expectedException Exception
*/
public
function
test_exception_thrown_if_uri_cant_be_determined
()
{
Laravel\Request
::
uri
();
}
public
function
test_uri_method_returns_path_info_if_set
()
public
function
test_uri_method_returns_path_info_if_set
()
{
{
$_SERVER
[
'PATH_INFO'
]
=
'something'
;
$_SERVER
[
'PATH_INFO'
]
=
'something'
;
$this
->
assertEquals
(
'something'
,
Laravel\Request
::
uri
());
$this
->
assertEquals
(
'something'
,
Laravel\Request
::
uri
());
}
}
/**
* @dataProvider requestUriProvider
*/
public
function
test_correct_uri_is_returned_when_request_uri_is_used
(
$uri
,
$expectation
)
{
$_SERVER
[
'REQUEST_URI'
]
=
$uri
;
$this
->
assertEquals
(
$expectation
,
Laravel\Request
::
uri
());
}
public
function
requestUriProvider
()
{
return
array
(
array
(
'/index.php'
,
'/'
),
array
(
'/index.php/'
,
'/'
),
array
(
'http://localhost/user'
,
'user'
),
array
(
'http://localhost/user/'
,
'user'
),
array
(
'http://localhost/index.php'
,
'/'
),
array
(
'http://localhost/index.php/'
,
'/'
),
array
(
'http://localhost/index.php//'
,
'/'
),
array
(
'http://localhost/index.php/user'
,
'user'
),
array
(
'http://localhost/index.php/user/'
,
'user'
),
array
(
'http://localhost/index.php/user/profile'
,
'user/profile'
),
);
}
}
}
\ 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