diff options
Diffstat (limited to 'tests/config')
-rw-r--r-- | tests/config/ConfigJsonTest.php | 6 | ||||
-rw-r--r-- | tests/config/ConfigManagerTest.php | 25 | ||||
-rw-r--r-- | tests/config/ConfigPhpTest.php | 2 | ||||
-rw-r--r-- | tests/config/ConfigPluginTest.php | 2 |
4 files changed, 29 insertions, 6 deletions
diff --git a/tests/config/ConfigJsonTest.php b/tests/config/ConfigJsonTest.php index d237bc80..95ad060b 100644 --- a/tests/config/ConfigJsonTest.php +++ b/tests/config/ConfigJsonTest.php | |||
@@ -4,7 +4,7 @@ namespace Shaarli\Config; | |||
4 | /** | 4 | /** |
5 | * Class ConfigJsonTest | 5 | * Class ConfigJsonTest |
6 | */ | 6 | */ |
7 | class ConfigJsonTest extends \PHPUnit_Framework_TestCase | 7 | class ConfigJsonTest extends \PHPUnit\Framework\TestCase |
8 | { | 8 | { |
9 | /** | 9 | /** |
10 | * @var ConfigJson | 10 | * @var ConfigJson |
@@ -111,7 +111,7 @@ class ConfigJsonTest extends \PHPUnit_Framework_TestCase | |||
111 | /** | 111 | /** |
112 | * Write to invalid path. | 112 | * Write to invalid path. |
113 | * | 113 | * |
114 | * @expectedException \IOException | 114 | * @expectedException \Shaarli\Exceptions\IOException |
115 | */ | 115 | */ |
116 | public function testWriteInvalidArray() | 116 | public function testWriteInvalidArray() |
117 | { | 117 | { |
@@ -122,7 +122,7 @@ class ConfigJsonTest extends \PHPUnit_Framework_TestCase | |||
122 | /** | 122 | /** |
123 | * Write to invalid path. | 123 | * Write to invalid path. |
124 | * | 124 | * |
125 | * @expectedException \IOException | 125 | * @expectedException \Shaarli\Exceptions\IOException |
126 | */ | 126 | */ |
127 | public function testWriteInvalidBlank() | 127 | public function testWriteInvalidBlank() |
128 | { | 128 | { |
diff --git a/tests/config/ConfigManagerTest.php b/tests/config/ConfigManagerTest.php index 1ec447b2..33830bc9 100644 --- a/tests/config/ConfigManagerTest.php +++ b/tests/config/ConfigManagerTest.php | |||
@@ -7,7 +7,7 @@ namespace Shaarli\Config; | |||
7 | * Note: it only test the manager with ConfigJson, | 7 | * Note: it only test the manager with ConfigJson, |
8 | * ConfigPhp is only a workaround to handle the transition to JSON type. | 8 | * ConfigPhp is only a workaround to handle the transition to JSON type. |
9 | */ | 9 | */ |
10 | class ConfigManagerTest extends \PHPUnit_Framework_TestCase | 10 | class ConfigManagerTest extends \PHPUnit\Framework\TestCase |
11 | { | 11 | { |
12 | /** | 12 | /** |
13 | * @var ConfigManager | 13 | * @var ConfigManager |
@@ -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 |
diff --git a/tests/config/ConfigPhpTest.php b/tests/config/ConfigPhpTest.php index be23eea1..67d878ce 100644 --- a/tests/config/ConfigPhpTest.php +++ b/tests/config/ConfigPhpTest.php | |||
@@ -4,7 +4,7 @@ namespace Shaarli\Config; | |||
4 | /** | 4 | /** |
5 | * Class ConfigPhpTest | 5 | * Class ConfigPhpTest |
6 | */ | 6 | */ |
7 | class ConfigPhpTest extends \PHPUnit_Framework_TestCase | 7 | class ConfigPhpTest extends \PHPUnit\Framework\TestCase |
8 | { | 8 | { |
9 | /** | 9 | /** |
10 | * @var ConfigPhp | 10 | * @var ConfigPhp |
diff --git a/tests/config/ConfigPluginTest.php b/tests/config/ConfigPluginTest.php index deb02c9e..d7a70e68 100644 --- a/tests/config/ConfigPluginTest.php +++ b/tests/config/ConfigPluginTest.php | |||
@@ -8,7 +8,7 @@ require_once 'application/config/ConfigPlugin.php'; | |||
8 | /** | 8 | /** |
9 | * Unitary tests for Shaarli config related functions | 9 | * Unitary tests for Shaarli config related functions |
10 | */ | 10 | */ |
11 | class ConfigPluginTest extends \PHPUnit_Framework_TestCase | 11 | class ConfigPluginTest extends \PHPUnit\Framework\TestCase |
12 | { | 12 | { |
13 | /** | 13 | /** |
14 | * Test save_plugin_config with valid data. | 14 | * Test save_plugin_config with valid data. |