aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/config
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-11-11 14:00:18 +0100
committerArthurHoaro <arthur@hoa.ro>2018-07-05 20:31:35 +0200
commita3724717ec37d4bd54dc117ef439c8a182157882 (patch)
tree4d7cdfd97c57c34293453ec898e07819746f930e /tests/config
parent1b93137e16694f52952c930848e1a7928e8a00a6 (diff)
downloadShaarli-a3724717ec37d4bd54dc117ef439c8a182157882.tar.gz
Shaarli-a3724717ec37d4bd54dc117ef439c8a182157882.tar.zst
Shaarli-a3724717ec37d4bd54dc117ef439c8a182157882.zip
ConfigManager: add a method to remove an entry
Diffstat (limited to 'tests/config')
-rw-r--r--tests/config/ConfigManagerTest.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/config/ConfigManagerTest.php b/tests/config/ConfigManagerTest.php
index 1ec447b2..4a4e94ac 100644
--- a/tests/config/ConfigManagerTest.php
+++ b/tests/config/ConfigManagerTest.php
@@ -81,6 +81,18 @@ class ConfigManagerTest extends \PHPUnit_Framework_TestCase
81 $this->assertEquals('testSetWriteGetNested', $this->conf->get('foo.bar.key.stuff')); 81 $this->assertEquals('testSetWriteGetNested', $this->conf->get('foo.bar.key.stuff'));
82 } 82 }
83 83
84 public function testSetDeleteNested()
85 {
86 $this->conf->set('foo.bar.key.stuff', 'testSetDeleteNested');
87 $this->assertTrue($this->conf->exists('foo.bar'));
88 $this->assertTrue($this->conf->exists('foo.bar.key.stuff'));
89 $this->assertEquals('testSetDeleteNested', $this->conf->get('foo.bar.key.stuff'));
90
91 $this->conf->remove('foo.bar');
92 $this->assertFalse($this->conf->exists('foo.bar.key.stuff'));
93 $this->assertFalse($this->conf->exists('foo.bar'));
94 }
95
84 /** 96 /**
85 * Set with an empty key. 97 * Set with an empty key.
86 * 98 *
@@ -104,6 +116,17 @@ class ConfigManagerTest extends \PHPUnit_Framework_TestCase
104 } 116 }
105 117
106 /** 118 /**
119 * Remove with an empty key.
120 *
121 * @expectedException \Exception
122 * @expectedExceptionMessageRegExp #^Invalid setting key parameter. String expected, got.*#
123 */
124 public function testRmoveEmptyKey()
125 {
126 $this->conf->remove('');
127 }
128
129 /**
107 * Try to write the config without mandatory parameter (e.g. 'login'). 130 * Try to write the config without mandatory parameter (e.g. 'login').
108 * 131 *
109 * @expectedException Shaarli\Config\Exception\MissingFieldConfigException 132 * @expectedException Shaarli\Config\Exception\MissingFieldConfigException