aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/api/controllers/tags/PutTagTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/api/controllers/tags/PutTagTest.php')
-rw-r--r--tests/api/controllers/tags/PutTagTest.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/api/controllers/tags/PutTagTest.php b/tests/api/controllers/tags/PutTagTest.php
index 38017243..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
4namespace Shaarli\Api\Controllers; 3namespace Shaarli\Api\Controllers;
5 4
6use Shaarli\Api\Exceptions\ApiBadParametersException; 5use Shaarli\Api\Exceptions\ApiBadParametersException;
6use Shaarli\Bookmark\LinkDB;
7use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
8use Shaarli\History;
8use Slim\Container; 9use Slim\Container;
9use Slim\Http\Environment; 10use Slim\Http\Environment;
10use Slim\Http\Request; 11use Slim\Http\Request;
11use Slim\Http\Response; 12use Slim\Http\Response;
12 13
13class PutTagTest extends \PHPUnit_Framework_TestCase 14class 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 \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 \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 \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 \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(\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(\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 );