1801ecc14SAndreas Gohr<?php 2801ecc14SAndreas Gohr 3801ecc14SAndreas Gohrnamespace dokuwiki\test\Remote\Mock; 4801ecc14SAndreas Gohr 5801ecc14SAndreas Gohr 6801ecc14SAndreas Gohruse dokuwiki\Remote\ApiCall; 7*12b99753SAndreas Gohruse dokuwiki\Remote\Response\Link; 8801ecc14SAndreas Gohr 9801ecc14SAndreas Gohrclass ApiCore 10801ecc14SAndreas Gohr{ 11801ecc14SAndreas Gohr 12801ecc14SAndreas Gohr function getMethods() 13801ecc14SAndreas Gohr { 14801ecc14SAndreas Gohr return [ 15801ecc14SAndreas Gohr 'wiki.stringTestMethod' => new ApiCall([$this, 'stringTestMethod']), 16801ecc14SAndreas Gohr 'wiki.intTestMethod' => new ApiCall([$this, 'intTestMethod']), 17801ecc14SAndreas Gohr 'wiki.floatTestMethod' => new ApiCall([$this, 'floatTestMethod']), 18801ecc14SAndreas Gohr 'wiki.dateTestMethod' => new ApiCall([$this, 'dateTestMethod']), 19801ecc14SAndreas Gohr 'wiki.fileTestMethod' => new ApiCall([$this, 'fileTestMethod']), 20801ecc14SAndreas Gohr 'wiki.voidTestMethod' => new ApiCall([$this, 'voidTestMethod']), 21801ecc14SAndreas Gohr 'wiki.oneStringArgMethod' => new ApiCall([$this, 'oneStringArgMethod']), 22801ecc14SAndreas Gohr 'wiki.twoArgMethod' => new ApiCall([$this, 'twoArgMethod']), 23801ecc14SAndreas Gohr 'wiki.twoArgWithDefaultArg' => new ApiCall([$this, 'twoArgWithDefaultArg']), 24801ecc14SAndreas Gohr 'wiki.publicCall' => (new ApiCall([$this, 'publicCall']))->setPublic(), 25*12b99753SAndreas Gohr 'wiki.getStructuredData' => (new ApiCall([$this, 'getStructuredData'])), 26801ecc14SAndreas Gohr ]; 27801ecc14SAndreas Gohr } 28801ecc14SAndreas Gohr 29801ecc14SAndreas Gohr function stringTestMethod() 30801ecc14SAndreas Gohr { 31801ecc14SAndreas Gohr return 'success'; 32801ecc14SAndreas Gohr } 33801ecc14SAndreas Gohr 34801ecc14SAndreas Gohr function intTestMethod() 35801ecc14SAndreas Gohr { 36801ecc14SAndreas Gohr return 42; 37801ecc14SAndreas Gohr } 38801ecc14SAndreas Gohr 39801ecc14SAndreas Gohr function floatTestMethod() 40801ecc14SAndreas Gohr { 41801ecc14SAndreas Gohr return 3.14159265; 42801ecc14SAndreas Gohr } 43801ecc14SAndreas Gohr 44801ecc14SAndreas Gohr function dateTestMethod() 45801ecc14SAndreas Gohr { 46801ecc14SAndreas Gohr return 2623452346; 47801ecc14SAndreas Gohr } 48801ecc14SAndreas Gohr 49801ecc14SAndreas Gohr function fileTestMethod() 50801ecc14SAndreas Gohr { 51801ecc14SAndreas Gohr return 'file content'; 52801ecc14SAndreas Gohr } 53801ecc14SAndreas Gohr 54801ecc14SAndreas Gohr function voidTestMethod() 55801ecc14SAndreas Gohr { 56801ecc14SAndreas Gohr return null; 57801ecc14SAndreas Gohr } 58801ecc14SAndreas Gohr 59801ecc14SAndreas Gohr function oneStringArgMethod($arg) 60801ecc14SAndreas Gohr { 61801ecc14SAndreas Gohr return $arg; 62801ecc14SAndreas Gohr } 63801ecc14SAndreas Gohr 64801ecc14SAndreas Gohr function twoArgMethod($string, $int) 65801ecc14SAndreas Gohr { 66801ecc14SAndreas Gohr return array($string, $int); 67801ecc14SAndreas Gohr } 68801ecc14SAndreas Gohr 69801ecc14SAndreas Gohr function twoArgWithDefaultArg($string1, $string2 = 'default') 70801ecc14SAndreas Gohr { 71801ecc14SAndreas Gohr return array($string1, $string2); 72801ecc14SAndreas Gohr } 73801ecc14SAndreas Gohr 74801ecc14SAndreas Gohr function publicCall() 75801ecc14SAndreas Gohr { 76801ecc14SAndreas Gohr return true; 77801ecc14SAndreas Gohr } 78801ecc14SAndreas Gohr 79*12b99753SAndreas Gohr function getStructuredData() 80*12b99753SAndreas Gohr { 81*12b99753SAndreas Gohr return new Link('internal', 'wiki:dokuwiki', 'https://www.dokuwiki.org/wiki:dokuwiki'); 82*12b99753SAndreas Gohr } 83801ecc14SAndreas Gohr} 84