safeindex.test.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /*
  3. * @group plugin_include
  4. * @group plugins
  5. */
  6. class plugin_include_safeindex_test extends DokuWikiTest {
  7. public function setUp() : void
  8. {
  9. $this->pluginsEnabled[] = 'include';
  10. parent::setUp();
  11. }
  12. public function test_safeindex() {
  13. global $conf;
  14. global $AUTH_ACL;
  15. $conf['superuser'] = 'john';
  16. $conf['useacl'] = 1;
  17. $AUTH_ACL = array(
  18. '* @ALL 0',
  19. '* @user 8',
  20. 'public @ALL 1',
  21. );
  22. $_SERVER['REMOTE_USER'] = 'john';
  23. saveWikiText('parent', "{{page>child}}\n\n[[public_link]]\n\n{{page>public}}", 'Test parent created');
  24. saveWikiText('child', "[[foo:private]]", 'Test child created');
  25. saveWikiText('public', "[[foo:public]]", 'Public page created');
  26. idx_addPage('parent');
  27. idx_addPage('child');
  28. idx_addPage('public');
  29. $this->assertEquals(array('parent', 'public'), ft_backlinks('foo:public'));
  30. $this->assertEquals(array('child'), ft_backlinks('foo:private'));
  31. $this->assertEquals(array('parent'), ft_backlinks('public_link'));
  32. }
  33. }