aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/config
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2017-03-03 23:06:12 +0100
committerVirtualTam <virtualtam@flibidi.net>2017-03-04 17:07:52 +0100
commit3c66e56435359dc678048193e8ee239d06f79b64 (patch)
tree38a4be4a9d9babc193683feec412ac008ca9a169 /tests/config
parent74198dcdf65ee3dd83cbe5b6a8a85bc386a62063 (diff)
downloadShaarli-3c66e56435359dc678048193e8ee239d06f79b64.tar.gz
Shaarli-3c66e56435359dc678048193e8ee239d06f79b64.tar.zst
Shaarli-3c66e56435359dc678048193e8ee239d06f79b64.zip
application: introduce the Shaarli\Config namespace
Namespaces have been introduced with the REST API, and should be generalized to the whole codebase to manage object scope and benefit from autoloading. See: - https://secure.php.net/manual/en/language.namespaces.php - http://www.php-fig.org/psr/psr-4/ Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'tests/config')
-rw-r--r--tests/config/ConfigJsonTest.php11
-rw-r--r--tests/config/ConfigManagerTest.php9
-rw-r--r--tests/config/ConfigPhpTest.php5
-rw-r--r--tests/config/ConfigPluginTest.php6
4 files changed, 16 insertions, 15 deletions
diff --git a/tests/config/ConfigJsonTest.php b/tests/config/ConfigJsonTest.php
index 07f6ab49..3527f83d 100644
--- a/tests/config/ConfigJsonTest.php
+++ b/tests/config/ConfigJsonTest.php
@@ -1,11 +1,10 @@
1<?php 1<?php
2 2namespace Shaarli\Config;
3require_once 'application/config/ConfigJson.php';
4 3
5/** 4/**
6 * Class ConfigJsonTest 5 * Class ConfigJsonTest
7 */ 6 */
8class ConfigJsonTest extends PHPUnit_Framework_TestCase 7class ConfigJsonTest extends \PHPUnit_Framework_TestCase
9{ 8{
10 /** 9 /**
11 * @var ConfigJson 10 * @var ConfigJson
@@ -40,7 +39,7 @@ class ConfigJsonTest extends PHPUnit_Framework_TestCase
40 /** 39 /**
41 * Read a non existent config file -> empty array. 40 * Read a non existent config file -> empty array.
42 * 41 *
43 * @expectedException Exception 42 * @expectedException \Exception
44 * @expectedExceptionMessage An error occurred while parsing JSON file: error code #4 43 * @expectedExceptionMessage An error occurred while parsing JSON file: error code #4
45 */ 44 */
46 public function testReadInvalidJson() 45 public function testReadInvalidJson()
@@ -112,7 +111,7 @@ class ConfigJsonTest extends PHPUnit_Framework_TestCase
112 /** 111 /**
113 * Write to invalid path. 112 * Write to invalid path.
114 * 113 *
115 * @expectedException IOException 114 * @expectedException \IOException
116 */ 115 */
117 public function testWriteInvalidArray() 116 public function testWriteInvalidArray()
118 { 117 {
@@ -123,7 +122,7 @@ class ConfigJsonTest extends PHPUnit_Framework_TestCase
123 /** 122 /**
124 * Write to invalid path. 123 * Write to invalid path.
125 * 124 *
126 * @expectedException IOException 125 * @expectedException \IOException
127 */ 126 */
128 public function testWriteInvalidBlank() 127 public function testWriteInvalidBlank()
129 { 128 {
diff --git a/tests/config/ConfigManagerTest.php b/tests/config/ConfigManagerTest.php
index 436e3d67..b81be5b6 100644
--- a/tests/config/ConfigManagerTest.php
+++ b/tests/config/ConfigManagerTest.php
@@ -1,4 +1,5 @@
1<?php 1<?php
2namespace Shaarli\Config;
2 3
3/** 4/**
4 * Unit tests for Class ConfigManagerTest 5 * Unit tests for Class ConfigManagerTest
@@ -6,7 +7,7 @@
6 * Note: it only test the manager with ConfigJson, 7 * Note: it only test the manager with ConfigJson,
7 * 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.
8 */ 9 */
9class ConfigManagerTest extends PHPUnit_Framework_TestCase 10class ConfigManagerTest extends \PHPUnit_Framework_TestCase
10{ 11{
11 /** 12 /**
12 * @var ConfigManager 13 * @var ConfigManager
@@ -83,7 +84,7 @@ class ConfigManagerTest extends PHPUnit_Framework_TestCase
83 /** 84 /**
84 * Set with an empty key. 85 * Set with an empty key.
85 * 86 *
86 * @expectedException Exception 87 * @expectedException \Exception
87 * @expectedExceptionMessageRegExp #^Invalid setting key parameter. String expected, got.*# 88 * @expectedExceptionMessageRegExp #^Invalid setting key parameter. String expected, got.*#
88 */ 89 */
89 public function testSetEmptyKey() 90 public function testSetEmptyKey()
@@ -94,7 +95,7 @@ class ConfigManagerTest extends PHPUnit_Framework_TestCase
94 /** 95 /**
95 * Set with an array key. 96 * Set with an array key.
96 * 97 *
97 * @expectedException Exception 98 * @expectedException \Exception
98 * @expectedExceptionMessageRegExp #^Invalid setting key parameter. String expected, got.*# 99 * @expectedExceptionMessageRegExp #^Invalid setting key parameter. String expected, got.*#
99 */ 100 */
100 public function testSetArrayKey() 101 public function testSetArrayKey()
@@ -105,7 +106,7 @@ class ConfigManagerTest extends PHPUnit_Framework_TestCase
105 /** 106 /**
106 * Try to write the config without mandatory parameter (e.g. 'login'). 107 * Try to write the config without mandatory parameter (e.g. 'login').
107 * 108 *
108 * @expectedException MissingFieldConfigException 109 * @expectedException Shaarli\Config\MissingFieldConfigException
109 */ 110 */
110 public function testWriteMissingParameter() 111 public function testWriteMissingParameter()
111 { 112 {
diff --git a/tests/config/ConfigPhpTest.php b/tests/config/ConfigPhpTest.php
index 58cd8d2a..abfbb305 100644
--- a/tests/config/ConfigPhpTest.php
+++ b/tests/config/ConfigPhpTest.php
@@ -1,11 +1,10 @@
1<?php 1<?php
2 2namespace Shaarli\Config;
3require_once 'application/config/ConfigPhp.php';
4 3
5/** 4/**
6 * Class ConfigPhpTest 5 * Class ConfigPhpTest
7 */ 6 */
8class ConfigPhpTest extends PHPUnit_Framework_TestCase 7class ConfigPhpTest extends \PHPUnit_Framework_TestCase
9{ 8{
10 /** 9 /**
11 * @var ConfigPhp 10 * @var ConfigPhp
diff --git a/tests/config/ConfigPluginTest.php b/tests/config/ConfigPluginTest.php
index 3b37cd79..22ab927b 100644
--- a/tests/config/ConfigPluginTest.php
+++ b/tests/config/ConfigPluginTest.php
@@ -1,4 +1,6 @@
1<?php 1<?php
2namespace Shaarli\Config;
3
2/** 4/**
3 * Config' tests 5 * Config' tests
4 */ 6 */
@@ -8,7 +10,7 @@ require_once 'application/config/ConfigPlugin.php';
8/** 10/**
9 * Unitary tests for Shaarli config related functions 11 * Unitary tests for Shaarli config related functions
10 */ 12 */
11class ConfigPluginTest extends PHPUnit_Framework_TestCase 13class ConfigPluginTest extends \PHPUnit_Framework_TestCase
12{ 14{
13 /** 15 /**
14 * Test save_plugin_config with valid data. 16 * Test save_plugin_config with valid data.
@@ -39,7 +41,7 @@ class ConfigPluginTest extends PHPUnit_Framework_TestCase
39 /** 41 /**
40 * Test save_plugin_config with invalid data. 42 * Test save_plugin_config with invalid data.
41 * 43 *
42 * @expectedException PluginConfigOrderException 44 * @expectedException Shaarli\Config\PluginConfigOrderException
43 */ 45 */
44 public function testSavePluginConfigInvalid() 46 public function testSavePluginConfigInvalid()
45 { 47 {