aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/api/controllers/links/PutLinkTest.php
diff options
context:
space:
mode:
authorVirtualTam <virtualtam@flibidi.net>2019-01-12 23:55:38 +0100
committerVirtualTam <virtualtam@flibidi.net>2019-01-13 00:04:42 +0100
commitdea72c711ff740b3b829d238fcf85648465143a0 (patch)
tree5e926e36816d510e3b3a10e20b94c23f43b55092 /tests/api/controllers/links/PutLinkTest.php
parenta43e7842e44068584302ec1d6349155b571d9c96 (diff)
downloadShaarli-dea72c711ff740b3b829d238fcf85648465143a0.tar.gz
Shaarli-dea72c711ff740b3b829d238fcf85648465143a0.tar.zst
Shaarli-dea72c711ff740b3b829d238fcf85648465143a0.zip
Optimize and cleanup imports
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'tests/api/controllers/links/PutLinkTest.php')
-rw-r--r--tests/api/controllers/links/PutLinkTest.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/api/controllers/links/PutLinkTest.php b/tests/api/controllers/links/PutLinkTest.php
index eb6c7955..cd815b66 100644
--- a/tests/api/controllers/links/PutLinkTest.php
+++ b/tests/api/controllers/links/PutLinkTest.php
@@ -4,12 +4,13 @@
4namespace Shaarli\Api\Controllers; 4namespace Shaarli\Api\Controllers;
5 5
6use Shaarli\Config\ConfigManager; 6use Shaarli\Config\ConfigManager;
7use Shaarli\History;
7use Slim\Container; 8use Slim\Container;
8use Slim\Http\Environment; 9use Slim\Http\Environment;
9use Slim\Http\Request; 10use Slim\Http\Request;
10use Slim\Http\Response; 11use Slim\Http\Response;
11 12
12class PutLinkTest extends \PHPUnit_Framework_TestCase 13class PutLinkTest extends \PHPUnit\Framework\TestCase
13{ 14{
14 /** 15 /**
15 * @var string datastore to test write operations 16 * @var string datastore to test write operations
@@ -32,7 +33,7 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase
32 protected $refDB = null; 33 protected $refDB = null;
33 34
34 /** 35 /**
35 * @var \Shaarli\History instance. 36 * @var HistoryController instance.
36 */ 37 */
37 protected $history; 38 protected $history;
38 39
@@ -62,12 +63,12 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase
62 63
63 $refHistory = new \ReferenceHistory(); 64 $refHistory = new \ReferenceHistory();
64 $refHistory->write(self::$testHistory); 65 $refHistory->write(self::$testHistory);
65 $this->history = new \Shaarli\History(self::$testHistory); 66 $this->history = new History(self::$testHistory);
66 67
67 $this->container = new Container(); 68 $this->container = new Container();
68 $this->container['conf'] = $this->conf; 69 $this->container['conf'] = $this->conf;
69 $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); 70 $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false);
70 $this->container['history'] = new \Shaarli\History(self::$testHistory); 71 $this->container['history'] = new History(self::$testHistory);
71 72
72 $this->controller = new Links($this->container); 73 $this->controller = new Links($this->container);
73 74
@@ -119,7 +120,7 @@ class PutLinkTest extends \PHPUnit_Framework_TestCase
119 ); 120 );
120 121
121 $historyEntry = $this->history->getHistory()[0]; 122 $historyEntry = $this->history->getHistory()[0];
122 $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); 123 $this->assertEquals(History::UPDATED, $historyEntry['event']);
123 $this->assertTrue( 124 $this->assertTrue(
124 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] 125 (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime']
125 ); 126 );