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
2fc5588a
Commit
2fc5588a
authored
11 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Plain Diff
Merge pull request #529 from lisps/TestRequest
fix TestRequest
parents
0931b30c
fe717f57
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
_test/core/TestRequest.php
+8
-1
8 additions, 1 deletion
_test/core/TestRequest.php
_test/tests/test/basic.test.php
+12
-4
12 additions, 4 deletions
_test/tests/test/basic.test.php
with
20 additions
and
5 deletions
_test/core/TestRequest.php
+
8
−
1
View file @
2fc5588a
...
...
@@ -44,13 +44,18 @@ class TestRequest {
* @return TestResponse the resulting output of the request
*/
public
function
execute
(
$uri
=
'/doku.php'
)
{
global
$INPUT
;
global
$ID
;
global
$INFO
;
// save old environment
$server
=
$_SERVER
;
$session
=
$_SESSION
;
$get
=
$_GET
;
$post
=
$_POST
;
$request
=
$_REQUEST
;
$input
=
$INPUT
;
// prepare the right URI
$this
->
setUri
(
$uri
);
...
...
@@ -74,6 +79,7 @@ class TestRequest {
// now execute dokuwiki and grep the output
header_remove
();
ob_start
(
'ob_start_callback'
);
$INPUT
=
new
Input
();
include
(
DOKU_INC
.
$this
->
script
);
ob_end_flush
();
...
...
@@ -89,6 +95,7 @@ class TestRequest {
$_GET
=
$get
;
$_POST
=
$post
;
$_REQUEST
=
$request
;
$INPUT
=
$input
;
return
$response
;
}
...
...
This diff is collapsed.
Click to expand it.
_test/tests/test/basic.test.php
+
12
−
4
View file @
2fc5588a
...
...
@@ -33,7 +33,7 @@ class InttestsBasicTest extends DokuWikiTest {
$response
=
$request
->
execute
();
$this
->
assertTrue
(
strpos
(
$response
->
getContent
(),
'DokuWiki'
)
>=
0
,
strpos
(
$response
->
getContent
(),
'DokuWiki'
)
!==
false
,
'DokuWiki was not a word in the output'
);
}
...
...
@@ -60,7 +60,7 @@ class InttestsBasicTest extends DokuWikiTest {
$this
->
assertEquals
(
'wiki:dokuwiki'
,
$request
->
getPost
(
'id'
));
// output check
$this
->
assertTrue
(
strpos
(
$response
->
getContent
(),
'Andreas Gohr'
)
>=
0
);
$this
->
assertTrue
(
strpos
(
$response
->
getContent
(),
'Andreas Gohr'
)
!==
false
);
}
function
testPostGet
()
{
...
...
@@ -84,7 +84,7 @@ class InttestsBasicTest extends DokuWikiTest {
$this
->
assertEquals
(
'wiki:dokuwiki'
,
$request
->
getGet
(
'id'
));
// output check
$this
->
assertTrue
(
strpos
(
$response
->
getContent
(),
'Andreas Gohr'
)
>=
0
);
$this
->
assertTrue
(
strpos
(
$response
->
getContent
(),
'Andreas Gohr'
)
!==
false
);
}
function
testGet
()
{
...
...
@@ -116,7 +116,7 @@ class InttestsBasicTest extends DokuWikiTest {
$this
->
assertEquals
(
'bar'
,
$request
->
getGet
(
'test'
));
// output check
$this
->
assertTrue
(
strpos
(
$response
->
getContent
(),
'Andreas Gohr'
)
>=
0
);
$this
->
assertTrue
(
strpos
(
$response
->
getContent
(),
'Andreas Gohr'
)
!==
false
);
}
function
testScripts
()
{
...
...
@@ -168,5 +168,13 @@ class InttestsBasicTest extends DokuWikiTest {
$response
=
new
TestResponse
(
''
,
array_slice
(
$this
->
some_headers
,
0
,
-
2
));
// slice off the last two headers to leave no status header
$this
->
assertNull
(
$response
->
getStatusCode
());
}
function
testINPUT
()
{
$request
=
new
TestRequest
();
$response
=
$request
->
get
(
array
(
'id'
=>
'mailinglist'
),
'/doku.php'
);
// output check
$this
->
assertTrue
(
strpos
(
$response
->
getContent
(),
'Netiquette'
)
!==
false
);
}
}
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