xref: /plugin/publish/_test/helper.test.php (revision 8368b68d1d1f74518352022be89d32dc988b127e)
191a2d0d1SMichael Große<?php
291a2d0d1SMichael Große/**
391a2d0d1SMichael Große * tests or the class helper_plugin_publish of the publish plugin
491a2d0d1SMichael Große *
591a2d0d1SMichael Große * @group plugin_publish
691a2d0d1SMichael Große * @group plugins
791a2d0d1SMichael Große */
891a2d0d1SMichael Großeclass helper_plugin_publish_test extends DokuWikiTest {
991a2d0d1SMichael Große
1091a2d0d1SMichael Große    public function setUp() {
1191a2d0d1SMichael Große        parent::setUp();
1291a2d0d1SMichael Große    }
1391a2d0d1SMichael Große
1491a2d0d1SMichael Große    protected $pluginsEnabled = array('publish',);
1591a2d0d1SMichael Große
16*8368b68dSMichael Große
1791a2d0d1SMichael Große    /**
18*8368b68dSMichael Große     * Testdata for @see helper_plugin_publish_test::test_in_namespace
1991a2d0d1SMichael Große     *
20*8368b68dSMichael Große     * @return array
2191a2d0d1SMichael Große     */
22*8368b68dSMichael Große    public function in_namespace_testdata() {
23*8368b68dSMichael Große        return array(
24*8368b68dSMichael Große            array("de:sidebar en:sidebar", 'de:sidebar', true, ''),
25*8368b68dSMichael Große            array("de:sidebar en:sidebar", 'en:sidebar', true, ''),
26*8368b68dSMichael Große            array("de:sidebar en:sidebar", 'en:sidebar:', true, ''),
27*8368b68dSMichael Große            array("de:sidebar en:sidebar", 'en:sidebar:start', true, ''),
28*8368b68dSMichael Große            array("de:sidebar en:sidebar", 'en:sidebar:namespace:start', true, ''),
29*8368b68dSMichael Große            array("de:sidebar en:sidebar", 'en:', false, ''),
30*8368b68dSMichael Große            array("de:sidebar en:sidebar", '', false, ''),
31*8368b68dSMichael Große            array("", 'foo:bar', true, ''),
32*8368b68dSMichael Große        );
33*8368b68dSMichael Große    }
34*8368b68dSMichael Große
35*8368b68dSMichael Große    /**
36*8368b68dSMichael Große     * @dataProvider in_namespace_testdata
37*8368b68dSMichael Große     *
38*8368b68dSMichael Große     * @param $namespace_list
39*8368b68dSMichael Große     * @param $id
40*8368b68dSMichael Große     * @param $result
41*8368b68dSMichael Große     * @param $msg
42*8368b68dSMichael Große     */
43*8368b68dSMichael Große    public function test_in_namespace($namespace_list, $id, $result, $msg) {
4491a2d0d1SMichael Große
4591a2d0d1SMichael Große        /** @var helper_plugin_publish $helper */
4691a2d0d1SMichael Große        $helper = plugin_load('helper', 'publish');
47*8368b68dSMichael Große        $this->assertSame($helper->in_namespace($namespace_list,$id),$result,$msg);
4891a2d0d1SMichael Große    }
4991a2d0d1SMichael Große
5091a2d0d1SMichael Große    public function test_isActive() {
5191a2d0d1SMichael Große        global $conf;
5291a2d0d1SMichael Große
5391a2d0d1SMichael Große        $conf['plugin']['publish']['no_apr_namespaces'] = 'de:sidebar en:sidebar';
5491a2d0d1SMichael Große
5591a2d0d1SMichael Große        /** @var helper_plugin_publish $helper */
5691a2d0d1SMichael Große        $helper = plugin_load('helper', 'publish');
5791a2d0d1SMichael Große
5891a2d0d1SMichael Große        $this->assertFalse($helper->isActive('de:sidebar'), 'de:sidebar is still listed as active');
5991a2d0d1SMichael Große        $this->assertFalse($helper->isActive('en:sidebar'), 'en:sidebar is still listed as active');
6091a2d0d1SMichael Große    }
6191a2d0d1SMichael Große
6291a2d0d1SMichael Große}
63