Lines Matching +full:php +full:- +full:versions
1 <?php
33 $this->oldAuthAcl = $AUTH_ACL;
34 $this->userinfo = $USERINFO;
41 $this->remote = new Api();
51 $USERINFO = $this->userinfo;
52 $AUTH_ACL = $this->oldAuthAcl;
70 $this->assertEquals($expected, $actual, $msg);
78 $this->assertEqualResult(
80 $this->remote->call('core.getAPIVersion')
87 $this->assertEqualResult(
89 $this->remote->call('core.getWikiVersion')
97 $this->assertEqualResult(
99 $this->remote->call('core.getWikiTitle')
106 $this->assertEqualsWithDelta(
108 $this->remote->call('core.getWikiTime'),
120 $this->markTestIncomplete('Missing test for core.login API Call');
126 $this->markTestIncomplete('Missing test for core.logoff API Call');
132 $this->markTestIncomplete('Missing test for core.whoAmI API Call');
135 // core.aclCheck -> See also ApiCoreAclCheckTest.php
140 $this->assertEquals(AUTH_UPLOAD, $this->remote->call('core.aclCheck', ['page' => $id]));
153 $this->assertEquals(AUTH_EDIT, $this->remote->call('core.aclCheck', ['page' => $id]));
191 $this->assertEqualResult(
193 $this->remote->call(
235 $this->assertEqualResult(
237 $this->remote->call(
272 $this->assertEqualResult(
274 $this->remote->call(
314 $this->assertEqualResult(
316 $this->remote->call(
334 $this->waitForTick(true);
338 $this->assertEqualResult(
340 $this->remote->call('core.getPage', ['page' => $id, 'rev' => 0]),
341 'no revision given -> current'
344 $this->assertEqualResult(
346 $this->remote->call('core.getPage', ['page' => $id, 'rev' => $rev1]),
350 $this->assertEqualResult(
352 $this->remote->call('core.getPage', ['page' => $id, 'rev' => $rev2]),
356 $this->assertEqualResult(
358 $this->remote->call('core.getPage', ['page' => $id, 'rev' => 1234]),
362 $this->assertEqualResult(
364 $this->remote->call('core.getPage', ['page' => 'foobar', 'rev' => 1234]),
383 $this->waitForTick(true);
387 $this->assertEqualResult(
389 $this->remote->call('core.getPageHTML', ['page' => $id, 'rev' => 0]),
390 'no revision given -> current'
393 $this->assertEqualResult(
395 $this->remote->call('core.getPageHTML', ['page' => $id, 'rev' => $rev1]),
399 $this->assertEqualResult(
401 $this->remote->call('core.getPageHTML', ['page' => $id, 'rev' => $rev2]),
407 $this->remote->call('core.getPageHTML', ['page' => $id, 'rev' => 1234]);
410 $this->assertInstanceOf(RemoteException::class, $e);
411 $this->assertEquals(121, $e->getCode(), 'Non existing revision given');
415 $this->remote->call('core.getPageHTML', ['page' => 'foobar', 'rev' => 1234]);
418 $this->assertInstanceOf(RemoteException::class, $e);
419 $this->assertEquals(121, $e->getCode(), 'Non existing page given');
433 $this->waitForTick(true);
446 $this->assertEqualResult(
448 …$this->remote->call('core.getPageInfo', ['page' => $id, 'rev' => 0, 'hash' => true, 'author' => tr…
449 'no revision given -> current'
461 $this->assertEqualResult(
463 $this->remote->call('core.getPageInfo', ['page' => $id, 'rev' => $rev1]),
476 $this->assertEqualResult(
478 $this->remote->call('core.getPageInfo', ['page' => $id, 'rev' => $rev2]),
484 $this->remote->call('core.getPageInfo', ['page' => $id, 'rev' => 1234]);
487 $this->assertInstanceOf(RemoteException::class, $e);
488 $this->assertEquals(121, $e->getCode(), 'Non existing revision given');
492 $this->remote->call('core.getPageInfo', ['page' => 'foobar', 'rev' => 1234]);
495 $this->assertInstanceOf(RemoteException::class, $e);
496 $this->assertEquals(121, $e->getCode(), 'Non existing page given');
509 $this->waitForTick();
516 $versions = $this->remote->call('core.getPageHistory', $params);
517 $versions = json_decode(json_encode($versions), true);
518 $this->assertEquals(6, count($versions));
519 $this->assertEquals($rev[5], $versions[0]['revision']);
520 $this->assertEquals($rev[4], $versions[1]['revision']);
521 $this->assertEquals($rev[3], $versions[2]['revision']);
522 $this->assertEquals($rev[2], $versions[3]['revision']);
523 $this->assertEquals($rev[1], $versions[4]['revision']);
524 $this->assertEquals($rev[0], $versions[5]['revision']);
527 $versions = $this->remote->call('core.getPageHistory', $params);
528 $versions = json_decode(json_encode($versions), true);
529 $this->assertEquals(5, count($versions));
530 $this->assertEquals($rev[4], $versions[0]['revision']);
531 $this->assertEquals($rev[3], $versions[1]['revision']);
532 $this->assertEquals($rev[2], $versions[2]['revision']);
533 $this->assertEquals($rev[1], $versions[3]['revision']);
534 $this->assertEquals($rev[0], $versions[4]['revision']);
539 $versions = $this->remote->call('core.getPageHistory', $params);
540 $versions = json_decode(json_encode($versions), true);
541 $this->assertEquals(3, count($versions));
542 $this->assertEquals($rev[5], $versions[0]['revision']);
543 $this->assertEquals($rev[4], $versions[1]['revision']);
544 $this->assertEquals($rev[3], $versions[2]['revision']);
547 $versions = $this->remote->call('core.getPageHistory', $params);
548 $versions = json_decode(json_encode($versions), true);
549 $this->assertEquals(3, count($versions));
550 $this->assertEquals($rev[2], $versions[0]['revision']);
551 $this->assertEquals($rev[1], $versions[1]['revision']);
552 $this->assertEquals($rev[0], $versions[2]['revision']);
555 $versions = $this->remote->call('core.getPageHistory', $params);
556 $versions = json_decode(json_encode($versions), true);
557 $this->assertEquals(0, count($versions));
582 'page' => 'http://www.catb.org/~esr/faqs/smart-questions.html',
583 'href' => 'http://www.catb.org/~esr/faqs/smart-questions.html'
589 $this->assertEqualResult(
591 $this->remote->call('core.getPageLinks', ['page' => 'mailinglist'])
594 $this->expectExceptionCode(121);
595 $this->remote->call('core.getPageLinks', ['page' => 'foobar']);
606 $result = $this->remote->call('core.getPageBackLinks', ['page' => 'wiki:syntax']);
607 $this->assertTrue(count($result) > 0);
608 $this->assertEqualResult(ft_backlinks('wiki:syntax'), $result);
610 $this->assertEquals([], $this->remote->call('core.getPageBackLinks', ['page' => 'foobar']));
619 $this->assertEquals(
621 $this->remote->call('core.lockPages', ['pages' => $tolock]),
629 $this->assertEquals(
631 $this->remote->call('core.lockPages', ['pages' => $tolock]),
650 $this->assertEquals(
652 $this->remote->call('core.unlockPages', ['pages' => $tounlock])
668 $this->assertTrue($this->remote->call('core.savePage', $params));
669 $this->assertEquals($content, rawWiki($id));
676 $this->assertTrue($this->remote->call('core.savePage', $params));
677 $this->assertFileDoesNotExist(wikiFN($id));
682 $this->remote->call('core.savePage', $params);
685 $this->assertInstanceOf(RemoteException::class, $e);
686 $this->assertEquals(132, $e->getCode());
701 $this->assertEquals(true, $this->remote->call('core.appendPage', $params));
702 $this->assertEquals($content . $morecontent, rawWiki($id));
712 $id = 'wiki:dokuwiki-128.png';
727 $this->assertEqualResult(
729 $this->remote->call(
747 $orig = mediaFN('wiki:dokuwiki-128.png');
781 $this->assertEqualResult(
783 $this->remote->call(
795 $id = 'wiki:dokuwiki-128.png';
799 $this->assertEquals(
801 $this->remote->call('core.getMedia', ['media' => $id])
806 $this->remote->call('core.getMedia', ['media' => $id, 'rev' => 1234]);
809 $this->assertInstanceOf(RemoteException::class, $e);
810 $this->assertEquals(221, $e->getCode(), 'Non existing revision given');
814 $this->remote->call('core.getMedia', ['media' => 'foobar.png']);
817 $this->assertInstanceOf(RemoteException::class, $e);
818 $this->assertEquals(221, $e->getCode(), 'Non existing media id given');
825 $id = 'wiki:dokuwiki-128.png';
837 $this->assertEqualResult(
839 … $this->remote->call('core.getMediaInfo', ['media' => $id, 'hash' => true, 'author' => false])
844 $this->remote->call('core.getMediaInfo', ['media' => $id, 'rev' => 1234]);
847 $this->assertInstanceOf(RemoteException::class, $e);
848 $this->assertEquals(221, $e->getCode(), 'Non existing revision given');
852 $this->remote->call('core.getMediaInfo', ['media' => 'foobar.png']);
855 $this->assertInstanceOf(RemoteException::class, $e);
856 $this->assertEquals(221, $e->getCode(), 'Non existing media id given');
867 $orig = mediaFN('wiki:dokuwiki-128.png');
876 $this->waitForTick();
883 $versions = $this->remote->call('core.getMediaHistory', $params);
884 $versions = json_decode(json_encode($versions), true);
885 $this->assertEquals(2, count($versions));
886 $this->assertEquals($rev[1], $versions[0]['revision']);
887 $this->assertEquals($rev[0], $versions[1]['revision']);
890 $versions = $this->remote->call('core.getMediaHistory', $params);
891 $versions = json_decode(json_encode($versions), true);
892 $this->assertEquals(1, count($versions));
893 $this->assertEquals($rev[0], $versions[0]['revision']);
896 $versions = $this->remote->call('core.getMediaHistory', $params);
897 $versions = json_decode(json_encode($versions), true);
898 $this->assertEquals(0, count($versions));
901 $versions = $this->remote->call('core.getMediaHistory', $params);
902 $versions = json_decode(json_encode($versions), true);
903 $this->assertEquals(0, count($versions));
909 $orig = mediaFN('wiki:dokuwiki-128.png');
915 …$this->assertTrue($this->remote->call('core.saveMedia', ['media' => $target, 'base64' => $base64])…
916 $this->assertFileExists($targetfile);
917 $this->assertFileEquals($orig, $targetfile);
927 $id = 'wiki:dokuwiki-128.png';
933 $this->remote->call('core.deleteMedia', ['media' => $id]);
936 $this->assertInstanceOf(AccessDeniedException::class, $e);
937 $this->assertEquals(212, $e->getCode(), 'No permission to delete');
938 $this->assertFileExists($file);
950 $this->assertTrue($this->remote->call('core.deleteMedia', ['media' => $id]));
951 $this->assertFileDoesNotExist($file);
958 $this->remote->call('core.deleteMedia', ['media' => $id]);
961 $this->assertInstanceOf(RemoteException::class, $e);
962 $this->assertEquals(221, $e->getCode(), 'Non existing media id given');