Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
4d053d04
Commit
4d053d04
authored
12 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Patches
Plain Diff
moved URI setup to execute()
parent
9e777cee
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
_test/core/TestRequest.php
+9
-6
9 additions, 6 deletions
_test/core/TestRequest.php
with
9 additions
and
6 deletions
_test/core/TestRequest.php
+
9
−
6
View file @
4d053d04
...
@@ -36,9 +36,10 @@ class TestRequest {
...
@@ -36,9 +36,10 @@ class TestRequest {
/**
/**
* Executes the request
* Executes the request
*
*
* @param string $url end URL to simulate, needs to start with /doku.php currently
* @return TestResponse the resulting output of the request
* @return TestResponse the resulting output of the request
*/
*/
public
function
execute
()
{
public
function
execute
(
$uri
=
'/doku.php'
)
{
// save old environment
// save old environment
$server
=
$_SERVER
;
$server
=
$_SERVER
;
$session
=
$_SESSION
;
$session
=
$_SESSION
;
...
@@ -46,6 +47,9 @@ class TestRequest {
...
@@ -46,6 +47,9 @@ class TestRequest {
$post
=
$_POST
;
$post
=
$_POST
;
$request
=
$_REQUEST
;
$request
=
$_REQUEST
;
// prepare the right URI
$this
->
setUri
(
$uri
);
// import all defined globals into the function scope
// import all defined globals into the function scope
foreach
(
array_keys
(
$GLOBALS
)
as
$glb
){
foreach
(
array_keys
(
$GLOBALS
)
as
$glb
){
global
$$glb
;
global
$$glb
;
...
@@ -95,8 +99,9 @@ class TestRequest {
...
@@ -95,8 +99,9 @@ class TestRequest {
* with all set GET variables.
* with all set GET variables.
*
*
* @param string $url end URL to simulate, needs to start with /doku.php currently
* @param string $url end URL to simulate, needs to start with /doku.php currently
* @todo make this work with other end points
*/
*/
p
ublic
function
setUri
(
$uri
){
p
rotected
function
setUri
(
$uri
){
if
(
substr
(
$uri
,
0
,
9
)
!=
'/doku.php'
){
if
(
substr
(
$uri
,
0
,
9
)
!=
'/doku.php'
){
throw
new
Exception
(
"only '/doku.php' is supported currently"
);
throw
new
Exception
(
"only '/doku.php' is supported currently"
);
}
}
...
@@ -128,10 +133,9 @@ class TestRequest {
...
@@ -128,10 +133,9 @@ class TestRequest {
* @param return TestResponse
* @param return TestResponse
*/
*/
public
function
post
(
$post
=
array
(),
$uri
=
'/doku.php'
)
{
public
function
post
(
$post
=
array
(),
$uri
=
'/doku.php'
)
{
$this
->
setUri
(
$uri
);
$this
->
post
=
array_merge
(
$this
->
post
,
$post
);
$this
->
post
=
array_merge
(
$this
->
post
,
$post
);
$this
->
setServer
(
'REQUEST_METHOD'
,
'POST'
);
$this
->
setServer
(
'REQUEST_METHOD'
,
'POST'
);
return
$this
->
execute
();
return
$this
->
execute
(
$uri
);
}
}
/**
/**
...
@@ -143,9 +147,8 @@ class TestRequest {
...
@@ -143,9 +147,8 @@ class TestRequest {
*/
*/
public
function
get
(
$get
=
array
(),
$uri
=
'/doku.php'
)
{
public
function
get
(
$get
=
array
(),
$uri
=
'/doku.php'
)
{
$this
->
get
=
array_merge
(
$this
->
get
,
$get
);
$this
->
get
=
array_merge
(
$this
->
get
,
$get
);
$this
->
setUri
(
$uri
);
$this
->
setServer
(
'REQUEST_METHOD'
,
'GET'
);
$this
->
setServer
(
'REQUEST_METHOD'
,
'GET'
);
return
$this
->
execute
();
return
$this
->
execute
(
$uri
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment