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
045b6b7a
Commit
045b6b7a
authored
17 years ago
by
Chris Smith
Browse files
Options
Downloads
Patches
Plain Diff
Test cases for 'phpok' & 'htmlok' config settings
darcs-hash:20080223062428-d26fc-59a5f3a4c230c953db1488a829c814f2901180e4.gz
parent
cbaf4259
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
_test/cases/inc/parser/xhtml_htmlphp.test.php
+127
-0
127 additions, 0 deletions
_test/cases/inc/parser/xhtml_htmlphp.test.php
with
127 additions
and
0 deletions
_test/cases/inc/parser/xhtml_htmlphp.test.php
0 → 100644
+
127
−
0
View file @
045b6b7a
<?php
if
(
!
defined
(
'DOKU_BASE'
))
define
(
'DOKU_BASE'
,
'./'
);
require_once
'parser.inc.php'
;
require_once
DOKU_INC
.
'inc/parser/xhtml.php'
;
class
Doku_Renderer_tester
extends
Doku_Renderer_xhtml
{
// simplify to avoid GeSHi
function
code
(
$text
,
$language
=
NULL
)
{
$this
->
preformatted
(
$text
);
}
}
/*
* test case for parser/xhtml.php _headertolink method
* definition: function _headertolink($title,$create)
*/
class
xhtml_htmlphp_test
extends
TestOfDoku_Parser
{
function
_run_parser
(
$modes
,
$data
)
{
foreach
(
$modes
as
$mode
=>
$name
)
{
$class
=
'Doku_Parser_Mode_'
.
$name
;
$this
->
P
->
addMode
(
$mode
,
new
$class
());
}
$R
=
new
Doku_Renderer_tester
();
$this
->
P
->
parse
(
$data
);
foreach
(
$this
->
H
->
calls
as
$instruction
)
{
// Execute the callback against the Renderer
call_user_func_array
(
array
(
&
$R
,
$instruction
[
0
]),
$instruction
[
1
]);
}
return
str_replace
(
"
\n
"
,
''
,
$R
->
doc
);
}
function
test_html_off
(){
$test
=
array
(
'<html><b>bold</b></html>'
,
'<p><pre class="code"><b>bold</b></pre></p>'
);
global
$conf
;
$conf
[
'htmlok'
]
=
0
;
$result
=
$this
->
_run_parser
(
array
(
'html'
=>
'html'
),
$test
[
0
]);
$this
->
assertEqual
(
$result
,
$test
[
1
]);
}
function
test_html_on
(){
$test
=
array
(
'<html><b>bold</b></html>'
,
'<p><b>bold</b></p>'
);
global
$conf
;
$conf
[
'htmlok'
]
=
1
;
$result
=
$this
->
_run_parser
(
array
(
'html'
=>
'html'
),
$test
[
0
]);
$this
->
assertEqual
(
$result
,
$test
[
1
]);
}
function
test_htmlblock_off
(){
$test
=
array
(
'<HTML><b>bold</b></HTML>'
,
'<pre class="code"><b>bold</b></pre>'
);
global
$conf
;
$conf
[
'htmlok'
]
=
0
;
$result
=
$this
->
_run_parser
(
array
(
'html'
=>
'html'
),
$test
[
0
]);
$this
->
assertEqual
(
$result
,
$test
[
1
]);
}
function
test_htmlblock_on
(){
$test
=
array
(
'<HTML><b>bold</b></HTML>'
,
'<b>bold</b>'
);
global
$conf
;
$conf
[
'htmlok'
]
=
1
;
$result
=
$this
->
_run_parser
(
array
(
'html'
=>
'html'
),
$test
[
0
]);
$this
->
assertEqual
(
$result
,
$test
[
1
]);
}
function
test_php_off
(){
$test
=
array
(
'<php>echo(1+1);</php>'
,
'<p><pre class="code">echo(1+1);</pre></p>'
);
global
$conf
;
$conf
[
'phpok'
]
=
0
;
$result
=
$this
->
_run_parser
(
array
(
'php'
=>
'php'
),
$test
[
0
]);
$this
->
assertEqual
(
$result
,
$test
[
1
]);
}
function
test_php_on
(){
$test
=
array
(
'<php>echo(1+1);</php>'
,
'<p>2</p>'
);
global
$conf
;
$conf
[
'phpok'
]
=
1
;
$result
=
$this
->
_run_parser
(
array
(
'php'
=>
'php'
),
$test
[
0
]);
$this
->
assertEqual
(
$result
,
$test
[
1
]);
}
function
test_phpblock_off
(){
$test
=
array
(
'<PHP>echo(1+1);</PHP>'
,
'<pre class="code">echo(1+1);</pre>'
);
global
$conf
;
$conf
[
'phpok'
]
=
0
;
$result
=
$this
->
_run_parser
(
array
(
'php'
=>
'php'
),
$test
[
0
]);
$this
->
assertEqual
(
$result
,
$test
[
1
]);
}
function
test_phpblock_on
(){
$test
=
array
(
'<PHP>echo(1+1);</PHP>'
,
"2"
);
global
$conf
;
$conf
[
'phpok'
]
=
1
;
$result
=
$this
->
_run_parser
(
array
(
'php'
=>
'php'
),
$test
[
0
]);
$this
->
assertEqual
(
$result
,
$test
[
1
]);
}
}
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