diff options
author | VirtualTam <virtualtam+github@flibidi.net> | 2017-03-04 20:28:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-04 20:28:38 +0100 |
commit | 236239be752a7bb24547237b5751ac4fcbc0e549 (patch) | |
tree | 6e1c0130ea30bf218b9a131f58f7224b6defde3f /tests | |
parent | cc30d749ab17be2bf0b623a16f8fa78ecfd5b57d (diff) | |
parent | 3c66e56435359dc678048193e8ee239d06f79b64 (diff) | |
download | Shaarli-236239be752a7bb24547237b5751ac4fcbc0e549.tar.gz Shaarli-236239be752a7bb24547237b5751ac4fcbc0e549.tar.zst Shaarli-236239be752a7bb24547237b5751ac4fcbc0e549.zip |
Merge pull request #788 from virtualtam/application/namespace/config
application: introduce the Shaarli\Config namespace
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ApplicationUtilsTest.php | 3 | ||||
-rw-r--r-- | tests/PluginManagerTest.php | 1 | ||||
-rw-r--r-- | tests/Updater/UpdaterTest.php | 4 | ||||
-rw-r--r-- | tests/api/ApiMiddlewareTest.php | 5 | ||||
-rw-r--r-- | tests/api/controllers/GetLinkIdTest.php | 5 | ||||
-rw-r--r-- | tests/api/controllers/GetLinksTest.php | 6 | ||||
-rw-r--r-- | tests/api/controllers/InfoTest.php | 9 | ||||
-rw-r--r-- | tests/config/ConfigJsonTest.php | 11 | ||||
-rw-r--r-- | tests/config/ConfigManagerTest.php | 9 | ||||
-rw-r--r-- | tests/config/ConfigPhpTest.php | 5 | ||||
-rw-r--r-- | tests/config/ConfigPluginTest.php | 6 | ||||
-rw-r--r-- | tests/plugins/PluginIssoTest.php | 1 | ||||
-rw-r--r-- | tests/plugins/PluginMarkdownTest.php | 1 | ||||
-rw-r--r-- | tests/plugins/PluginPubsubhubbubTest.php | 1 | ||||
-rw-r--r-- | tests/plugins/PluginQrcodeTest.php | 1 | ||||
-rw-r--r-- | tests/plugins/PluginReadityourselfTest.php | 1 | ||||
-rw-r--r-- | tests/plugins/PluginWallabagTest.php | 1 |
17 files changed, 41 insertions, 29 deletions
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 |