From 7e95efec8b4f68915af17cc5840132b9c94703dc Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sun, 1 Jan 2017 19:20:52 +0100 Subject: [PATCH] Add testing of delayed writes to the remote API --- _test/tests/inc/remoteapicore.test.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/_test/tests/inc/remoteapicore.test.php b/_test/tests/inc/remoteapicore.test.php index 90ccbec685..c3eda63493 100644 --- a/_test/tests/inc/remoteapicore.test.php +++ b/_test/tests/inc/remoteapicore.test.php @@ -40,6 +40,13 @@ public function tearDown() { $AUTH_ACL = $this->oldAuthAcl; } + /** Delay writes of old revisions by a second. */ + public function handle_write(Doku_Event $event, $param) { + if ($event->data[3] !== false) { + $this->waitForTick(); + } + } + public function test_getVersion() { $this->assertEquals(getVersion(), $this->remote->call('dokuwiki.getVersion')); } @@ -382,6 +389,9 @@ public function test_getRecentChanges() { } public function test_getPageVersions() { + /** @var $EVENT_HANDLER Doku_Event_Handler */ + global $EVENT_HANDLER; + $EVENT_HANDLER->register_hook('IO_WIKIPAGE_WRITE', 'BEFORE', $this, 'handle_write'); global $conf; $id = 'revpage';