Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pquery
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
pquery
Commits
ff1290a4
Commit
ff1290a4
authored
Nov 08, 2011
by
Taddes Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commented unit tests for 'template' plugin.
parent
0adf6150
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
test/test_template.php
test/test_template.php
+8
-1
No files found.
test/test_template.php
View file @
ff1290a4
...
@@ -13,8 +13,11 @@ class pQueryTemplateTest extends UnitTestCase {
...
@@ -13,8 +13,11 @@ class pQueryTemplateTest extends UnitTestCase {
}
}
function
setUp
()
{
function
setUp
()
{
// Set root to tests/templates
$this
->
templates_folder
=
PQUERY_ROOT
.
'test/'
.
self
::
TEMPLATES_FOLDER
;
$this
->
templates_folder
=
PQUERY_ROOT
.
'test/'
.
self
::
TEMPLATES_FOLDER
;
__tpl
::
set_root
(
$this
->
templates_folder
,
false
);
__tpl
::
set_root
(
$this
->
templates_folder
,
false
);
// Load the test template
$this
->
file
=
'test.tpl'
;
$this
->
file
=
'test.tpl'
;
$this
->
tpl
=
_tpl
(
$this
->
file
);
$this
->
tpl
=
_tpl
(
$this
->
file
);
}
}
...
@@ -66,11 +69,15 @@ class pQueryTemplateTest extends UnitTestCase {
...
@@ -66,11 +69,15 @@ class pQueryTemplateTest extends UnitTestCase {
}
}
function
test_parse
()
{
function
test_parse
()
{
$expected_content
=
file_get_contents
(
$this
->
templates_folder
.
'expect_parse.txt'
);
// Add some blocks with test variables
$test1
=
$this
->
tpl
->
data
->
add
(
'test1'
,
array
(
'var'
=>
'some-variable'
));
$test1
=
$this
->
tpl
->
data
->
add
(
'test1'
,
array
(
'var'
=>
'some-variable'
));
$this
->
tpl
->
data
->
add
(
'test1'
,
array
(
'var'
=>
'some-other-variable'
));
$this
->
tpl
->
data
->
add
(
'test1'
,
array
(
'var'
=>
'some-other-variable'
));
$test1
->
add
(
'test2'
);
$test1
->
add
(
'test2'
);
$this
->
tpl
->
data
->
add
(
'test3'
);
$this
->
tpl
->
data
->
add
(
'test3'
);
// Expected content is defined in a text file
$expected_content
=
file_get_contents
(
$this
->
templates_folder
.
'expect_parse.txt'
);
$this
->
assertEqual
(
$this
->
tpl
->
parse
(),
$expected_content
,
'parsed templated does not match expected content'
);
$this
->
assertEqual
(
$this
->
tpl
->
parse
(),
$expected_content
,
'parsed templated does not match expected content'
);
}
}
}
}
...
...
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