diff options
author | Andreas Gohr <andi@splitbrain.org> | 2012-11-16 13:59:17 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2012-11-16 13:59:17 +0100 |
commit | cba21baacb4880eefd35279b0589e035c5a5c78e (patch) | |
tree | a5aca28b7fa6bfe805fb7b8a7eb91dbc3ba602d1 /lib/plugins/config/_test/configuration.test.php | |
parent | d30b165d18ab3a6868d3b3e96e7bac782fb58441 (diff) | |
download | rpg-cba21baacb4880eefd35279b0589e035c5a5c78e.tar.gz rpg-cba21baacb4880eefd35279b0589e035c5a5c78e.tar.bz2 |
started to add some unit tests to config manager
Parsing the config file should be completely tested before we can rely
on it and safely extend it. This just adds the first very basic tests.
Diffstat (limited to 'lib/plugins/config/_test/configuration.test.php')
-rw-r--r-- | lib/plugins/config/_test/configuration.test.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/plugins/config/_test/configuration.test.php b/lib/plugins/config/_test/configuration.test.php new file mode 100644 index 000000000..eeeff61a3 --- /dev/null +++ b/lib/plugins/config/_test/configuration.test.php @@ -0,0 +1,31 @@ +<?php + +class plugin_config_configuration_test extends DokuWikiTest { + + private $config = ''; + private $meta = ''; + + function __construct() { + $this->config = dirname(__FILE__).'/data/config.php'; + $this->meta = dirname(__FILE__).'/data/metadata.php'; + require_once(dirname(__FILE__).'/../settings/config.class.php'); + } + + function test_readconfig() { + $confmgr = new configuration($this->meta); + + $conf = $confmgr->_read_config($this->config); + + //print_r($conf); + + $this->assertEquals('42', $conf['int1']); + $this->assertEquals('6*7', $conf['int2']); + + $this->assertEquals('Hello World', $conf['str1']); + $this->assertEquals('G\'day World', $conf['str2']); + $this->assertEquals('Hello World', $conf['str3']); + $this->assertEquals("Hello 'World'", $conf['str4']); + $this->assertEquals('Hello "World"', $conf['str5']); + } + +}
\ No newline at end of file |