|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Run with --process-isolation option |
| 4 | + */ |
| 5 | + |
| 6 | +/** |
| 7 | + * PHPUnit tests for Debug class |
| 8 | + */ |
| 9 | +class ConfigTest extends DebugTestFramework |
| 10 | +{ |
| 11 | + |
| 12 | + /** |
| 13 | + * Test |
| 14 | + * |
| 15 | + * @return void |
| 16 | + */ |
| 17 | + public function testGetCfg() |
| 18 | + { |
| 19 | + $abstracterKeys = array('collectConstants', 'collectMethods', 'objectsExclude', 'objectSort', 'useDebugInfo'); |
| 20 | + $debugKeys = array('collect', 'file', 'key', 'output', 'errorMask', 'emailFunc', 'emailLog', 'emailTo', 'logEnvInfo', 'logServerKeys', 'onLog',); |
| 21 | + |
| 22 | + $this->assertSame(true, $this->debug->getCfg('collect')); |
| 23 | + $this->assertSame(true, $this->debug->getCfg('debug.collect')); |
| 24 | + |
| 25 | + $this->assertSame('visibility', $this->debug->getCfg('objectSort')); |
| 26 | + $this->assertSame('visibility', $this->debug->getCfg('abstracter.objectSort')); |
| 27 | + $this->assertSame('visibility', $this->debug->getCfg('abstracter/objectSort')); |
| 28 | + |
| 29 | + $this->assertSame($abstracterKeys, array_keys($this->debug->getCfg('abstracter'))); |
| 30 | + $this->assertSame($abstracterKeys, array_keys($this->debug->getCfg('abstracter/*'))); |
| 31 | + $this->assertSame($debugKeys, array_keys($this->debug->getCfg())); |
| 32 | + $this->assertSame($debugKeys, array_keys($this->debug->getCfg('debug'))); |
| 33 | + $this->assertSame($debugKeys, array_keys($this->debug->getCfg('debug/*'))); |
| 34 | + } |
| 35 | + |
| 36 | + /** |
| 37 | + * Test |
| 38 | + * |
| 39 | + * @return void |
| 40 | + */ |
| 41 | + public function testSetCfg() |
| 42 | + { |
| 43 | + $this->assertSame(null, $this->debug->setCfg('foo', 'bar')); |
| 44 | + $this->assertSame('bar', $this->debug->setCfg('foo', 'baz')); |
| 45 | + $this->assertSame('baz', $this->debug->getCfg('foo')); |
| 46 | + } |
| 47 | +} |
0 commit comments