xref: /dokuwiki/_test/tests/Remote/Mock/TestPlugin1.php (revision 801ecc14bc74dea1cd6f1c072fc06db8b1c8433b)
1*801ecc14SAndreas Gohr<?php
2*801ecc14SAndreas Gohr
3*801ecc14SAndreas Gohrnamespace dokuwiki\test\Remote\Mock;
4*801ecc14SAndreas Gohr
5*801ecc14SAndreas Gohruse dokuwiki\Extension\RemotePlugin;
6*801ecc14SAndreas Gohruse dokuwiki\Remote\ApiCall;
7*801ecc14SAndreas Gohr
8*801ecc14SAndreas Gohrclass TestPlugin1 extends RemotePlugin
9*801ecc14SAndreas Gohr{
10*801ecc14SAndreas Gohr    function getMethods()
11*801ecc14SAndreas Gohr    {
12*801ecc14SAndreas Gohr        $methods = parent::getMethods(); // auto add all methods, then adjust
13*801ecc14SAndreas Gohr
14*801ecc14SAndreas Gohr        $methods['method2ext'] = new ApiCall([$this, 'method2']); // add a method with a different name
15*801ecc14SAndreas Gohr        $methods['publicCall']->setPublic(); // make this one public
16*801ecc14SAndreas Gohr        return $methods;
17*801ecc14SAndreas Gohr    }
18*801ecc14SAndreas Gohr
19*801ecc14SAndreas Gohr    function method1()
20*801ecc14SAndreas Gohr    {
21*801ecc14SAndreas Gohr        return null;
22*801ecc14SAndreas Gohr    }
23*801ecc14SAndreas Gohr
24*801ecc14SAndreas Gohr    function methodString()
25*801ecc14SAndreas Gohr    {
26*801ecc14SAndreas Gohr        return 'success';
27*801ecc14SAndreas Gohr    }
28*801ecc14SAndreas Gohr
29*801ecc14SAndreas Gohr    function method2($str, $int, $bool = false)
30*801ecc14SAndreas Gohr    {
31*801ecc14SAndreas Gohr        return array($str, $int, $bool);
32*801ecc14SAndreas Gohr    }
33*801ecc14SAndreas Gohr
34*801ecc14SAndreas Gohr    function publicCall()
35*801ecc14SAndreas Gohr    {
36*801ecc14SAndreas Gohr        return true;
37*801ecc14SAndreas Gohr    }
38*801ecc14SAndreas Gohr}
39