]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Optimize and cleanup imports 1248/head
authorVirtualTam <virtualtam@flibidi.net>
Sat, 12 Jan 2019 22:55:38 +0000 (23:55 +0100)
committerVirtualTam <virtualtam@flibidi.net>
Sat, 12 Jan 2019 23:04:42 +0000 (00:04 +0100)
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
41 files changed:
application/Languages.php
application/Thumbnailer.php
application/api/ApiMiddleware.php
application/api/ApiUtils.php
application/api/controllers/ApiController.php
application/api/controllers/HistoryController.php [moved from application/api/controllers/History.php with 97% similarity]
application/api/controllers/Tags.php
application/api/exceptions/ApiLinkNotFoundException.php
application/api/exceptions/ApiTagNotFoundException.php
application/bookmark/LinkDB.php
application/feed/FeedBuilder.php
application/netscape/NetscapeBookmarkUtils.php
application/render/PageBuilder.php
application/updater/Updater.php
tests/LanguagesTest.php
tests/TimeZoneTest.php
tests/UtilsTest.php
tests/api/ApiMiddlewareTest.php
tests/api/ApiUtilsTest.php
tests/api/controllers/history/HistoryTest.php
tests/api/controllers/info/InfoTest.php
tests/api/controllers/links/DeleteLinkTest.php
tests/api/controllers/links/GetLinkIdTest.php
tests/api/controllers/links/GetLinksTest.php
tests/api/controllers/links/PostLinkTest.php
tests/api/controllers/links/PutLinkTest.php
tests/api/controllers/tags/DeleteTagTest.php
tests/api/controllers/tags/GetTagNameTest.php
tests/api/controllers/tags/GetTagsTest.php
tests/api/controllers/tags/PutTagTest.php
tests/bookmark/LinkDBTest.php
tests/config/ConfigJsonTest.php
tests/config/ConfigManagerTest.php
tests/config/ConfigPhpTest.php
tests/config/ConfigPluginTest.php
tests/feed/FeedBuilderTest.php
tests/languages/fr/LanguagesFrTest.php
tests/plugins/WallabagInstanceTest.php
tests/render/ThemeUtilsTest.php
tests/security/LoginManagerTest.php
tests/security/SessionManagerTest.php

index b9c5d0e8c3cbf627a590516d448ab9c85343a4fb..5cda802e0c1faaf57058e0dca653cc713c90c0c3 100644 (file)
@@ -3,7 +3,6 @@
 namespace Shaarli;
 
 use Gettext\GettextTranslator;
-use Gettext\Merge;
 use Gettext\Translations;
 use Gettext\Translator;
 use Gettext\TranslatorInterface;
index 37ed97a18bf521f6b6e66b0bc4e32a5083a8f01d..a23f98e9df226204efeb5166bc5e3bbab4f348c9 100644 (file)
@@ -3,9 +3,9 @@
 namespace Shaarli;
 
 use Shaarli\Config\ConfigManager;
+use WebThumbnailer\Application\ConfigManager as WTConfigManager;
 use WebThumbnailer\Exception\WebThumbnailerException;
 use WebThumbnailer\WebThumbnailer;
-use WebThumbnailer\Application\ConfigManager as WTConfigManager;
 
 /**
  * Class Thumbnailer
index a2101f29fca7f1d0a6c0823c8bd6a133f6997643..5ffb8c6d06653fc527df1caca85d58004d41def8 100644 (file)
@@ -1,9 +1,8 @@
 <?php
 namespace Shaarli\Api;
 
-use Shaarli\Api\Exceptions\ApiException;
 use Shaarli\Api\Exceptions\ApiAuthorizationException;
-
+use Shaarli\Api\Exceptions\ApiException;
 use Shaarli\Config\ConfigManager;
 use Slim\Container;
 use Slim\Http\Request;
index e51b73e187014b9663fd22d4c46587783181eb39..1824b5d08171f19c27ebb28d3831eacbfc040538 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 namespace Shaarli\Api;
 
-use Shaarli\Http\Base64Url;
 use Shaarli\Api\Exceptions\ApiAuthorizationException;
+use Shaarli\Http\Base64Url;
 
 /**
  * REST API utilities
index cab97dc42c5bb32bb3f72d9edb8eacb182d9ab0b..a6e7cbab23565007a71f85ac2338f54a930bae6f 100644 (file)
@@ -2,8 +2,9 @@
 
 namespace Shaarli\Api\Controllers;
 
+use Shaarli\Bookmark\LinkDB;
 use Shaarli\Config\ConfigManager;
-use \Slim\Container;
+use Slim\Container;
 
 /**
  * Abstract Class ApiController
@@ -25,12 +26,12 @@ abstract class ApiController
     protected $conf;
 
     /**
-     * @var \Shaarli\Bookmark\LinkDB
+     * @var LinkDB
      */
     protected $linkDb;
 
     /**
-     * @var \Shaarli\History
+     * @var HistoryController
      */
     protected $history;
 
similarity index 97%
rename from application/api/controllers/History.php
rename to application/api/controllers/HistoryController.php
index 4582e8b27f8597a1a03c482161c58a1febf7706d..9afcfa264430cd7af5910357bfcd07fbea797301 100644 (file)
@@ -14,7 +14,7 @@ use Slim\Http\Response;
  *
  * @package Shaarli\Api\Controllers
  */
-class History extends ApiController
+class HistoryController extends ApiController
 {
     /**
      * Service providing operation regarding Shaarli datastore and settings.
index 6dd78750f37240e21fc437f1a410a171cd1020cf..82f3ef746dde8cd88ead34ac02c02f0b037e696e 100644 (file)
@@ -4,7 +4,6 @@ namespace Shaarli\Api\Controllers;
 
 use Shaarli\Api\ApiUtils;
 use Shaarli\Api\Exceptions\ApiBadParametersException;
-use Shaarli\Api\Exceptions\ApiLinkNotFoundException;
 use Shaarli\Api\Exceptions\ApiTagNotFoundException;
 use Slim\Http\Request;
 use Slim\Http\Response;
index c727f4f0c9eec47e2fad40849b1fb418ef4b9adf..7c2bb56ed781b3a2b76e0a66b688b384e706ee2c 100644 (file)
@@ -2,8 +2,6 @@
 
 namespace Shaarli\Api\Exceptions;
 
-use Slim\Http\Response;
-
 /**
  * Class ApiLinkNotFoundException
  *
index eee152fe273375d3b5bd765f198552e363e21ee8..66ace8bfa51c5ea8906f57fb8bd9c905e143f84b 100644 (file)
@@ -2,8 +2,6 @@
 
 namespace Shaarli\Api\Exceptions;
 
-use Slim\Http\Response;
-
 /**
  * Class ApiTagNotFoundException
  *
index 6041c0884fec8547d430e38e3f432521083e08f4..c13a11417b5fb66af9a7df5597ad2f2a09298936 100644 (file)
@@ -6,7 +6,6 @@ use ArrayAccess;
 use Countable;
 use DateTime;
 use Iterator;
-use Shaarli\Bookmark\LinkFilter;
 use Shaarli\Bookmark\Exception\LinkNotFoundException;
 use Shaarli\Exceptions\IOException;
 use Shaarli\FileUtils;
index 737a31289b2500ae3cad55307ed1fdcf1202ab63..b66f2f918edd494f1d11090892fbcfda7d073e59 100644 (file)
@@ -2,7 +2,6 @@
 namespace Shaarli\Feed;
 
 use DateTime;
-use Shaarli\Bookmark\LinkDB;
 
 /**
  * FeedBuilder class.
index 2bf928c2084da0cd286363439fe4ab281d100163..2fb1a4a6943674c557188e28bb5df206867f3857 100644 (file)
@@ -5,12 +5,12 @@ namespace Shaarli\Netscape;
 use DateTime;
 use DateTimeZone;
 use Exception;
+use Katzgrau\KLogger\Logger;
 use Psr\Log\LogLevel;
 use Shaarli\Bookmark\LinkDB;
 use Shaarli\Config\ConfigManager;
 use Shaarli\History;
 use Shaarli\NetscapeBookmarkParser\NetscapeBookmarkParser;
-use Katzgrau\KLogger\Logger;
 
 /**
  * Utilities to import and export bookmarks using the Netscape format
index 1c5b9251162a40b16db3ddb9a7b87f4b4144de4b..0569b67f93e4ded88780e1d52ee2c22a4e2054e1 100644 (file)
@@ -2,10 +2,10 @@
 
 namespace Shaarli\Render;
 
-use Shaarli\ApplicationUtils;
 use Exception;
-use Shaarli\Bookmark\LinkDB;
 use RainTPL;
+use Shaarli\ApplicationUtils;
+use Shaarli\Bookmark\LinkDB;
 use Shaarli\Config\ConfigManager;
 use Shaarli\Thumbnailer;
 
index 89f0ff7f18cc46b4316dd74d24d3e16314f4a693..f12e351673640ddff963981d1232543a4f17979a 100644 (file)
@@ -2,12 +2,12 @@
 
 namespace Shaarli\Updater;
 
-use Shaarli\ApplicationUtils;
 use Exception;
 use RainTPL;
 use ReflectionClass;
 use ReflectionException;
 use ReflectionMethod;
+use Shaarli\ApplicationUtils;
 use Shaarli\Bookmark\LinkDB;
 use Shaarli\Bookmark\LinkFilter;
 use Shaarli\Config\ConfigJson;
index 4951e09a3e2f31261ca9b119d700fb817a3e860f..de83f2913707aef08f52ff08474186e38210c9a8 100644 (file)
@@ -7,7 +7,7 @@ use Shaarli\Config\ConfigManager;
 /**
  * Class LanguagesTest.
  */
-class LanguagesTest extends \PHPUnit_Framework_TestCase
+class LanguagesTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string Config file path (without extension).
index 127fdc192ccab36ec57427ba270f444f9108b29f..02bf060f34a0a7a1be177b2ab96d10316c73b869 100644 (file)
@@ -8,7 +8,7 @@ require_once 'application/TimeZone.php';
 /**
  * Unitary tests for timezone utilities
  */
-class TimeZoneTest extends PHPUnit_Framework_TestCase
+class TimeZoneTest extends PHPUnit\Framework\TestCase
 {
     /**
      * @var array of timezones
index d0abd9968cfdc4afa152db87682b00ae4d5d73e5..8225d95ae067d3c5db9fb4a352860bb341c8b961 100644 (file)
@@ -10,7 +10,7 @@ require_once 'application/Languages.php';
 /**
  * Unitary tests for Shaarli utilities
  */
-class UtilsTest extends PHPUnit_Framework_TestCase
+class UtilsTest extends PHPUnit\Framework\TestCase
 {
     // Log file
     protected static $testLogFile = 'tests.log';
index 23a56b1cee4e78e90aec15941fb4b3927242b32e..0b9b03f28ec7c0d824e23484395d60dd867f06a4 100644 (file)
@@ -2,7 +2,6 @@
 namespace Shaarli\Api;
 
 use Shaarli\Config\ConfigManager;
-
 use Slim\Container;
 use Slim\Http\Environment;
 use Slim\Http\Request;
@@ -18,7 +17,7 @@ use Slim\Http\Response;
  *
  * @package Api
  */
-class ApiMiddlewareTest extends \PHPUnit_Framework_TestCase
+class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string datastore to test write operations
index a1b623d897c46ade83125e5f6a332a77a43ab607..ea0ae50087d04ee5ac89c9a681f97f6676c88979 100644 (file)
@@ -7,7 +7,7 @@ use Shaarli\Http\Base64Url;
 /**
  * Class ApiUtilsTest
  */
-class ApiUtilsTest extends \PHPUnit_Framework_TestCase
+class ApiUtilsTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * Force the timezone for ISO datetimes.
index 24efee89baf5d4f2e60786ef842ea8e00448a45f..e287f239eea24fe746ccf894f1b464c3769206de 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 
-
 namespace Shaarli\Api\Controllers;
 
 use Shaarli\Config\ConfigManager;
+use Shaarli\History;
 use Slim\Container;
 use Slim\Http\Environment;
 use Slim\Http\Request;
@@ -11,7 +11,7 @@ use Slim\Http\Response;
 
 require_once 'tests/utils/ReferenceHistory.php';
 
-class HistoryTest extends \PHPUnit_Framework_TestCase
+class HistoryTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string datastore to test write operations
@@ -34,7 +34,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
     protected $container;
 
     /**
-     * @var History controller instance.
+     * @var HistoryController controller instance.
      */
     protected $controller;
 
@@ -49,9 +49,9 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
         $this->container = new Container();
         $this->container['conf'] = $this->conf;
         $this->container['db'] = true;
-        $this->container['history'] = new \Shaarli\History(self::$testHistory);
+        $this->container['history'] = new History(self::$testHistory);
 
-        $this->controller = new History($this->container);
+        $this->controller = new HistoryController($this->container);
     }
 
     /**
@@ -78,35 +78,35 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
 
         $this->assertEquals($this->refHistory->count(), count($data));
 
-        $this->assertEquals(\Shaarli\History::DELETED, $data[0]['event']);
+        $this->assertEquals(History::DELETED, $data[0]['event']);
         $this->assertEquals(
             \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM),
             $data[0]['datetime']
         );
         $this->assertEquals(124, $data[0]['id']);
 
-        $this->assertEquals(\Shaarli\History::SETTINGS, $data[1]['event']);
+        $this->assertEquals(History::SETTINGS, $data[1]['event']);
         $this->assertEquals(
             \DateTime::createFromFormat('Ymd_His', '20170302_121215')->format(\DateTime::ATOM),
             $data[1]['datetime']
         );
         $this->assertNull($data[1]['id']);
 
-        $this->assertEquals(\Shaarli\History::UPDATED, $data[2]['event']);
+        $this->assertEquals(History::UPDATED, $data[2]['event']);
         $this->assertEquals(
             \DateTime::createFromFormat('Ymd_His', '20170301_121214')->format(\DateTime::ATOM),
             $data[2]['datetime']
         );
         $this->assertEquals(123, $data[2]['id']);
 
-        $this->assertEquals(\Shaarli\History::CREATED, $data[3]['event']);
+        $this->assertEquals(History::CREATED, $data[3]['event']);
         $this->assertEquals(
             \DateTime::createFromFormat('Ymd_His', '20170201_121214')->format(\DateTime::ATOM),
             $data[3]['datetime']
         );
         $this->assertEquals(124, $data[3]['id']);
 
-        $this->assertEquals(\Shaarli\History::CREATED, $data[4]['event']);
+        $this->assertEquals(History::CREATED, $data[4]['event']);
         $this->assertEquals(
             \DateTime::createFromFormat('Ymd_His', '20170101_121212')->format(\DateTime::ATOM),
             $data[4]['datetime']
@@ -131,7 +131,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
 
         $this->assertEquals(1, count($data));
 
-        $this->assertEquals(\Shaarli\History::DELETED, $data[0]['event']);
+        $this->assertEquals(History::DELETED, $data[0]['event']);
         $this->assertEquals(
             \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM),
             $data[0]['datetime']
@@ -156,7 +156,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
 
         $this->assertEquals(1, count($data));
 
-        $this->assertEquals(\Shaarli\History::CREATED, $data[0]['event']);
+        $this->assertEquals(History::CREATED, $data[0]['event']);
         $this->assertEquals(
             \DateTime::createFromFormat('Ymd_His', '20170101_121212')->format(\DateTime::ATOM),
             $data[0]['datetime']
@@ -181,7 +181,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
 
         $this->assertEquals(1, count($data));
 
-        $this->assertEquals(\Shaarli\History::DELETED, $data[0]['event']);
+        $this->assertEquals(History::DELETED, $data[0]['event']);
         $this->assertEquals(
             \DateTime::createFromFormat('Ymd_His', '20170303_121216')->format(\DateTime::ATOM),
             $data[0]['datetime']
@@ -206,7 +206,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
 
         $this->assertEquals(1, count($data));
 
-        $this->assertEquals(\Shaarli\History::SETTINGS, $data[0]['event']);
+        $this->assertEquals(History::SETTINGS, $data[0]['event']);
         $this->assertEquals(
             \DateTime::createFromFormat('Ymd_His', '20170302_121215')->format(\DateTime::ATOM),
             $data[0]['datetime']
index 44a9382e847381196d52e5c28393ba056760907e..e70d371bf7ae650364444c0318b0ca7ddeb75d6d 100644 (file)
@@ -2,7 +2,6 @@
 namespace Shaarli\Api\Controllers;
 
 use Shaarli\Config\ConfigManager;
-
 use Slim\Container;
 use Slim\Http\Environment;
 use Slim\Http\Request;
@@ -15,7 +14,7 @@ use Slim\Http\Response;
  *
  * @package Api\Controllers
  */
-class InfoTest extends \PHPUnit_Framework_TestCase
+class InfoTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string datastore to test write operations
index adca9a4e71ea7df4c1a60b771678a776533aa35b..90193e289ab95bf453c35de9af63250d3ea7800f 100644 (file)
@@ -3,13 +3,15 @@
 
 namespace Shaarli\Api\Controllers;
 
+use Shaarli\Bookmark\LinkDB;
 use Shaarli\Config\ConfigManager;
+use Shaarli\History;
 use Slim\Container;
 use Slim\Http\Environment;
 use Slim\Http\Request;
 use Slim\Http\Response;
 
-class DeleteLinkTest extends \PHPUnit_Framework_TestCase
+class DeleteLinkTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string datastore to test write operations
@@ -32,12 +34,12 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase
     protected $refDB = null;
 
     /**
-     * @var \Shaarli\Bookmark\LinkDB instance.
+     * @var LinkDB instance.
      */
     protected $linkDB;
 
     /**
-     * @var \Shaarli\History instance.
+     * @var HistoryController instance.
      */
     protected $history;
 
@@ -59,10 +61,10 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase
         $this->conf = new ConfigManager('tests/utils/config/configJson');
         $this->refDB = new \ReferenceLinkDB();
         $this->refDB->write(self::$testDatastore);
-        $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false);
+        $this->linkDB = new LinkDB(self::$testDatastore, true, false);
         $refHistory = new \ReferenceHistory();
         $refHistory->write(self::$testHistory);
-        $this->history = new \Shaarli\History(self::$testHistory);
+        $this->history = new History(self::$testHistory);
         $this->container = new Container();
         $this->container['conf'] = $this->conf;
         $this->container['db'] = $this->linkDB;
@@ -96,11 +98,11 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(204, $response->getStatusCode());
         $this->assertEmpty((string) $response->getBody());
 
-        $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false);
+        $this->linkDB = new LinkDB(self::$testDatastore, true, false);
         $this->assertFalse(isset($this->linkDB[$id]));
 
         $historyEntry = $this->history->getHistory()[0];
-        $this->assertEquals(\Shaarli\History::DELETED, $historyEntry['event']);
+        $this->assertEquals(History::DELETED, $historyEntry['event']);
         $this->assertTrue(
             (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
         );
@@ -110,7 +112,7 @@ class DeleteLinkTest extends \PHPUnit_Framework_TestCase
     /**
      * Test DELETE link endpoint: reach not existing ID.
      *
-     * @expectedException Shaarli\Api\Exceptions\ApiLinkNotFoundException
+     * @expectedException \Shaarli\Api\Exceptions\ApiLinkNotFoundException
      */
     public function testDeleteLink404()
     {
index bf58000b46138d51f34eb22b3ccec94e8982814d..cb9b7f6a84afbc8cb87b0cc8cf3592474084fcc8 100644 (file)
@@ -3,7 +3,6 @@
 namespace Shaarli\Api\Controllers;
 
 use Shaarli\Config\ConfigManager;
-
 use Slim\Container;
 use Slim\Http\Environment;
 use Slim\Http\Request;
@@ -18,7 +17,7 @@ use Slim\Http\Response;
  *
  * @package Shaarli\Api\Controllers
  */
-class GetLinkIdTest extends \PHPUnit_Framework_TestCase
+class GetLinkIdTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string datastore to test write operations
index 1008d7b2e941138675bff4fb93227b0dd19d0b0e..711a315221b84d85d5829413866caa2411d5de1b 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 namespace Shaarli\Api\Controllers;
 
+use Shaarli\Bookmark\LinkDB;
 use Shaarli\Config\ConfigManager;
-
 use Slim\Container;
 use Slim\Http\Environment;
 use Slim\Http\Request;
@@ -17,7 +17,7 @@ use Slim\Http\Response;
  *
  * @package Shaarli\Api\Controllers
  */
-class GetLinksTest extends \PHPUnit_Framework_TestCase
+class GetLinksTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string datastore to test write operations
@@ -60,7 +60,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase
 
         $this->container = new Container();
         $this->container['conf'] = $this->conf;
-        $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false);
+        $this->container['db'] = new LinkDB(self::$testDatastore, true, false);
         $this->container['history'] = null;
 
         $this->controller = new Links($this->container);
@@ -114,7 +114,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('sTuff', $first['tags'][0]);
         $this->assertEquals(false, $first['private']);
         $this->assertEquals(
-            \DateTime::createFromFormat(\Shaarli\Bookmark\LinkDB::LINK_DATE_FORMAT, '20150310_114651')->format(\DateTime::ATOM),
+            \DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651')->format(\DateTime::ATOM),
             $first['created']
         );
         $this->assertEmpty($first['updated']);
@@ -125,7 +125,7 @@ class GetLinksTest extends \PHPUnit_Framework_TestCase
 
         // Update date
         $this->assertEquals(
-            \DateTime::createFromFormat(\Shaarli\Bookmark\LinkDB::LINK_DATE_FORMAT, '20160803_093033')->format(\DateTime::ATOM),
+            \DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160803_093033')->format(\DateTime::ATOM),
             $link['updated']
         );
     }
index 24e591db9a4d20962aaabdf184f56b691dd49b3a..d683a98429c05a882d42998a287f9e98cf4c4ff7 100644 (file)
@@ -4,6 +4,7 @@ namespace Shaarli\Api\Controllers;
 
 use PHPUnit\Framework\TestCase;
 use Shaarli\Config\ConfigManager;
+use Shaarli\History;
 use Slim\Container;
 use Slim\Http\Environment;
 use Slim\Http\Request;
@@ -40,7 +41,7 @@ class PostLinkTest extends TestCase
     protected $refDB = null;
 
     /**
-     * @var \Shaarli\History instance.
+     * @var HistoryController instance.
      */
     protected $history;
 
@@ -70,12 +71,12 @@ class PostLinkTest extends TestCase
 
         $refHistory = new \ReferenceHistory();
         $refHistory->write(self::$testHistory);
-        $this->history = new \Shaarli\History(self::$testHistory);
+        $this->history = new History(self::$testHistory);
 
         $this->container = new Container();
         $this->container['conf'] = $this->conf;
         $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false);
-        $this->container['history'] = new \Shaarli\History(self::$testHistory);
+        $this->container['history'] = new History(self::$testHistory);
 
         $this->controller = new Links($this->container);
 
@@ -133,7 +134,7 @@ class PostLinkTest extends TestCase
         $this->assertEquals('', $data['updated']);
 
         $historyEntry = $this->history->getHistory()[0];
-        $this->assertEquals(\Shaarli\History::CREATED, $historyEntry['event']);
+        $this->assertEquals(History::CREATED, $historyEntry['event']);
         $this->assertTrue(
             (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
         );
index eb6c7955c83065f5b44f3a824779090882a81a1e..cd815b667be954b99719e7a2c0e9b7fab1661a9c 100644 (file)
@@ -4,12 +4,13 @@
 namespace Shaarli\Api\Controllers;
 
 use Shaarli\Config\ConfigManager;
+use Shaarli\History;
 use Slim\Container;
 use Slim\Http\Environment;
 use Slim\Http\Request;
 use Slim\Http\Response;
 
-class PutLinkTest extends \PHPUnit_Framework_TestCase
+class PutLinkTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string datastore to test write operations
@@ -32,7 +33,7 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase
     protected $refDB = null;
 
     /**
-     * @var \Shaarli\History instance.
+     * @var HistoryController instance.
      */
     protected $history;
 
@@ -62,12 +63,12 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase
 
         $refHistory = new \ReferenceHistory();
         $refHistory->write(self::$testHistory);
-        $this->history = new \Shaarli\History(self::$testHistory);
+        $this->history = new History(self::$testHistory);
 
         $this->container = new Container();
         $this->container['conf'] = $this->conf;
         $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false);
-        $this->container['history'] = new \Shaarli\History(self::$testHistory);
+        $this->container['history'] = new History(self::$testHistory);
 
         $this->controller = new Links($this->container);
 
@@ -119,7 +120,7 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase
         );
 
         $historyEntry = $this->history->getHistory()[0];
-        $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']);
+        $this->assertEquals(History::UPDATED, $historyEntry['event']);
         $this->assertTrue(
             (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
         );
index 02803ba2c9456173da1f376586e6a96e329d4ec4..84e1d56ecd279d4e45eb137f57e4777108480df8 100644 (file)
@@ -3,13 +3,15 @@
 
 namespace Shaarli\Api\Controllers;
 
+use Shaarli\Bookmark\LinkDB;
 use Shaarli\Config\ConfigManager;
+use Shaarli\History;
 use Slim\Container;
 use Slim\Http\Environment;
 use Slim\Http\Request;
 use Slim\Http\Response;
 
-class DeleteTagTest extends \PHPUnit_Framework_TestCase
+class DeleteTagTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string datastore to test write operations
@@ -32,12 +34,12 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase
     protected $refDB = null;
 
     /**
-     * @var \Shaarli\Bookmark\LinkDB instance.
+     * @var LinkDB instance.
      */
     protected $linkDB;
 
     /**
-     * @var \Shaarli\History instance.
+     * @var HistoryController instance.
      */
     protected $history;
 
@@ -59,10 +61,10 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase
         $this->conf = new ConfigManager('tests/utils/config/configJson');
         $this->refDB = new \ReferenceLinkDB();
         $this->refDB->write(self::$testDatastore);
-        $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false);
+        $this->linkDB = new LinkDB(self::$testDatastore, true, false);
         $refHistory = new \ReferenceHistory();
         $refHistory->write(self::$testHistory);
-        $this->history = new \Shaarli\History(self::$testHistory);
+        $this->history = new History(self::$testHistory);
         $this->container = new Container();
         $this->container['conf'] = $this->conf;
         $this->container['db'] = $this->linkDB;
@@ -97,18 +99,18 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(204, $response->getStatusCode());
         $this->assertEmpty((string) $response->getBody());
 
-        $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false);
+        $this->linkDB = new LinkDB(self::$testDatastore, true, false);
         $tags = $this->linkDB->linksCountPerTag();
         $this->assertFalse(isset($tags[$tagName]));
 
         // 2 links affected
         $historyEntry = $this->history->getHistory()[0];
-        $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']);
+        $this->assertEquals(History::UPDATED, $historyEntry['event']);
         $this->assertTrue(
             (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
         );
         $historyEntry = $this->history->getHistory()[1];
-        $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']);
+        $this->assertEquals(History::UPDATED, $historyEntry['event']);
         $this->assertTrue(
             (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
         );
@@ -131,13 +133,13 @@ class DeleteTagTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(204, $response->getStatusCode());
         $this->assertEmpty((string) $response->getBody());
 
-        $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false);
+        $this->linkDB = new LinkDB(self::$testDatastore, true, false);
         $tags = $this->linkDB->linksCountPerTag();
         $this->assertFalse(isset($tags[$tagName]));
         $this->assertTrue($tags[strtolower($tagName)] > 0);
 
         $historyEntry = $this->history->getHistory()[0];
-        $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']);
+        $this->assertEquals(History::UPDATED, $historyEntry['event']);
         $this->assertTrue(
             (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
         );
index 8e0feccd32a271ef01580159a5e26e3d9d4b6056..a2525c177b63967aadb8c1b7b6255b4fcf585814 100644 (file)
@@ -2,8 +2,8 @@
 
 namespace Shaarli\Api\Controllers;
 
+use Shaarli\Bookmark\LinkDB;
 use Shaarli\Config\ConfigManager;
-
 use Slim\Container;
 use Slim\Http\Environment;
 use Slim\Http\Request;
@@ -16,7 +16,7 @@ use Slim\Http\Response;
  *
  * @package Shaarli\Api\Controllers
  */
-class GetTagNameTest extends \PHPUnit_Framework_TestCase
+class GetTagNameTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string datastore to test write operations
@@ -59,7 +59,7 @@ class GetTagNameTest extends \PHPUnit_Framework_TestCase
 
         $this->container = new Container();
         $this->container['conf'] = $this->conf;
-        $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false);
+        $this->container['db'] = new LinkDB(self::$testDatastore, true, false);
         $this->container['history'] = null;
 
         $this->controller = new Tags($this->container);
index f071bfa8fded76998d91ab0e972f7380b29af922..98628c984f0fa9e12f2da7f7865bb6eb70155d3f 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 namespace Shaarli\Api\Controllers;
 
+use Shaarli\Bookmark\LinkDB;
 use Shaarli\Config\ConfigManager;
-
 use Slim\Container;
 use Slim\Http\Environment;
 use Slim\Http\Request;
@@ -15,7 +15,7 @@ use Slim\Http\Response;
  *
  * @package Shaarli\Api\Controllers
  */
-class GetTagsTest extends \PHPUnit_Framework_TestCase
+class GetTagsTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string datastore to test write operations
@@ -38,7 +38,7 @@ class GetTagsTest extends \PHPUnit_Framework_TestCase
     protected $container;
 
     /**
-     * @var \Shaarli\Bookmark\LinkDB instance.
+     * @var LinkDB instance.
      */
     protected $linkDB;
 
@@ -63,7 +63,7 @@ class GetTagsTest extends \PHPUnit_Framework_TestCase
 
         $this->container = new Container();
         $this->container['conf'] = $this->conf;
-        $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false);
+        $this->linkDB = new LinkDB(self::$testDatastore, true, false);
         $this->container['db'] = $this->linkDB;
         $this->container['history'] = null;
 
index d8c0fec86fe5b7c120e57b00a18c519a274baeee..86106fc7eaec629b8739a14d87ee42dea8ca90ed 100644 (file)
@@ -1,16 +1,17 @@
 <?php
 
-
 namespace Shaarli\Api\Controllers;
 
 use Shaarli\Api\Exceptions\ApiBadParametersException;
+use Shaarli\Bookmark\LinkDB;
 use Shaarli\Config\ConfigManager;
+use Shaarli\History;
 use Slim\Container;
 use Slim\Http\Environment;
 use Slim\Http\Request;
 use Slim\Http\Response;
 
-class PutTagTest extends \PHPUnit_Framework_TestCase
+class PutTagTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string datastore to test write operations
@@ -33,7 +34,7 @@ class PutTagTest extends \PHPUnit_Framework_TestCase
     protected $refDB = null;
 
     /**
-     * @var \Shaarli\History instance.
+     * @var HistoryController instance.
      */
     protected $history;
 
@@ -43,7 +44,7 @@ class PutTagTest extends \PHPUnit_Framework_TestCase
     protected $container;
 
     /**
-     * @var \Shaarli\Bookmark\LinkDB instance.
+     * @var LinkDB instance.
      */
     protected $linkDB;
 
@@ -68,11 +69,11 @@ class PutTagTest extends \PHPUnit_Framework_TestCase
 
         $refHistory = new \ReferenceHistory();
         $refHistory->write(self::$testHistory);
-        $this->history = new \Shaarli\History(self::$testHistory);
+        $this->history = new History(self::$testHistory);
 
         $this->container = new Container();
         $this->container['conf'] = $this->conf;
-        $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false);
+        $this->linkDB = new LinkDB(self::$testDatastore, true, false);
         $this->container['db'] = $this->linkDB;
         $this->container['history'] = $this->history;
 
@@ -113,12 +114,12 @@ class PutTagTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(2, $tags[$newName]);
 
         $historyEntry = $this->history->getHistory()[0];
-        $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']);
+        $this->assertEquals(History::UPDATED, $historyEntry['event']);
         $this->assertTrue(
             (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
         );
         $historyEntry = $this->history->getHistory()[1];
-        $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']);
+        $this->assertEquals(History::UPDATED, $historyEntry['event']);
         $this->assertTrue(
             (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
         );
index 65409e956b3f38afb826914c109f6f3f44a8a42e..ff5c0b970af1e8283d71e68606c3337e3d4c5936 100644 (file)
@@ -6,7 +6,6 @@
 namespace Shaarli\Bookmark;
 
 use DateTime;
-use Shaarli\Bookmark\Exception\LinkNotFoundException;
 use ReferenceLinkDB;
 use ReflectionClass;
 use Shaarli;
index 99c1ea569c00deb9b6c8bb49898b03517171623d..95ad060b0537fed84ca2bd2cc43a6f92098ee1b4 100644 (file)
@@ -4,7 +4,7 @@ namespace Shaarli\Config;
 /**
  * Class ConfigJsonTest
  */
-class ConfigJsonTest extends \PHPUnit_Framework_TestCase
+class ConfigJsonTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var ConfigJson
index 4a4e94ac551f135cca96d81a7f08672c43bae7ef..33830bc94bcc3584380b1a18259e4cf9ec101980 100644 (file)
@@ -7,7 +7,7 @@ namespace Shaarli\Config;
  * Note: it only test the manager with ConfigJson,
  *  ConfigPhp is only a workaround to handle the transition to JSON type.
  */
-class ConfigManagerTest extends \PHPUnit_Framework_TestCase
+class ConfigManagerTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var ConfigManager
index be23eea1563a909ecce1a981d1194040d8d9fe3a..67d878cee31cc88a61cf0cad4b92eb8d08e2b044 100644 (file)
@@ -4,7 +4,7 @@ namespace Shaarli\Config;
 /**
  * Class ConfigPhpTest
  */
-class ConfigPhpTest extends \PHPUnit_Framework_TestCase
+class ConfigPhpTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var ConfigPhp
index deb02c9e487f901519b07b66f545599aaed75692..d7a70e6886b54a889eed845560350eae05cefabe 100644 (file)
@@ -8,7 +8,7 @@ require_once 'application/config/ConfigPlugin.php';
 /**
  * Unitary tests for Shaarli config related functions
  */
-class ConfigPluginTest extends \PHPUnit_Framework_TestCase
+class ConfigPluginTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * Test save_plugin_config with valid data.
index 88d1c3ed7d05dd9110db3444e000019f8b977740..b496cb4c3499612fa2ec37c2df44a679eead3da1 100644 (file)
@@ -3,8 +3,8 @@
 namespace Shaarli\Feed;
 
 use DateTime;
-use Shaarli\Bookmark\LinkDB;
 use ReferenceLinkDB;
+use Shaarli\Bookmark\LinkDB;
 
 /**
  * FeedBuilderTest class.
index 38347de19cce5e543e8774d60b5991a19c6bc8ed..b8b7ca3a548358e98946e5d8833b748a40ecf27c 100644 (file)
@@ -12,7 +12,7 @@ use Shaarli\Config\ConfigManager;
  *
  * @package Shaarli
  */
-class LanguagesFrTest extends \PHPUnit_Framework_TestCase
+class LanguagesFrTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * @var string Config file path (without extension).
index bcc01604e12aa4a9e4af8c20298b3c4d808e8819..a3cd90765676c36920a9a58d2b0140133950a54d 100644 (file)
@@ -1,8 +1,6 @@
 <?php
 namespace Shaarli\Plugin\Wallabag;
 
-use Shaarli\Plugin\Wallabag\WallabagInstance;
-
 /**
  * Class WallabagInstanceTest
  */
index 6159a1bdaca24c43b5f98fcf60a92edf51e738c8..58e3426b2de3670ab40a2c12bc385c2b308652d8 100644 (file)
@@ -7,7 +7,7 @@ namespace Shaarli\Render;
  *
  * @package Shaarli
  */
-class ThemeUtilsTest extends \PHPUnit_Framework_TestCase
+class ThemeUtilsTest extends \PHPUnit\Framework\TestCase
 {
     /**
      * Test getThemes() with existing theme directories.
index f26cd1eb8635c0bd21f8f4ab68043b7569562ddf..de8055edaede452cdeeb1c21ed42ae3b13447a8e 100644 (file)
@@ -2,7 +2,8 @@
 namespace Shaarli\Security;
 
 require_once 'tests/utils/FakeConfigManager.php';
-use \PHPUnit\Framework\TestCase;
+
+use PHPUnit\Framework\TestCase;
 
 /**
  * Test coverage for LoginManager
index 7961e7710dc3581a2d7f63659fc6f2aa500c25b2..f264505eaefa81159e7cf1af14fb01b22b60f027 100644 (file)
@@ -5,8 +5,8 @@ require_once 'tests/utils/FakeConfigManager.php';
 require_once 'tests/utils/ReferenceSessionIdHashes.php';
 ReferenceSessionIdHashes::genAllHashes();
 
-use \Shaarli\Security\SessionManager;
-use \PHPUnit\Framework\TestCase;
+use PHPUnit\Framework\TestCase;
+use Shaarli\Security\SessionManager;
 
 /**
  * Test coverage for SessionManager