aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/api/controllers
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/api/controllers
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/api/controllers')
-rw-r--r--tests/api/controllers/GetLinkIdTest.php5
-rw-r--r--tests/api/controllers/GetLinksTest.php6
-rw-r--r--tests/api/controllers/InfoTest.php9
3 files changed, 11 insertions, 9 deletions
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
3namespace Shaarli\Api\Controllers; 3namespace Shaarli\Api\Controllers;
4 4
5use Shaarli\Config\ConfigManager;
5 6
6use Slim\Container; 7use Slim\Container;
7use Slim\Http\Environment; 8use 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
3namespace Shaarli\Api\Controllers; 2namespace Shaarli\Api\Controllers;
4 3
4use Shaarli\Config\ConfigManager;
5 5
6use Slim\Container; 6use Slim\Container;
7use Slim\Http\Environment; 7use 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
3namespace Shaarli\Api\Controllers; 2namespace Shaarli\Api\Controllers;
4 3
4use Shaarli\Config\ConfigManager;
5
5use Slim\Container; 6use Slim\Container;
6use Slim\Http\Environment; 7use Slim\Http\Environment;
7use Slim\Http\Request; 8use 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';