Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
Dwoo
Project
Overview
Details
Activity
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Common
Dwoo
Commits
1901789b
Commit
1901789b
authored
Jan 24, 2010
by
seldaek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a couple plugin proxy tests (courtesy of Denis Arh)
git-svn-id:
http://svn.dwoo.org/trunk@331
0598d79b-80c4-4d41-97ba-ac86fbbd088b
parent
b52f9022
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
PluginProxyTests.php
tests/PluginProxyTests.php
+85
-0
No files found.
tests/PluginProxyTests.php
0 → 100644
View file @
1901789b
<?php
require_once
DWOO_DIRECTORY
.
'Dwoo/Compiler.php'
;
class
PluginProxyTests
extends
PHPUnit_Framework_TestCase
{
protected
$compiler
;
protected
$dwoo
;
public
function
setUp
()
{
$this
->
compiler
=
new
Dwoo_Compiler
();
$this
->
dwoo
=
new
Dwoo
(
DWOO_COMPILE_DIR
,
DWOO_CACHE_DIR
);
}
public
function
tearDown
()
{
unset
(
$this
->
compiler
,
$this
->
dwoo
);
}
public
function
testPlainNestedProxyCall
()
{
$this
->
dwoo
->
setPluginProxy
(
new
PluginProxyTest_PluginProxy
);
// test simple assign
$tpl
=
new
Dwoo_Template_String
(
'{F1_Stub(F2_Stub())}'
);
$tpl
->
forceCompilation
();
$this
->
assertContains
(
'PluginProxyTest_F1_Stub(PluginProxyTest_F2_Stub'
,
$this
->
compiler
->
compile
(
$this
->
dwoo
,
$tpl
)
);
}
public
function
testAdvNestedProxyCall
()
{
$this
->
dwoo
->
setPluginProxy
(
new
PluginProxyTest_PluginProxy
);
// test simple assign
$tpl
=
new
Dwoo_Template_String
(
'{assign F1_Stub(F2_Stub(\'/public/css/global.css\'))->something(F3_Stub(\'/public/css/global.css\')) styles}'
);
$tpl
->
forceCompilation
();
$this
->
assertContains
(
'PluginProxyTest_F3_Stub('
,
$this
->
compiler
->
compile
(
$this
->
dwoo
,
$tpl
)
);
}
}
class
PluginProxyTest_PluginProxy
implements
Dwoo_IPluginProxy
{
public
function
handles
(
$name
)
{
return
'F'
==
substr
(
$name
,
0
,
1
);
}
public
function
getCode
(
$name
,
$params
)
{
return
'PluginProxyTest_'
.
$name
.
'('
.
Dwoo_Compiler
::
implode_r
(
$params
)
.
')'
;
}
public
function
getCallback
(
$name
)
{
return
'PluginProxyTest_'
.
$name
;
}
public
function
getLoader
(
$name
)
{
return
''
;
}
}
function
PluginProxyTest_F1_Stub
()
{
return
new
PluginProxyTest_C1_Stub
;
}
function
PluginProxyTest_F2_Stub
(
$in
=
''
)
{
return
$in
.
'#1'
;
}
function
PluginProxyTest_F3_Stub
(
$in
=
''
)
{
return
$in
.
'#1'
;
}
class
PluginProxyTest_C1_Stub
{
function
something
(
$in
)
{
return
$in
.
'#2'
;
}
}
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