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 168368b68dSMichael Große 1791a2d0d1SMichael Große /** 188368b68dSMichael Große * Testdata for @see helper_plugin_publish_test::test_in_namespace 1991a2d0d1SMichael Große * 208368b68dSMichael Große * @return array 2191a2d0d1SMichael Große */ 228368b68dSMichael Große public function in_namespace_testdata() { 238368b68dSMichael Große return array( 248368b68dSMichael Große array("de:sidebar en:sidebar", 'de:sidebar', true, ''), 258368b68dSMichael Große array("de:sidebar en:sidebar", 'en:sidebar', true, ''), 268368b68dSMichael Große array("de:sidebar en:sidebar", 'en:sidebar:', true, ''), 278368b68dSMichael Große array("de:sidebar en:sidebar", 'en:sidebar:start', true, ''), 288368b68dSMichael Große array("de:sidebar en:sidebar", 'en:sidebar:namespace:start', true, ''), 298368b68dSMichael Große array("de:sidebar en:sidebar", 'en:', false, ''), 308368b68dSMichael Große array("de:sidebar en:sidebar", '', false, ''), 318368b68dSMichael Große array("", 'foo:bar', true, ''), 328368b68dSMichael Große ); 338368b68dSMichael Große } 348368b68dSMichael Große 358368b68dSMichael Große /** 368368b68dSMichael Große * @dataProvider in_namespace_testdata 378368b68dSMichael Große * 388368b68dSMichael Große * @param $namespace_list 398368b68dSMichael Große * @param $id 408368b68dSMichael Große * @param $result 418368b68dSMichael Große * @param $msg 428368b68dSMichael Große */ 438368b68dSMichael 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'); 478368b68dSMichael Große $this->assertSame($helper->in_namespace($namespace_list,$id),$result,$msg); 4891a2d0d1SMichael Große } 4991a2d0d1SMichael Große 50*889aa2d2SMichael Große /** 51*889aa2d2SMichael Große * Testdata for @see helper_plugin_publish_test::test_in_sub_namespace 52*889aa2d2SMichael Große * 53*889aa2d2SMichael Große * @return array 54*889aa2d2SMichael Große */ 55*889aa2d2SMichael Große public function in_sub_namespace_testdata() { 56*889aa2d2SMichael Große return array( 57*889aa2d2SMichael Große array("de:sidebar en:sidebar", 'de:sidebar', true, ''), 58*889aa2d2SMichael Große array("de:sidebar en:sidebar", 'en:sidebar', true, ''), 59*889aa2d2SMichael Große array("de:sidebar en:sidebar", 'en:sidebar:', true, ''), 60*889aa2d2SMichael Große array("de:sidebar en:sidebar", 'en:sidebar:start', true, ''), 61*889aa2d2SMichael Große array("de:sidebar en:sidebar", 'en:sidebar:namespace:start', true, ''), 62*889aa2d2SMichael Große array("de:sidebar en:sidebar", 'en:', true, ''), 63*889aa2d2SMichael Große array("de:sidebar en:sidebar", '', false, ''), 64*889aa2d2SMichael Große array("", 'foo:bar', true, ''), 65*889aa2d2SMichael Große ); 66*889aa2d2SMichael Große } 67*889aa2d2SMichael Große 68*889aa2d2SMichael Große /** 69*889aa2d2SMichael Große * @dataProvider in_sub_namespace_testdata 70*889aa2d2SMichael Große * 71*889aa2d2SMichael Große * @param $namespace_list 72*889aa2d2SMichael Große * @param $id 73*889aa2d2SMichael Große * @param $result 74*889aa2d2SMichael Große * @param $msg 75*889aa2d2SMichael Große */ 76*889aa2d2SMichael Große public function test_in_sub_namespace($namespace_list, $id, $result, $msg) { 77*889aa2d2SMichael Große 78*889aa2d2SMichael Große /** @var helper_plugin_publish $helper */ 79*889aa2d2SMichael Große $helper = plugin_load('helper', 'publish'); 80*889aa2d2SMichael Große $this->assertSame($helper->is_dir_valid($namespace_list,$id),$result,$msg); 81*889aa2d2SMichael Große } 82*889aa2d2SMichael Große 8391a2d0d1SMichael Große public function test_isActive() { 8491a2d0d1SMichael Große global $conf; 8591a2d0d1SMichael Große 8691a2d0d1SMichael Große $conf['plugin']['publish']['no_apr_namespaces'] = 'de:sidebar en:sidebar'; 8791a2d0d1SMichael Große 8891a2d0d1SMichael Große /** @var helper_plugin_publish $helper */ 8991a2d0d1SMichael Große $helper = plugin_load('helper', 'publish'); 9091a2d0d1SMichael Große 9191a2d0d1SMichael Große $this->assertFalse($helper->isActive('de:sidebar'), 'de:sidebar is still listed as active'); 9291a2d0d1SMichael Große $this->assertFalse($helper->isActive('en:sidebar'), 'en:sidebar is still listed as active'); 9391a2d0d1SMichael Große } 9491a2d0d1SMichael Große 9591a2d0d1SMichael Große} 96