[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/_test/tests/Remote/Mock/ -> ApiCore.php (source)

   1  <?php
   2  
   3  namespace dokuwiki\test\Remote\Mock;
   4  
   5  
   6  use dokuwiki\Remote\ApiCall;
   7  use dokuwiki\Remote\Response\Link;
   8  
   9  class ApiCore
  10  {
  11  
  12      function getMethods()
  13      {
  14          return [
  15              'wiki.stringTestMethod' => new ApiCall([$this, 'stringTestMethod']),
  16              'wiki.intTestMethod' => new ApiCall([$this, 'intTestMethod']),
  17              'wiki.floatTestMethod' => new ApiCall([$this, 'floatTestMethod']),
  18              'wiki.dateTestMethod' => new ApiCall([$this, 'dateTestMethod']),
  19              'wiki.fileTestMethod' => new ApiCall([$this, 'fileTestMethod']),
  20              'wiki.voidTestMethod' => new ApiCall([$this, 'voidTestMethod']),
  21              'wiki.oneStringArgMethod' => new ApiCall([$this, 'oneStringArgMethod']),
  22              'wiki.twoArgMethod' => new ApiCall([$this, 'twoArgMethod']),
  23              'wiki.twoArgWithDefaultArg' => new ApiCall([$this, 'twoArgWithDefaultArg']),
  24              'wiki.publicCall' => (new ApiCall([$this, 'publicCall']))->setPublic(),
  25              'wiki.getStructuredData' => (new ApiCall([$this, 'getStructuredData'])),
  26          ];
  27      }
  28  
  29      function stringTestMethod()
  30      {
  31          return 'success';
  32      }
  33  
  34      function intTestMethod()
  35      {
  36          return 42;
  37      }
  38  
  39      function floatTestMethod()
  40      {
  41          return 3.14159265;
  42      }
  43  
  44      function dateTestMethod()
  45      {
  46          return 2623452346;
  47      }
  48  
  49      function fileTestMethod()
  50      {
  51          return 'file content';
  52      }
  53  
  54      function voidTestMethod()
  55      {
  56          return null;
  57      }
  58  
  59      function oneStringArgMethod($arg)
  60      {
  61          return $arg;
  62      }
  63  
  64      function twoArgMethod($string, $int)
  65      {
  66          return array($string, $int);
  67      }
  68  
  69      function twoArgWithDefaultArg($string1, $string2 = 'default')
  70      {
  71          return array($string1, $string2);
  72      }
  73  
  74      function publicCall()
  75      {
  76          return true;
  77      }
  78  
  79      function getStructuredData()
  80      {
  81          return new Link('internal', 'wiki:dokuwiki', 'https://www.dokuwiki.org/wiki:dokuwiki');
  82      }
  83  }