diff options
author | Dominik Eckelmann <deckelmann@gmail.com> | 2011-12-08 20:33:30 +0100 |
---|---|---|
committer | Dominik Eckelmann <deckelmann@gmail.com> | 2011-12-08 20:33:30 +0100 |
commit | 647919c9a61d928502b0b45063cc60702d0d310e (patch) | |
tree | b9fcc26511311af1f1f6aa229f0be6d2eeb7d65d /_test | |
parent | 4815d222f25c9a31949297223c98cfca7151ae8d (diff) | |
download | rpg-647919c9a61d928502b0b45063cc60702d0d310e.tar.gz rpg-647919c9a61d928502b0b45063cc60702d0d310e.tar.bz2 |
added remote plugin calls.
Diffstat (limited to '_test')
-rw-r--r-- | _test/cases/inc/remote.test.php | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php index b33d8039f..f0e7b3d27 100644 --- a/_test/cases/inc/remote.test.php +++ b/_test/cases/inc/remote.test.php @@ -75,13 +75,24 @@ class remote_plugin_testplugin extends DokuWiki_Remote_Plugin { 'method1' => array( 'args' => array(), 'return' => 'void' - ), - 'method2' => array( + ), 'methodString' => array( + 'args' => array(), + 'return' => 'string' + ), 'method2' => array( + 'args' => array('string', 'int'), + 'return' => 'array', + 'name' => 'method2', + ), 'method2ext' => array( 'args' => array('string', 'int', 'bool'), - 'return' => array('string'), + 'return' => 'array', + 'name' => 'method2', ) ); } + + function method1() { return null; } + function methodString() { return 'success'; } + function method2($str, $int, $bool = false) { return array($str, $int, $bool); } } @@ -112,7 +123,11 @@ class remote_test extends UnitTestCase { function test_pluginMethods() { $methods = $this->remote->getPluginMethods(); - $this->assertEqual(array_keys($methods), array('plugin.testplugin.method1', 'plugin.testplugin.method2')); + $actual = array_keys($methods); + sort($actual); + $expect = array('plugin.testplugin.method1', 'plugin.testplugin.method2', 'plugin.testplugin.methodString', 'plugin.testplugin.method2ext'); + sort($expect); + $this->assertEqual($expect,$actual); } function test_hasAccessSuccess() { @@ -176,4 +191,24 @@ class remote_test extends UnitTestCase { $this->assertEqual($remoteApi->call('wiki.twoArgWithDefaultArg', array('string')), array('string', 'default')); $this->assertEqual($remoteApi->call('wiki.twoArgWithDefaultArg', array('string', 'another')), array('string', 'another')); } + + function test_pluginCallMethods() { + global $conf; + $conf['remote'] = 1; + + $remoteApi = new RemoteApi(); + $this->assertEqual($remoteApi->call('plugin.testplugin.method1'), null); + $this->assertEqual($remoteApi->call('plugin.testplugin.method2', array('string', 7)), array('string', 7, false)); + $this->assertEqual($remoteApi->call('plugin.testplugin.method2ext', array('string', 7, true)), array('string', 7, true)); + $this->assertEqual($remoteApi->call('plugin.testplugin.methodString'), 'success'); + } + + function test_notExistingCall() { + global $conf; + $conf['remote'] = 1; + + $remoteApi = new RemoteApi(); + $this->expectException('RemoteException'); + $remoteApi->call('dose not exist'); + } } |