[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 use dokuwiki\Remote\XmlRpcServer; 4 5 class XmlRpcServerTestWrapper extends XmlRpcServer 6 { 7 public $output; 8 9 public function output($xml) { 10 $this->output = $xml; 11 } 12 } 13 14 class XmlRpcServerTest extends DokuWikiTest 15 { 16 protected $server; 17 18 function setUp () : void 19 { 20 parent::setUp(); 21 global $conf; 22 23 $conf['remote'] = 1; 24 $conf['remoteuser'] = ''; 25 $conf['useacl'] = 0; 26 27 $this->server = new XmlRpcServerTestWrapper(true); 28 } 29 30 31 function testDateFormat() 32 { 33 $pageName = ":wiki:dokuwiki"; 34 $file = wikiFN($pageName); 35 $timestamp = filemtime($file); 36 $ixrModifiedTime = (new DateTime('@' . $timestamp))->format(DateTime::ATOM); 37 $author = '127.0.0.1'; // read from changelog, $info['user'] or $info['ip'] 38 39 $request = <<<EOD 40 <?xml version="1.0"?> 41 <methodCall> 42 <methodName>wiki.getPageInfo</methodName> 43 <param> 44 <value> 45 <string>$pageName</string> 46 </value> 47 </param> 48 </methodCall> 49 EOD; 50 $expected = <<<EOD 51 <methodResponse> 52 <params> 53 <param> 54 <value> 55 <struct> 56 <member><name>name</name><value><string>wiki:dokuwiki</string></value></member> 57 <member><name>lastModified</name><value><dateTime.iso8601>$ixrModifiedTime</dateTime.iso8601></value></member> 58 <member><name>author</name><value><string>$author</string></value></member> 59 <member><name>version</name><value><int>$timestamp</int></value></member> 60 </struct> 61 </value> 62 </param> 63 </params> 64 </methodResponse> 65 EOD; 66 67 $this->server->serve($request); 68 $this->assertXmlStringEqualsXmlString(trim($expected), trim($this->server->output)); 69 } 70 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body