diff options
author | VirtualTam <virtualtam@flibidi.net> | 2019-01-12 23:55:38 +0100 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2019-01-13 00:04:42 +0100 |
commit | dea72c711ff740b3b829d238fcf85648465143a0 (patch) | |
tree | 5e926e36816d510e3b3a10e20b94c23f43b55092 /tests/api/controllers/links/PostLinkTest.php | |
parent | a43e7842e44068584302ec1d6349155b571d9c96 (diff) | |
download | Shaarli-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/PostLinkTest.php')
-rw-r--r-- | tests/api/controllers/links/PostLinkTest.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php index 24e591db..d683a984 100644 --- a/tests/api/controllers/links/PostLinkTest.php +++ b/tests/api/controllers/links/PostLinkTest.php | |||
@@ -4,6 +4,7 @@ namespace Shaarli\Api\Controllers; | |||
4 | 4 | ||
5 | use PHPUnit\Framework\TestCase; | 5 | use PHPUnit\Framework\TestCase; |
6 | use Shaarli\Config\ConfigManager; | 6 | use Shaarli\Config\ConfigManager; |
7 | use Shaarli\History; | ||
7 | use Slim\Container; | 8 | use Slim\Container; |
8 | use Slim\Http\Environment; | 9 | use Slim\Http\Environment; |
9 | use Slim\Http\Request; | 10 | use Slim\Http\Request; |
@@ -40,7 +41,7 @@ class PostLinkTest extends TestCase | |||
40 | protected $refDB = null; | 41 | protected $refDB = null; |
41 | 42 | ||
42 | /** | 43 | /** |
43 | * @var \Shaarli\History instance. | 44 | * @var HistoryController instance. |
44 | */ | 45 | */ |
45 | protected $history; | 46 | protected $history; |
46 | 47 | ||
@@ -70,12 +71,12 @@ class PostLinkTest extends TestCase | |||
70 | 71 | ||
71 | $refHistory = new \ReferenceHistory(); | 72 | $refHistory = new \ReferenceHistory(); |
72 | $refHistory->write(self::$testHistory); | 73 | $refHistory->write(self::$testHistory); |
73 | $this->history = new \Shaarli\History(self::$testHistory); | 74 | $this->history = new History(self::$testHistory); |
74 | 75 | ||
75 | $this->container = new Container(); | 76 | $this->container = new Container(); |
76 | $this->container['conf'] = $this->conf; | 77 | $this->container['conf'] = $this->conf; |
77 | $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); | 78 | $this->container['db'] = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); |
78 | $this->container['history'] = new \Shaarli\History(self::$testHistory); | 79 | $this->container['history'] = new History(self::$testHistory); |
79 | 80 | ||
80 | $this->controller = new Links($this->container); | 81 | $this->controller = new Links($this->container); |
81 | 82 | ||
@@ -133,7 +134,7 @@ class PostLinkTest extends TestCase | |||
133 | $this->assertEquals('', $data['updated']); | 134 | $this->assertEquals('', $data['updated']); |
134 | 135 | ||
135 | $historyEntry = $this->history->getHistory()[0]; | 136 | $historyEntry = $this->history->getHistory()[0]; |
136 | $this->assertEquals(\Shaarli\History::CREATED, $historyEntry['event']); | 137 | $this->assertEquals(History::CREATED, $historyEntry['event']); |
137 | $this->assertTrue( | 138 | $this->assertTrue( |
138 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] | 139 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] |
139 | ); | 140 | ); |