summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_test/cases/inc/remote.test.php8
-rw-r--r--inc/remote.php15
2 files changed, 19 insertions, 4 deletions
diff --git a/_test/cases/inc/remote.test.php b/_test/cases/inc/remote.test.php
index f0e7b3d27..23186344b 100644
--- a/_test/cases/inc/remote.test.php
+++ b/_test/cases/inc/remote.test.php
@@ -60,8 +60,8 @@ class RemoteAPICoreTest {
function stringTestMethod() { return 'success'; }
function intTestMethod() { return 42; }
function floatTestMethod() { return 3.14159265; }
- function dateTestMethod() { return 2623452346; }
- function fileTestMethod() { return 'file content'; }
+ function dateTestMethod() { return new RemoteDate(2623452346); }
+ function fileTestMethod() { return new RemoteFile('file content'); }
function voidTestMethod() { return null; }
function oneStringArgMethod($arg) {return $arg; }
function twoArgMethod($string, $int) { return array($string, $int); }
@@ -164,8 +164,8 @@ class remote_test extends UnitTestCase {
$this->assertEqual($remoteApi->call('wiki.stringTestMethod'), 'success');
$this->assertEqual($remoteApi->call('wiki.intTestMethod'), 42);
$this->assertEqual($remoteApi->call('wiki.floatTestMethod'), 3.14159265);
- $this->assertEqual($remoteApi->call('wiki.dateTestMethod'), 2623452346);
- $this->assertEqual($remoteApi->call('wiki.fileTestMethod'), 'file content');
+ $this->assertEqual($remoteApi->call('wiki.dateTestMethod'), new RemoteDate(2623452346));
+ $this->assertEqual($remoteApi->call('wiki.fileTestMethod'), new RemoteFile('file content'));
$this->assertEqual($remoteApi->call('wiki.voidTestMethod'), null);
}
diff --git a/inc/remote.php b/inc/remote.php
index bc35d525e..7e82b6845 100644
--- a/inc/remote.php
+++ b/inc/remote.php
@@ -5,6 +5,21 @@ if (!defined('DOKU_INC')) die();
class RemoteException extends Exception {}
class RemoteAccessDenied extends RemoteException {}
+abstract class RemoteDataType {
+ private $value;
+
+ function __construct($value) {
+ $this->value = $value;
+ }
+
+ function getValue() {
+ return $this->value;
+ }
+}
+
+class RemoteDate extends RemoteDataType {}
+class RemoteFile extends RemoteDataType {}
+
/**
* This class provides information about remote access to the wiki.
*