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/tags/PutTagTest.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/tags/PutTagTest.php')
-rw-r--r-- | tests/api/controllers/tags/PutTagTest.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/api/controllers/tags/PutTagTest.php b/tests/api/controllers/tags/PutTagTest.php index d8c0fec8..86106fc7 100644 --- a/tests/api/controllers/tags/PutTagTest.php +++ b/tests/api/controllers/tags/PutTagTest.php | |||
@@ -1,16 +1,17 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | |||
4 | namespace Shaarli\Api\Controllers; | 3 | namespace Shaarli\Api\Controllers; |
5 | 4 | ||
6 | use Shaarli\Api\Exceptions\ApiBadParametersException; | 5 | use Shaarli\Api\Exceptions\ApiBadParametersException; |
6 | use Shaarli\Bookmark\LinkDB; | ||
7 | use Shaarli\Config\ConfigManager; | 7 | use Shaarli\Config\ConfigManager; |
8 | use Shaarli\History; | ||
8 | use Slim\Container; | 9 | use Slim\Container; |
9 | use Slim\Http\Environment; | 10 | use Slim\Http\Environment; |
10 | use Slim\Http\Request; | 11 | use Slim\Http\Request; |
11 | use Slim\Http\Response; | 12 | use Slim\Http\Response; |
12 | 13 | ||
13 | class PutTagTest extends \PHPUnit_Framework_TestCase | 14 | class PutTagTest extends \PHPUnit\Framework\TestCase |
14 | { | 15 | { |
15 | /** | 16 | /** |
16 | * @var string datastore to test write operations | 17 | * @var string datastore to test write operations |
@@ -33,7 +34,7 @@ class PutTagTest extends \PHPUnit_Framework_TestCase | |||
33 | protected $refDB = null; | 34 | protected $refDB = null; |
34 | 35 | ||
35 | /** | 36 | /** |
36 | * @var \Shaarli\History instance. | 37 | * @var HistoryController instance. |
37 | */ | 38 | */ |
38 | protected $history; | 39 | protected $history; |
39 | 40 | ||
@@ -43,7 +44,7 @@ class PutTagTest extends \PHPUnit_Framework_TestCase | |||
43 | protected $container; | 44 | protected $container; |
44 | 45 | ||
45 | /** | 46 | /** |
46 | * @var \Shaarli\Bookmark\LinkDB instance. | 47 | * @var LinkDB instance. |
47 | */ | 48 | */ |
48 | protected $linkDB; | 49 | protected $linkDB; |
49 | 50 | ||
@@ -68,11 +69,11 @@ class PutTagTest extends \PHPUnit_Framework_TestCase | |||
68 | 69 | ||
69 | $refHistory = new \ReferenceHistory(); | 70 | $refHistory = new \ReferenceHistory(); |
70 | $refHistory->write(self::$testHistory); | 71 | $refHistory->write(self::$testHistory); |
71 | $this->history = new \Shaarli\History(self::$testHistory); | 72 | $this->history = new History(self::$testHistory); |
72 | 73 | ||
73 | $this->container = new Container(); | 74 | $this->container = new Container(); |
74 | $this->container['conf'] = $this->conf; | 75 | $this->container['conf'] = $this->conf; |
75 | $this->linkDB = new \Shaarli\Bookmark\LinkDB(self::$testDatastore, true, false); | 76 | $this->linkDB = new LinkDB(self::$testDatastore, true, false); |
76 | $this->container['db'] = $this->linkDB; | 77 | $this->container['db'] = $this->linkDB; |
77 | $this->container['history'] = $this->history; | 78 | $this->container['history'] = $this->history; |
78 | 79 | ||
@@ -113,12 +114,12 @@ class PutTagTest extends \PHPUnit_Framework_TestCase | |||
113 | $this->assertEquals(2, $tags[$newName]); | 114 | $this->assertEquals(2, $tags[$newName]); |
114 | 115 | ||
115 | $historyEntry = $this->history->getHistory()[0]; | 116 | $historyEntry = $this->history->getHistory()[0]; |
116 | $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); | 117 | $this->assertEquals(History::UPDATED, $historyEntry['event']); |
117 | $this->assertTrue( | 118 | $this->assertTrue( |
118 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] | 119 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] |
119 | ); | 120 | ); |
120 | $historyEntry = $this->history->getHistory()[1]; | 121 | $historyEntry = $this->history->getHistory()[1]; |
121 | $this->assertEquals(\Shaarli\History::UPDATED, $historyEntry['event']); | 122 | $this->assertEquals(History::UPDATED, $historyEntry['event']); |
122 | $this->assertTrue( | 123 | $this->assertTrue( |
123 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] | 124 | (new \DateTime())->add(\DateInterval::createFromDateString('-5 seconds')) < $historyEntry['datetime'] |
124 | ); | 125 | ); |