Lines Matching +full:php +full:- +full:versions
1 <?php
35 $this->oldAuthAcl = $AUTH_ACL;
36 $this->userinfo = $USERINFO;
43 $this->remote = new Api();
53 $USERINFO = $this->userinfo;
54 $AUTH_ACL = $this->oldAuthAcl;
72 $this->assertEquals($expected, $actual, $msg);
80 $this->assertEqualResult(
82 $this->remote->call('core.getAPIVersion')
89 $this->assertEqualResult(
91 $this->remote->call('core.getWikiVersion')
99 $this->assertEqualResult(
101 $this->remote->call('core.getWikiTitle')
108 $this->assertEqualsWithDelta(
110 $this->remote->call('core.getWikiTime'),
122 $this->markTestIncomplete('Missing test for core.login API Call');
128 $this->markTestIncomplete('Missing test for core.logoff API Call');
134 $this->markTestIncomplete('Missing test for core.whoAmI API Call');
137 // core.aclCheck -> See also ApiCoreAclCheckTest.php
142 $this->assertEquals(AUTH_UPLOAD, $this->remote->call('core.aclCheck', ['page' => $id]));
155 $this->assertEquals(AUTH_EDIT, $this->remote->call('core.aclCheck', ['page' => $id]));
168 $indexer->addPage('wiki:syntax');
169 $indexer->addPage('wiki:dokuwiki');
194 $this->assertEqualResult(
196 $this->remote->call(
238 $this->assertEqualResult(
240 $this->remote->call(
256 (new Indexer())->addPage($id); //full text search depends on index
275 $this->assertEqualResult(
277 $this->remote->call(
317 $this->assertEqualResult(
319 $this->remote->call(
337 $this->waitForTick(true);
341 $this->assertEqualResult(
343 $this->remote->call('core.getPage', ['page' => $id, 'rev' => 0]),
344 'no revision given -> current'
347 $this->assertEqualResult(
349 $this->remote->call('core.getPage', ['page' => $id, 'rev' => $rev1]),
353 $this->assertEqualResult(
355 $this->remote->call('core.getPage', ['page' => $id, 'rev' => $rev2]),
359 $this->assertEqualResult(
361 $this->remote->call('core.getPage', ['page' => $id, 'rev' => 1234]),
365 $this->assertEqualResult(
367 $this->remote->call('core.getPage', ['page' => 'foobar', 'rev' => 1234]),
386 $this->waitForTick(true);
390 $this->assertEqualResult(
392 $this->remote->call('core.getPageHTML', ['page' => $id, 'rev' => 0]),
393 'no revision given -> current'
396 $this->assertEqualResult(
398 $this->remote->call('core.getPageHTML', ['page' => $id, 'rev' => $rev1]),
402 $this->assertEqualResult(
404 $this->remote->call('core.getPageHTML', ['page' => $id, 'rev' => $rev2]),
410 $this->remote->call('core.getPageHTML', ['page' => $id, 'rev' => 1234]);
413 $this->assertInstanceOf(RemoteException::class, $e);
414 $this->assertEquals(121, $e->getCode(), 'Non existing revision given');
418 $this->remote->call('core.getPageHTML', ['page' => 'foobar', 'rev' => 1234]);
421 $this->assertInstanceOf(RemoteException::class, $e);
422 $this->assertEquals(121, $e->getCode(), 'Non existing page given');
436 $this->waitForTick(true);
449 $this->assertEqualResult(
451 …$this->remote->call('core.getPageInfo', ['page' => $id, 'rev' => 0, 'hash' => true, 'author' => tr…
452 'no revision given -> current'
464 $this->assertEqualResult(
466 $this->remote->call('core.getPageInfo', ['page' => $id, 'rev' => $rev1]),
479 $this->assertEqualResult(
481 $this->remote->call('core.getPageInfo', ['page' => $id, 'rev' => $rev2]),
487 $this->remote->call('core.getPageInfo', ['page' => $id, 'rev' => 1234]);
490 $this->assertInstanceOf(RemoteException::class, $e);
491 $this->assertEquals(121, $e->getCode(), 'Non existing revision given');
495 $this->remote->call('core.getPageInfo', ['page' => 'foobar', 'rev' => 1234]);
498 $this->assertInstanceOf(RemoteException::class, $e);
499 $this->assertEquals(121, $e->getCode(), 'Non existing page given');
512 $this->waitForTick();
519 $versions = $this->remote->call('core.getPageHistory', $params);
520 $versions = json_decode(json_encode($versions), true);
521 $this->assertEquals(6, count($versions));
522 $this->assertEquals($rev[5], $versions[0]['revision']);
523 $this->assertEquals($rev[4], $versions[1]['revision']);
524 $this->assertEquals($rev[3], $versions[2]['revision']);
525 $this->assertEquals($rev[2], $versions[3]['revision']);
526 $this->assertEquals($rev[1], $versions[4]['revision']);
527 $this->assertEquals($rev[0], $versions[5]['revision']);
530 $versions = $this->remote->call('core.getPageHistory', $params);
531 $versions = json_decode(json_encode($versions), true);
532 $this->assertEquals(5, count($versions));
533 $this->assertEquals($rev[4], $versions[0]['revision']);
534 $this->assertEquals($rev[3], $versions[1]['revision']);
535 $this->assertEquals($rev[2], $versions[2]['revision']);
536 $this->assertEquals($rev[1], $versions[3]['revision']);
537 $this->assertEquals($rev[0], $versions[4]['revision']);
542 $versions = $this->remote->call('core.getPageHistory', $params);
543 $versions = json_decode(json_encode($versions), true);
544 $this->assertEquals(3, count($versions));
545 $this->assertEquals($rev[5], $versions[0]['revision']);
546 $this->assertEquals($rev[4], $versions[1]['revision']);
547 $this->assertEquals($rev[3], $versions[2]['revision']);
550 $versions = $this->remote->call('core.getPageHistory', $params);
551 $versions = json_decode(json_encode($versions), true);
552 $this->assertEquals(3, count($versions));
553 $this->assertEquals($rev[2], $versions[0]['revision']);
554 $this->assertEquals($rev[1], $versions[1]['revision']);
555 $this->assertEquals($rev[0], $versions[2]['revision']);
558 $versions = $this->remote->call('core.getPageHistory', $params);
559 $versions = json_decode(json_encode($versions), true);
560 $this->assertEquals(0, count($versions));
585 'page' => 'http://www.catb.org/~esr/faqs/smart-questions.html',
586 'href' => 'http://www.catb.org/~esr/faqs/smart-questions.html'
592 $this->assertEqualResult(
594 $this->remote->call('core.getPageLinks', ['page' => 'mailinglist'])
597 $this->expectExceptionCode(121);
598 $this->remote->call('core.getPageLinks', ['page' => 'foobar']);
607 $indexer->addPage('wiki:syntax');
608 $indexer->addPage('linky');
610 $result = $this->remote->call('core.getPageBackLinks', ['page' => 'wiki:syntax']);
611 $this->assertTrue(count($result) > 0);
612 $this->assertEqualResult((new MetadataSearch())->backlinks('wiki:syntax'), $result);
614 $this->assertEquals([], $this->remote->call('core.getPageBackLinks', ['page' => 'foobar']));
623 $this->assertEquals(
625 $this->remote->call('core.lockPages', ['pages' => $tolock]),
633 $this->assertEquals(
635 $this->remote->call('core.lockPages', ['pages' => $tolock]),
654 $this->assertEquals(
656 $this->remote->call('core.unlockPages', ['pages' => $tounlock])
672 $this->assertTrue($this->remote->call('core.savePage', $params));
673 $this->assertEquals($content, rawWiki($id));
680 $this->assertTrue($this->remote->call('core.savePage', $params));
681 $this->assertFileDoesNotExist(wikiFN($id));
686 $this->remote->call('core.savePage', $params);
689 $this->assertInstanceOf(RemoteException::class, $e);
690 $this->assertEquals(132, $e->getCode());
705 $this->assertEquals(true, $this->remote->call('core.appendPage', $params));
706 $this->assertEquals($content . $morecontent, rawWiki($id));
716 $id = 'wiki:dokuwiki-128.png';
731 $this->assertEqualResult(
733 $this->remote->call(
751 $orig = mediaFN('wiki:dokuwiki-128.png');
785 $this->assertEqualResult(
787 $this->remote->call(
799 $id = 'wiki:dokuwiki-128.png';
803 $this->assertEquals(
805 $this->remote->call('core.getMedia', ['media' => $id])
810 $this->remote->call('core.getMedia', ['media' => $id, 'rev' => 1234]);
813 $this->assertInstanceOf(RemoteException::class, $e);
814 $this->assertEquals(221, $e->getCode(), 'Non existing revision given');
818 $this->remote->call('core.getMedia', ['media' => 'foobar.png']);
821 $this->assertInstanceOf(RemoteException::class, $e);
822 $this->assertEquals(221, $e->getCode(), 'Non existing media id given');
829 $id = 'wiki:dokuwiki-128.png';
841 $this->assertEqualResult(
843 … $this->remote->call('core.getMediaInfo', ['media' => $id, 'hash' => true, 'author' => false])
848 $this->remote->call('core.getMediaInfo', ['media' => $id, 'rev' => 1234]);
851 $this->assertInstanceOf(RemoteException::class, $e);
852 $this->assertEquals(221, $e->getCode(), 'Non existing revision given');
856 $this->remote->call('core.getMediaInfo', ['media' => 'foobar.png']);
859 $this->assertInstanceOf(RemoteException::class, $e);
860 $this->assertEquals(221, $e->getCode(), 'Non existing media id given');
871 $orig = mediaFN('wiki:dokuwiki-128.png');
880 $this->waitForTick();
887 $versions = $this->remote->call('core.getMediaHistory', $params);
888 $versions = json_decode(json_encode($versions), true);
889 $this->assertEquals(2, count($versions));
890 $this->assertEquals($rev[1], $versions[0]['revision']);
891 $this->assertEquals($rev[0], $versions[1]['revision']);
894 $versions = $this->remote->call('core.getMediaHistory', $params);
895 $versions = json_decode(json_encode($versions), true);
896 $this->assertEquals(1, count($versions));
897 $this->assertEquals($rev[0], $versions[0]['revision']);
900 $versions = $this->remote->call('core.getMediaHistory', $params);
901 $versions = json_decode(json_encode($versions), true);
902 $this->assertEquals(0, count($versions));
905 $versions = $this->remote->call('core.getMediaHistory', $params);
906 $versions = json_decode(json_encode($versions), true);
907 $this->assertEquals(0, count($versions));
913 $orig = mediaFN('wiki:dokuwiki-128.png');
919 …$this->assertTrue($this->remote->call('core.saveMedia', ['media' => $target, 'base64' => $base64])…
920 $this->assertFileExists($targetfile);
921 $this->assertFileEquals($orig, $targetfile);
931 $id = 'wiki:dokuwiki-128.png';
937 $this->remote->call('core.deleteMedia', ['media' => $id]);
940 $this->assertInstanceOf(AccessDeniedException::class, $e);
941 $this->assertEquals(212, $e->getCode(), 'No permission to delete');
942 $this->assertFileExists($file);
954 $this->assertTrue($this->remote->call('core.deleteMedia', ['media' => $id]));
955 $this->assertFileDoesNotExist($file);
962 $this->remote->call('core.deleteMedia', ['media' => $id]);
965 $this->assertInstanceOf(RemoteException::class, $e);
966 $this->assertEquals(221, $e->getCode(), 'Non existing media id given');