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
7ac1b2cc
Commit
7ac1b2cc
authored
9 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Patches
Plain Diff
adjusted tests for reflection based method export
parent
67fe7d43
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/tests/inc/remote.test.php
+47
-4
47 additions, 4 deletions
_test/tests/inc/remote.test.php
with
47 additions
and
4 deletions
_test/tests/inc/remote.test.php
+
47
−
4
View file @
7ac1b2cc
...
...
@@ -106,14 +106,32 @@ class remote_plugin_testplugin extends DokuWiki_Remote_Plugin {
function
methodString
()
{
return
'success'
;
}
function
method2
(
$str
,
$int
,
$bool
=
false
)
{
return
array
(
$str
,
$int
,
$bool
);
}
function
publicCall
()
{
return
true
;}
}
class
remote_plugin_testplugin2
extends
DokuWiki_Remote_Plugin
{
/**
* This is a dummy method
*
* @param string $str some more parameter description
* @param int $int
* @param bool $bool
* @param Object $unknown
* @return array
*/
public
function
commented
(
$str
,
$int
,
$bool
,
$unknown
)
{
return
array
(
$str
,
$int
,
$bool
);
}
private
function
privateMethod
()
{
return
true
;}
protected
function
protectedMethod
()
{
return
true
;}
public
function
_underscore
()
{
return
true
;}
}
class
remote_test
extends
DokuWikiTest
{
var
$userinfo
;
/** @var RemoteAPI */
var
$remote
;
function
setUp
()
{
...
...
@@ -125,10 +143,18 @@ class remote_test extends DokuWikiTest {
parent
::
setUp
();
// mock plugin controller to return our test plugins
$pluginManager
=
$this
->
getMock
(
'Doku_Plugin_Controller'
);
$pluginManager
->
expects
(
$this
->
any
())
->
method
(
'getList'
)
->
will
(
$this
->
returnValue
(
array
(
'testplugin'
)));
$pluginManager
->
expects
(
$this
->
any
())
->
method
(
'load'
)
->
will
(
$this
->
returnValue
(
new
remote_plugin_testplugin
()));
$pluginManager
->
method
(
'getList'
)
->
willReturn
(
array
(
'testplugin'
,
'testplugin2'
));
$pluginManager
->
method
(
'load'
)
->
willReturnCallback
(
function
(
$type
,
$plugin
)
{
if
(
$plugin
==
'testplugin2'
)
{
return
new
remote_plugin_testplugin2
();
}
else
{
return
new
remote_plugin_testplugin
();
}
}
);
$plugin_controller
=
$pluginManager
;
$conf
[
'remote'
]
=
1
;
...
...
@@ -151,11 +177,28 @@ class remote_test extends DokuWikiTest {
$methods
=
$this
->
remote
->
getPluginMethods
();
$actual
=
array_keys
(
$methods
);
sort
(
$actual
);
$expect
=
array
(
'plugin.testplugin.method1'
,
'plugin.testplugin.method2'
,
'plugin.testplugin.methodString'
,
'plugin.testplugin.method2ext'
,
'plugin.testplugin.publicCall'
);
$expect
=
array
(
'plugin.testplugin.method1'
,
'plugin.testplugin.method2'
,
'plugin.testplugin.methodString'
,
'plugin.testplugin.method2ext'
,
'plugin.testplugin.publicCall'
,
'plugin.testplugin2.commented'
);
sort
(
$expect
);
$this
->
assertEquals
(
$expect
,
$actual
);
}
function
test_pluginDescriptors
()
{
$methods
=
$this
->
remote
->
getPluginMethods
();
$this
->
assertEquals
(
array
(
'string'
,
'int'
,
'bool'
,
'string'
),
$methods
[
'plugin.testplugin2.commented'
][
'args'
]);
$this
->
assertEquals
(
'array'
,
$methods
[
'plugin.testplugin2.commented'
][
'return'
]);
$this
->
assertEquals
(
0
,
$methods
[
'plugin.testplugin2.commented'
][
'public'
]);
$this
->
assertContains
(
'This is a dummy method'
,
$methods
[
'plugin.testplugin2.commented'
][
'doc'
]);
$this
->
assertContains
(
'string $str some more parameter description'
,
$methods
[
'plugin.testplugin2.commented'
][
'doc'
]);
}
function
test_hasAccessSuccess
()
{
global
$conf
;
$conf
[
'remoteuser'
]
=
''
;
...
...
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