[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 class CascadeExtraDefaultsTest extends DokuWikiTest 4 { 5 6 protected $oldSetting = []; 7 8 public function setUp(): void 9 { 10 global $config_cascade; 11 12 $this->pluginsEnabled = [ 13 'testing' 14 ]; 15 16 $out = "<?php\n/*\n * protected settings, cannot modified in the Config manager\n" . 17 " * Some test data */\n"; 18 $out .= "\$conf['title'] = 'New default Title';\n"; 19 $out .= "\$conf['tagline'] = 'New default Tagline';\n"; 20 $out .= "\$conf['plugin']['testing']['schnibble'] = 1;\n"; 21 $out .= "\$conf['plugin']['testing']['second'] = 'New default setting';\n"; 22 23 $file = DOKU_CONF . 'otherdefaults.php'; 24 file_put_contents($file, $out); 25 26 //store original settings 27 $this->oldSetting = $config_cascade['main']['default']; 28 //add second file with defaults, which override the defaults of DokuWiki 29 $config_cascade['main']['default'][] = $file; 30 31 parent::setUp(); 32 } 33 34 public function testNewDefaults() 35 { 36 global $conf; 37 38 $this->assertEquals('New default Tagline', $conf['tagline'], 'new default value'); 39 $testing = plugin_load('action', 'testing'); 40 $this->assertEquals(1, $testing->getConf('schnibble'), 'new default value'); 41 42 43 $this->assertEquals('My Test Wiki', $conf['title'], 'local value still overrides default'); 44 $this->assertEquals('Local setting', $testing->getConf('second'), 'local value still overrides default'); 45 } 46 47 public function tearDown(): void 48 { 49 global $config_cascade; 50 51 $config_cascade['main']['default'] = $this->oldSetting; 52 unlink(DOKU_CONF . 'otherdefaults.php'); 53 54 parent::tearDown(); 55 } 56 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body