From 3c66e56435359dc678048193e8ee239d06f79b64 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Fri, 3 Mar 2017 23:06:12 +0100 Subject: 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 --- tests/api/ApiMiddlewareTest.php | 5 +++-- tests/api/controllers/GetLinkIdTest.php | 5 +++-- tests/api/controllers/GetLinksTest.php | 6 +++--- tests/api/controllers/InfoTest.php | 9 +++++---- 4 files changed, 14 insertions(+), 11 deletions(-) (limited to 'tests/api') 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 @@ conf = new \ConfigManager('tests/utils/config/configJson.json.php'); + $this->conf = new ConfigManager('tests/utils/config/configJson.json.php'); $this->conf->set('api.secret', 'NapoleonWasALizard'); $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 @@ namespace Shaarli\Api\Controllers; +use Shaarli\Config\ConfigManager; use Slim\Container; use Slim\Http\Environment; @@ -25,7 +26,7 @@ class GetLinkIdTest extends \PHPUnit_Framework_TestCase protected static $testDatastore = 'sandbox/datastore.php'; /** - * @var \ConfigManager instance + * @var ConfigManager instance */ protected $conf; @@ -54,7 +55,7 @@ class GetLinkIdTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $this->conf = new \ConfigManager('tests/utils/config/configJson'); + $this->conf = new ConfigManager('tests/utils/config/configJson'); $this->refDB = new \ReferenceLinkDB(); $this->refDB->write(self::$testDatastore); 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 @@ conf = new \ConfigManager('tests/utils/config/configJson'); + $this->conf = new ConfigManager('tests/utils/config/configJson'); $this->refDB = new \ReferenceLinkDB(); $this->refDB->write(self::$testDatastore); 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 @@ conf = new \ConfigManager('tests/utils/config/configJson.json.php'); + $this->conf = new ConfigManager('tests/utils/config/configJson.json.php'); $this->refDB = new \ReferenceLinkDB(); $this->refDB->write(self::$testDatastore); @@ -84,7 +85,7 @@ class InfoTest extends \PHPUnit_Framework_TestCase $this->assertEquals('Shaarli', $data['settings']['title']); $this->assertEquals('?', $data['settings']['header_link']); $this->assertEquals('UTC', $data['settings']['timezone']); - $this->assertEquals(\ConfigManager::$DEFAULT_PLUGINS, $data['settings']['enabled_plugins']); + $this->assertEquals(ConfigManager::$DEFAULT_PLUGINS, $data['settings']['enabled_plugins']); $this->assertEquals(false, $data['settings']['default_private_links']); $title = 'My links'; -- cgit v1.2.3