[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 namespace dokuwiki\plugin\config\test; 4 5 use dokuwiki\HTTP\DokuHTTPClient; 6 use dokuwiki\plugin\config\core\Configuration; 7 use dokuwiki\plugin\config\core\Setting\SettingFieldset; 8 use dokuwiki\plugin\config\core\Setting\SettingHidden; 9 10 /** 11 * Ensure config options have documentation at dokuwiki.org 12 * 13 * @group plugin_config 14 * @group admin_plugins 15 * @group plugins 16 * @group bundled_plugins 17 * @group internet 18 */ 19 class DocumentationTest extends \DokuWikiTest 20 { 21 /** 22 * @return \Generator|array[] 23 */ 24 public function provideSettings() 25 { 26 $configuration = new Configuration(); 27 28 foreach ($configuration->getSettings() as $setting) { 29 if (is_a($setting, SettingHidden::class)) continue; 30 if (is_a($setting, SettingFieldset::class)) continue; 31 32 $key = $setting->getKey(); 33 $pretty = $setting->getPrettyKey(); 34 if (!preg_match('/ href="(.*?)"/', $pretty, $m)) continue; 35 $url = $m[1]; 36 37 yield [$key, $url]; 38 } 39 } 40 41 /** 42 * @dataProvider provideSettings 43 * @param string $key Settingskey 44 * @param string $url Documentation URL 45 */ 46 public function testDocs($key, $url) 47 { 48 $http = new DokuHTTPClient(); 49 $check = $http->get($url); 50 $fail = (bool)strpos($check, 'topic does not exist'); 51 $msg = "Setting '$key' should have documentation at $url."; 52 $this->assertFalse($fail, $msg . ' ' . $http->status . ' ' . $http->error); 53 } 54 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body