diff options
26 files changed, 62 insertions, 47 deletions
diff --git a/application/Updater.php b/application/Updater.php index f5ebf31a..27cb2f0a 100644 --- a/application/Updater.php +++ b/application/Updater.php | |||
@@ -1,4 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | use Shaarli\Config\ConfigJson; | ||
3 | use Shaarli\Config\ConfigPhp; | ||
2 | 4 | ||
3 | /** | 5 | /** |
4 | * Class Updater. | 6 | * Class Updater. |
diff --git a/application/api/ApiMiddleware.php b/application/api/ApiMiddleware.php index 522091ca..4120f7a9 100644 --- a/application/api/ApiMiddleware.php +++ b/application/api/ApiMiddleware.php | |||
@@ -1,9 +1,9 @@ | |||
1 | <?php | 1 | <?php |
2 | |||
3 | namespace Shaarli\Api; | 2 | namespace Shaarli\Api; |
4 | 3 | ||
5 | use Shaarli\Api\Exceptions\ApiException; | 4 | use Shaarli\Api\Exceptions\ApiException; |
6 | use Shaarli\Api\Exceptions\ApiAuthorizationException; | 5 | use Shaarli\Api\Exceptions\ApiAuthorizationException; |
6 | |||
7 | use Slim\Container; | 7 | use Slim\Container; |
8 | use Slim\Http\Request; | 8 | use Slim\Http\Request; |
9 | use Slim\Http\Response; | 9 | use Slim\Http\Response; |
diff --git a/application/config/ConfigIO.php b/application/config/ConfigIO.php index be78b1c7..3efe5b6f 100644 --- a/application/config/ConfigIO.php +++ b/application/config/ConfigIO.php | |||
@@ -1,4 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | namespace Shaarli\Config; | ||
2 | 3 | ||
3 | /** | 4 | /** |
4 | * Interface ConfigIO | 5 | * Interface ConfigIO |
diff --git a/application/config/ConfigJson.php b/application/config/ConfigJson.php index 6b5d73f1..30908d90 100644 --- a/application/config/ConfigJson.php +++ b/application/config/ConfigJson.php | |||
@@ -1,4 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | namespace Shaarli\Config; | ||
2 | 3 | ||
3 | /** | 4 | /** |
4 | * Class ConfigJson (ConfigIO implementation) | 5 | * Class ConfigJson (ConfigIO implementation) |
@@ -21,7 +22,7 @@ class ConfigJson implements ConfigIO | |||
21 | $data = json_decode($data, true); | 22 | $data = json_decode($data, true); |
22 | if ($data === null) { | 23 | if ($data === null) { |
23 | $error = json_last_error(); | 24 | $error = json_last_error(); |
24 | throw new Exception('An error occurred while parsing JSON file: error code #'. $error); | 25 | throw new \Exception('An error occurred while parsing JSON file: error code #'. $error); |
25 | } | 26 | } |
26 | return $data; | 27 | return $data; |
27 | } | 28 | } |
@@ -35,7 +36,7 @@ class ConfigJson implements ConfigIO | |||
35 | $print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0; | 36 | $print = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0; |
36 | $data = self::getPhpHeaders() . json_encode($conf, $print) . self::getPhpSuffix(); | 37 | $data = self::getPhpHeaders() . json_encode($conf, $print) . self::getPhpSuffix(); |
37 | if (!file_put_contents($filepath, $data)) { | 38 | if (!file_put_contents($filepath, $data)) { |
38 | throw new IOException( | 39 | throw new \IOException( |
39 | $filepath, | 40 | $filepath, |
40 | 'Shaarli could not create the config file. | 41 | 'Shaarli could not create the config file. |
41 | Please make sure Shaarli has the right to write in the folder is it installed in.' | 42 | Please make sure Shaarli has the right to write in the folder is it installed in.' |
diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php index a401887c..679a75b3 100644 --- a/application/config/ConfigManager.php +++ b/application/config/ConfigManager.php | |||
@@ -1,9 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | namespace Shaarli\Config; | |
3 | // FIXME! Namespaces... | ||
4 | require_once 'ConfigIO.php'; | ||
5 | require_once 'ConfigJson.php'; | ||
6 | require_once 'ConfigPhp.php'; | ||
7 | 3 | ||
8 | /** | 4 | /** |
9 | * Class ConfigManager | 5 | * Class ConfigManager |
@@ -124,12 +120,12 @@ class ConfigManager | |||
124 | * @param bool $write Write the new setting in the config file, default false. | 120 | * @param bool $write Write the new setting in the config file, default false. |
125 | * @param bool $isLoggedIn User login state, default false. | 121 | * @param bool $isLoggedIn User login state, default false. |
126 | * | 122 | * |
127 | * @throws Exception Invalid | 123 | * @throws \Exception Invalid |
128 | */ | 124 | */ |
129 | public function set($setting, $value, $write = false, $isLoggedIn = false) | 125 | public function set($setting, $value, $write = false, $isLoggedIn = false) |
130 | { | 126 | { |
131 | if (empty($setting) || ! is_string($setting)) { | 127 | if (empty($setting) || ! is_string($setting)) { |
132 | throw new Exception('Invalid setting key parameter. String expected, got: '. gettype($setting)); | 128 | throw new \Exception('Invalid setting key parameter. String expected, got: '. gettype($setting)); |
133 | } | 129 | } |
134 | 130 | ||
135 | // During the ConfigIO transition, map legacy settings to the new ones. | 131 | // During the ConfigIO transition, map legacy settings to the new ones. |
@@ -177,7 +173,7 @@ class ConfigManager | |||
177 | * | 173 | * |
178 | * @throws MissingFieldConfigException: a mandatory field has not been provided in $conf. | 174 | * @throws MissingFieldConfigException: a mandatory field has not been provided in $conf. |
179 | * @throws UnauthorizedConfigException: user is not authorize to change configuration. | 175 | * @throws UnauthorizedConfigException: user is not authorize to change configuration. |
180 | * @throws IOException: an error occurred while writing the new config file. | 176 | * @throws \IOException: an error occurred while writing the new config file. |
181 | */ | 177 | */ |
182 | public function write($isLoggedIn) | 178 | public function write($isLoggedIn) |
183 | { | 179 | { |
@@ -366,7 +362,7 @@ class ConfigManager | |||
366 | /** | 362 | /** |
367 | * Exception used if a mandatory field is missing in given configuration. | 363 | * Exception used if a mandatory field is missing in given configuration. |
368 | */ | 364 | */ |
369 | class MissingFieldConfigException extends Exception | 365 | class MissingFieldConfigException extends \Exception |
370 | { | 366 | { |
371 | public $field; | 367 | public $field; |
372 | 368 | ||
@@ -385,7 +381,7 @@ class MissingFieldConfigException extends Exception | |||
385 | /** | 381 | /** |
386 | * Exception used if an unauthorized attempt to edit configuration has been made. | 382 | * Exception used if an unauthorized attempt to edit configuration has been made. |
387 | */ | 383 | */ |
388 | class UnauthorizedConfigException extends Exception | 384 | class UnauthorizedConfigException extends \Exception |
389 | { | 385 | { |
390 | /** | 386 | /** |
391 | * Construct exception. | 387 | * Construct exception. |
diff --git a/application/config/ConfigPhp.php b/application/config/ConfigPhp.php index d7fd4baf..2633824d 100644 --- a/application/config/ConfigPhp.php +++ b/application/config/ConfigPhp.php | |||
@@ -1,4 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | namespace Shaarli\Config; | ||
2 | 3 | ||
3 | /** | 4 | /** |
4 | * Class ConfigPhp (ConfigIO implementation) | 5 | * Class ConfigPhp (ConfigIO implementation) |
@@ -115,7 +116,7 @@ class ConfigPhp implements ConfigIO | |||
115 | if (!file_put_contents($filepath, $configStr) | 116 | if (!file_put_contents($filepath, $configStr) |
116 | || strcmp(file_get_contents($filepath), $configStr) != 0 | 117 | || strcmp(file_get_contents($filepath), $configStr) != 0 |
117 | ) { | 118 | ) { |
118 | throw new IOException( | 119 | throw new \IOException( |
119 | $filepath, | 120 | $filepath, |
120 | 'Shaarli could not create the config file. | 121 | 'Shaarli could not create the config file. |
121 | Please make sure Shaarli has the right to write in the folder is it installed in.' | 122 | Please make sure Shaarli has the right to write in the folder is it installed in.' |
diff --git a/application/config/ConfigPlugin.php b/application/config/ConfigPlugin.php index cb0b6fce..61a594d3 100644 --- a/application/config/ConfigPlugin.php +++ b/application/config/ConfigPlugin.php | |||
@@ -1,4 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | namespace Shaarli\Config; | ||
3 | |||
2 | /** | 4 | /** |
3 | * Plugin configuration helper functions. | 5 | * Plugin configuration helper functions. |
4 | * | 6 | * |
@@ -112,7 +114,7 @@ function load_plugin_parameter_values($plugins, $conf) | |||
112 | /** | 114 | /** |
113 | * Exception used if an error occur while saving plugin configuration. | 115 | * Exception used if an error occur while saving plugin configuration. |
114 | */ | 116 | */ |
115 | class PluginConfigOrderException extends Exception | 117 | class PluginConfigOrderException extends \Exception |
116 | { | 118 | { |
117 | /** | 119 | /** |
118 | * Construct exception. | 120 | * Construct exception. |
diff --git a/composer.json b/composer.json index 2fed0df7..b82aceef 100644 --- a/composer.json +++ b/composer.json | |||
@@ -27,7 +27,8 @@ | |||
27 | "Shaarli\\": "application", | 27 | "Shaarli\\": "application", |
28 | "Shaarli\\Api\\": "application/api/", | 28 | "Shaarli\\Api\\": "application/api/", |
29 | "Shaarli\\Api\\Controllers\\": "application/api/controllers", | 29 | "Shaarli\\Api\\Controllers\\": "application/api/controllers", |
30 | "Shaarli\\Api\\Exceptions\\": "application/api/exceptions" | 30 | "Shaarli\\Api\\Exceptions\\": "application/api/exceptions", |
31 | "Shaarli\\Config\\": "application/config/" | ||
31 | } | 32 | } |
32 | } | 33 | } |
33 | } | 34 | } |
@@ -62,8 +62,6 @@ require_once __DIR__ . '/vendor/autoload.php'; | |||
62 | require_once 'application/ApplicationUtils.php'; | 62 | require_once 'application/ApplicationUtils.php'; |
63 | require_once 'application/Cache.php'; | 63 | require_once 'application/Cache.php'; |
64 | require_once 'application/CachedPage.php'; | 64 | require_once 'application/CachedPage.php'; |
65 | require_once 'application/config/ConfigManager.php'; | ||
66 | require_once 'application/config/ConfigPlugin.php'; | ||
67 | require_once 'application/FeedBuilder.php'; | 65 | require_once 'application/FeedBuilder.php'; |
68 | require_once 'application/FileUtils.php'; | 66 | require_once 'application/FileUtils.php'; |
69 | require_once 'application/HttpUtils.php'; | 67 | require_once 'application/HttpUtils.php'; |
@@ -80,6 +78,7 @@ require_once 'application/PluginManager.php'; | |||
80 | require_once 'application/Router.php'; | 78 | require_once 'application/Router.php'; |
81 | require_once 'application/Updater.php'; | 79 | require_once 'application/Updater.php'; |
82 | use \Shaarli\ThemeUtils; | 80 | use \Shaarli\ThemeUtils; |
81 | use \Shaarli\Config\ConfigManager; | ||
83 | 82 | ||
84 | // Ensure the PHP version is supported | 83 | // Ensure the PHP version is supported |
85 | try { | 84 | try { |
diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php index 634bd0ed..ad86e21c 100644 --- a/tests/ApplicationUtilsTest.php +++ b/tests/ApplicationUtilsTest.php | |||
@@ -1,9 +1,10 @@ | |||
1 | <?php | 1 | <?php |
2 | use Shaarli\Config\ConfigManager; | ||
3 | |||
2 | /** | 4 | /** |
3 | * ApplicationUtils' tests | 5 | * ApplicationUtils' tests |
4 | */ | 6 | */ |
5 | 7 | ||
6 | require_once 'application/config/ConfigManager.php'; | ||
7 | require_once 'application/ApplicationUtils.php'; | 8 | require_once 'application/ApplicationUtils.php'; |
8 | 9 | ||
9 | /** | 10 | /** |
diff --git a/tests/PluginManagerTest.php b/tests/PluginManagerTest.php index ddf48185..01de959c 100644 --- a/tests/PluginManagerTest.php +++ b/tests/PluginManagerTest.php | |||
@@ -1,4 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | use Shaarli\Config\ConfigManager; | ||
2 | 3 | ||
3 | /** | 4 | /** |
4 | * Plugin Manager tests | 5 | * Plugin Manager tests |
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php index 39be88f9..448405a3 100644 --- a/tests/Updater/UpdaterTest.php +++ b/tests/Updater/UpdaterTest.php | |||
@@ -1,6 +1,8 @@ | |||
1 | <?php | 1 | <?php |
2 | use Shaarli\Config\ConfigJson; | ||
3 | use Shaarli\Config\ConfigManager; | ||
4 | use Shaarli\Config\ConfigPhp; | ||
2 | 5 | ||
3 | require_once 'application/config/ConfigManager.php'; | ||
4 | require_once 'tests/Updater/DummyUpdater.php'; | 6 | require_once 'tests/Updater/DummyUpdater.php'; |
5 | require_once 'inc/rain.tpl.class.php'; | 7 | require_once 'inc/rain.tpl.class.php'; |
6 | 8 | ||
diff --git a/tests/api/ApiMiddlewareTest.php b/tests/api/ApiMiddlewareTest.php index d9753b1d..23a56b1c 100644 --- a/tests/api/ApiMiddlewareTest.php +++ b/tests/api/ApiMiddlewareTest.php | |||
@@ -1,7 +1,8 @@ | |||
1 | <?php | 1 | <?php |
2 | |||
3 | namespace Shaarli\Api; | 2 | namespace Shaarli\Api; |
4 | 3 | ||
4 | use Shaarli\Config\ConfigManager; | ||
5 | |||
5 | use Slim\Container; | 6 | use Slim\Container; |
6 | use Slim\Http\Environment; | 7 | use Slim\Http\Environment; |
7 | use Slim\Http\Request; | 8 | use Slim\Http\Request; |
@@ -44,7 +45,7 @@ class ApiMiddlewareTest extends \PHPUnit_Framework_TestCase | |||
44 | */ | 45 | */ |
45 | public function setUp() | 46 | public function setUp() |
46 | { | 47 | { |
47 | $this->conf = new \ConfigManager('tests/utils/config/configJson.json.php'); | 48 | $this->conf = new ConfigManager('tests/utils/config/configJson.json.php'); |
48 | $this->conf->set('api.secret', 'NapoleonWasALizard'); | 49 | $this->conf->set('api.secret', 'NapoleonWasALizard'); |
49 | 50 | ||
50 | $this->refDB = new \ReferenceLinkDB(); | 51 | $this->refDB = new \ReferenceLinkDB(); |
diff --git a/tests/api/controllers/GetLinkIdTest.php b/tests/api/controllers/GetLinkIdTest.php index 1b020505..45b18e6a 100644 --- a/tests/api/controllers/GetLinkIdTest.php +++ b/tests/api/controllers/GetLinkIdTest.php | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | namespace Shaarli\Api\Controllers; | 3 | namespace Shaarli\Api\Controllers; |
4 | 4 | ||
5 | use Shaarli\Config\ConfigManager; | ||
5 | 6 | ||
6 | use Slim\Container; | 7 | use Slim\Container; |
7 | use Slim\Http\Environment; | 8 | use Slim\Http\Environment; |
@@ -25,7 +26,7 @@ class GetLinkIdTest extends \PHPUnit_Framework_TestCase | |||
25 | protected static $testDatastore = 'sandbox/datastore.php'; | 26 | protected static $testDatastore = 'sandbox/datastore.php'; |
26 | 27 | ||
27 | /** | 28 | /** |
28 | * @var \ConfigManager instance | 29 | * @var ConfigManager instance |
29 | */ | 30 | */ |
30 | protected $conf; | 31 | protected $conf; |
31 | 32 | ||
@@ -54,7 +55,7 @@ class GetLinkIdTest extends \PHPUnit_Framework_TestCase | |||
54 | */ | 55 | */ |
55 | public function setUp() | 56 | public function setUp() |
56 | { | 57 | { |
57 | $this->conf = new \ConfigManager('tests/utils/config/configJson'); | 58 | $this->conf = new ConfigManager('tests/utils/config/configJson'); |
58 | $this->refDB = new \ReferenceLinkDB(); | 59 | $this->refDB = new \ReferenceLinkDB(); |
59 | $this->refDB->write(self::$testDatastore); | 60 | $this->refDB->write(self::$testDatastore); |
60 | 61 | ||
diff --git a/tests/api/controllers/GetLinksTest.php b/tests/api/controllers/GetLinksTest.php index da54fcf1..10330cd9 100644 --- a/tests/api/controllers/GetLinksTest.php +++ b/tests/api/controllers/GetLinksTest.php | |||
@@ -1,7 +1,7 @@ | |||
1 | <?php | 1 | <?php |
2 | |||
3 | namespace Shaarli\Api\Controllers; | 2 | namespace Shaarli\Api\Controllers; |
4 | 3 | ||
4 | use Shaarli\Config\ConfigManager; | ||
5 | 5 | ||
6 | use Slim\Container; | 6 | use Slim\Container; |
7 | use Slim\Http\Environment; | 7 | use Slim\Http\Environment; |
@@ -25,7 +25,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase | |||
25 | protected static $testDatastore = 'sandbox/datastore.php'; | 25 | protected static $testDatastore = 'sandbox/datastore.php'; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * @var \ConfigManager instance | 28 | * @var ConfigManager instance |
29 | */ | 29 | */ |
30 | protected $conf; | 30 | protected $conf; |
31 | 31 | ||
@@ -54,7 +54,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase | |||
54 | */ | 54 | */ |
55 | public function setUp() | 55 | public function setUp() |
56 | { | 56 | { |
57 | $this->conf = new \ConfigManager('tests/utils/config/configJson'); | 57 | $this->conf = new ConfigManager('tests/utils/config/configJson'); |
58 | $this->refDB = new \ReferenceLinkDB(); | 58 | $this->refDB = new \ReferenceLinkDB(); |
59 | $this->refDB->write(self::$testDatastore); | 59 | $this->refDB->write(self::$testDatastore); |
60 | 60 | ||
diff --git a/tests/api/controllers/InfoTest.php b/tests/api/controllers/InfoTest.php index 2916eed8..4beef3f7 100644 --- a/tests/api/controllers/InfoTest.php +++ b/tests/api/controllers/InfoTest.php | |||
@@ -1,7 +1,8 @@ | |||
1 | <?php | 1 | <?php |
2 | |||
3 | namespace Shaarli\Api\Controllers; | 2 | namespace Shaarli\Api\Controllers; |
4 | 3 | ||
4 | use Shaarli\Config\ConfigManager; | ||
5 | |||
5 | use Slim\Container; | 6 | use Slim\Container; |
6 | use Slim\Http\Environment; | 7 | use Slim\Http\Environment; |
7 | use Slim\Http\Request; | 8 | use Slim\Http\Request; |
@@ -22,7 +23,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase | |||
22 | protected static $testDatastore = 'sandbox/datastore.php'; | 23 | protected static $testDatastore = 'sandbox/datastore.php'; |
23 | 24 | ||
24 | /** | 25 | /** |
25 | * @var \ConfigManager instance | 26 | * @var ConfigManager instance |
26 | */ | 27 | */ |
27 | protected $conf; | 28 | protected $conf; |
28 | 29 | ||
@@ -46,7 +47,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase | |||
46 | */ | 47 | */ |
47 | public function setUp() | 48 | public function setUp() |
48 | { | 49 | { |
49 | $this->conf = new \ConfigManager('tests/utils/config/configJson.json.php'); | 50 | $this->conf = new ConfigManager('tests/utils/config/configJson.json.php'); |
50 | $this->refDB = new \ReferenceLinkDB(); | 51 | $this->refDB = new \ReferenceLinkDB(); |
51 | $this->refDB->write(self::$testDatastore); | 52 | $this->refDB->write(self::$testDatastore); |
52 | 53 | ||
@@ -84,7 +85,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase | |||
84 | $this->assertEquals('Shaarli', $data['settings']['title']); | 85 | $this->assertEquals('Shaarli', $data['settings']['title']); |
85 | $this->assertEquals('?', $data['settings']['header_link']); | 86 | $this->assertEquals('?', $data['settings']['header_link']); |
86 | $this->assertEquals('UTC', $data['settings']['timezone']); | 87 | $this->assertEquals('UTC', $data['settings']['timezone']); |
87 | $this->assertEquals(\ConfigManager::$DEFAULT_PLUGINS, $data['settings']['enabled_plugins']); | 88 | $this->assertEquals(ConfigManager::$DEFAULT_PLUGINS, $data['settings']['enabled_plugins']); |
88 | $this->assertEquals(false, $data['settings']['default_private_links']); | 89 | $this->assertEquals(false, $data['settings']['default_private_links']); |
89 | 90 | ||
90 | $title = 'My links'; | 91 | $title = 'My links'; |
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 | 2 | namespace Shaarli\Config; | |
3 | require_once 'application/config/ConfigJson.php'; | ||
4 | 3 | ||
5 | /** | 4 | /** |
6 | * Class ConfigJsonTest | 5 | * Class ConfigJsonTest |
7 | */ | 6 | */ |
8 | class ConfigJsonTest extends PHPUnit_Framework_TestCase | 7 | class 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 |
2 | namespace 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 | */ |
9 | class ConfigManagerTest extends PHPUnit_Framework_TestCase | 10 | class 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 | 2 | namespace Shaarli\Config; | |
3 | require_once 'application/config/ConfigPhp.php'; | ||
4 | 3 | ||
5 | /** | 4 | /** |
6 | * Class ConfigPhpTest | 5 | * Class ConfigPhpTest |
7 | */ | 6 | */ |
8 | class ConfigPhpTest extends PHPUnit_Framework_TestCase | 7 | class 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 |
2 | namespace 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 | */ |
11 | class ConfigPluginTest extends PHPUnit_Framework_TestCase | 13 | class 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 | { |
diff --git a/tests/plugins/PluginIssoTest.php b/tests/plugins/PluginIssoTest.php index 03def208..0ae73183 100644 --- a/tests/plugins/PluginIssoTest.php +++ b/tests/plugins/PluginIssoTest.php | |||
@@ -1,4 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | use Shaarli\Config\ConfigManager; | ||
2 | 3 | ||
3 | require_once 'plugins/isso/isso.php'; | 4 | require_once 'plugins/isso/isso.php'; |
4 | 5 | ||
diff --git a/tests/plugins/PluginMarkdownTest.php b/tests/plugins/PluginMarkdownTest.php index d4cd1b97..d8180ad6 100644 --- a/tests/plugins/PluginMarkdownTest.php +++ b/tests/plugins/PluginMarkdownTest.php | |||
@@ -1,4 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | use Shaarli\Config\ConfigManager; | ||
2 | 3 | ||
3 | /** | 4 | /** |
4 | * PluginMarkdownTest.php | 5 | * PluginMarkdownTest.php |
diff --git a/tests/plugins/PluginPubsubhubbubTest.php b/tests/plugins/PluginPubsubhubbubTest.php index 1bd87935..69d00936 100644 --- a/tests/plugins/PluginPubsubhubbubTest.php +++ b/tests/plugins/PluginPubsubhubbubTest.php | |||
@@ -1,4 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | use Shaarli\Config\ConfigManager; | ||
2 | 3 | ||
3 | require_once 'plugins/pubsubhubbub/pubsubhubbub.php'; | 4 | require_once 'plugins/pubsubhubbub/pubsubhubbub.php'; |
4 | require_once 'application/Router.php'; | 5 | require_once 'application/Router.php'; |
diff --git a/tests/plugins/PluginQrcodeTest.php b/tests/plugins/PluginQrcodeTest.php index 211ee89c..ebfadddf 100644 --- a/tests/plugins/PluginQrcodeTest.php +++ b/tests/plugins/PluginQrcodeTest.php | |||
@@ -1,5 +1,4 @@ | |||
1 | <?php | 1 | <?php |
2 | |||
3 | /** | 2 | /** |
4 | * PluginQrcodeTest.php | 3 | * PluginQrcodeTest.php |
5 | */ | 4 | */ |
diff --git a/tests/plugins/PluginReadityourselfTest.php b/tests/plugins/PluginReadityourselfTest.php index 30470ab7..bbba9676 100644 --- a/tests/plugins/PluginReadityourselfTest.php +++ b/tests/plugins/PluginReadityourselfTest.php | |||
@@ -1,4 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | use Shaarli\Config\ConfigManager; | ||
2 | 3 | ||
3 | /** | 4 | /** |
4 | * PluginReadityourselfTest.php.php | 5 | * PluginReadityourselfTest.php.php |
diff --git a/tests/plugins/PluginWallabagTest.php b/tests/plugins/PluginWallabagTest.php index 30351f46..76b7887e 100644 --- a/tests/plugins/PluginWallabagTest.php +++ b/tests/plugins/PluginWallabagTest.php | |||
@@ -1,4 +1,5 @@ | |||
1 | <?php | 1 | <?php |
2 | use Shaarli\Config\ConfigManager; | ||
2 | 3 | ||
3 | /** | 4 | /** |
4 | * PluginWallabagTest.php.php | 5 | * PluginWallabagTest.php.php |