diff options
Diffstat (limited to 'tests/api/controllers/tags')
-rw-r--r-- | tests/api/controllers/tags/DeleteTagTest.php | 29 | ||||
-rw-r--r-- | tests/api/controllers/tags/GetTagNameTest.php | 13 | ||||
-rw-r--r-- | tests/api/controllers/tags/GetTagsTest.php | 15 | ||||
-rw-r--r-- | tests/api/controllers/tags/PutTagTest.php | 13 |
4 files changed, 62 insertions, 8 deletions
diff --git a/tests/api/controllers/tags/DeleteTagTest.php b/tests/api/controllers/tags/DeleteTagTest.php index 37f07229..c0f8a6a9 100644 --- a/tests/api/controllers/tags/DeleteTagTest.php +++ b/tests/api/controllers/tags/DeleteTagTest.php | |||
@@ -8,6 +8,7 @@ use Shaarli\Bookmark\BookmarkFileService; | |||
8 | use Shaarli\Bookmark\LinkDB; | 8 | use Shaarli\Bookmark\LinkDB; |
9 | use Shaarli\Config\ConfigManager; | 9 | use Shaarli\Config\ConfigManager; |
10 | use Shaarli\History; | 10 | use Shaarli\History; |
11 | use Shaarli\Plugin\PluginManager; | ||
11 | use Slim\Container; | 12 | use Slim\Container; |
12 | use Slim\Http\Environment; | 13 | use Slim\Http\Environment; |
13 | use Slim\Http\Request; | 14 | use Slim\Http\Request; |
@@ -55,6 +56,9 @@ class DeleteTagTest extends \Shaarli\TestCase | |||
55 | */ | 56 | */ |
56 | protected $controller; | 57 | protected $controller; |
57 | 58 | ||
59 | /** @var PluginManager */ | ||
60 | protected $pluginManager; | ||
61 | |||
58 | /** @var NoMutex */ | 62 | /** @var NoMutex */ |
59 | protected $mutex; | 63 | protected $mutex; |
60 | 64 | ||
@@ -71,7 +75,14 @@ class DeleteTagTest extends \Shaarli\TestCase | |||
71 | $refHistory = new \ReferenceHistory(); | 75 | $refHistory = new \ReferenceHistory(); |
72 | $refHistory->write(self::$testHistory); | 76 | $refHistory->write(self::$testHistory); |
73 | $this->history = new History(self::$testHistory); | 77 | $this->history = new History(self::$testHistory); |
74 | $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); | 78 | $this->pluginManager = new PluginManager($this->conf); |
79 | $this->bookmarkService = new BookmarkFileService( | ||
80 | $this->conf, | ||
81 | $this->pluginManager, | ||
82 | $this->history, | ||
83 | $this->mutex, | ||
84 | true | ||
85 | ); | ||
75 | 86 | ||
76 | $this->container = new Container(); | 87 | $this->container = new Container(); |
77 | $this->container['conf'] = $this->conf; | 88 | $this->container['conf'] = $this->conf; |
@@ -107,7 +118,13 @@ class DeleteTagTest extends \Shaarli\TestCase | |||
107 | $this->assertEquals(204, $response->getStatusCode()); | 118 | $this->assertEquals(204, $response->getStatusCode()); |
108 | $this->assertEmpty((string) $response->getBody()); | 119 | $this->assertEmpty((string) $response->getBody()); |
109 | 120 | ||
110 | $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); | 121 | $this->bookmarkService = new BookmarkFileService( |
122 | $this->conf, | ||
123 | $this->pluginManager, | ||
124 | $this->history, | ||
125 | $this->mutex, | ||
126 | true | ||
127 | ); | ||
111 | $tags = $this->bookmarkService->bookmarksCountPerTag(); | 128 | $tags = $this->bookmarkService->bookmarksCountPerTag(); |
112 | $this->assertFalse(isset($tags[$tagName])); | 129 | $this->assertFalse(isset($tags[$tagName])); |
113 | 130 | ||
@@ -141,7 +158,13 @@ class DeleteTagTest extends \Shaarli\TestCase | |||
141 | $this->assertEquals(204, $response->getStatusCode()); | 158 | $this->assertEquals(204, $response->getStatusCode()); |
142 | $this->assertEmpty((string) $response->getBody()); | 159 | $this->assertEmpty((string) $response->getBody()); |
143 | 160 | ||
144 | $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $this->mutex, true); | 161 | $this->bookmarkService = new BookmarkFileService( |
162 | $this->conf, | ||
163 | $this->pluginManager, | ||
164 | $this->history, | ||
165 | $this->mutex, | ||
166 | true | ||
167 | ); | ||
145 | $tags = $this->bookmarkService->bookmarksCountPerTag(); | 168 | $tags = $this->bookmarkService->bookmarksCountPerTag(); |
146 | $this->assertFalse(isset($tags[$tagName])); | 169 | $this->assertFalse(isset($tags[$tagName])); |
147 | $this->assertTrue($tags[strtolower($tagName)] > 0); | 170 | $this->assertTrue($tags[strtolower($tagName)] > 0); |
diff --git a/tests/api/controllers/tags/GetTagNameTest.php b/tests/api/controllers/tags/GetTagNameTest.php index 878de5a4..0ad71495 100644 --- a/tests/api/controllers/tags/GetTagNameTest.php +++ b/tests/api/controllers/tags/GetTagNameTest.php | |||
@@ -7,6 +7,7 @@ use Shaarli\Bookmark\BookmarkFileService; | |||
7 | use Shaarli\Bookmark\LinkDB; | 7 | use Shaarli\Bookmark\LinkDB; |
8 | use Shaarli\Config\ConfigManager; | 8 | use Shaarli\Config\ConfigManager; |
9 | use Shaarli\History; | 9 | use Shaarli\History; |
10 | use Shaarli\Plugin\PluginManager; | ||
10 | use Slim\Container; | 11 | use Slim\Container; |
11 | use Slim\Http\Environment; | 12 | use Slim\Http\Environment; |
12 | use Slim\Http\Request; | 13 | use Slim\Http\Request; |
@@ -46,6 +47,9 @@ class GetTagNameTest extends \Shaarli\TestCase | |||
46 | */ | 47 | */ |
47 | protected $controller; | 48 | protected $controller; |
48 | 49 | ||
50 | /** @var PluginManager */ | ||
51 | protected $pluginManager; | ||
52 | |||
49 | /** | 53 | /** |
50 | * Number of JSON fields per link. | 54 | * Number of JSON fields per link. |
51 | */ | 55 | */ |
@@ -65,7 +69,14 @@ class GetTagNameTest extends \Shaarli\TestCase | |||
65 | 69 | ||
66 | $this->container = new Container(); | 70 | $this->container = new Container(); |
67 | $this->container['conf'] = $this->conf; | 71 | $this->container['conf'] = $this->conf; |
68 | $this->container['db'] = new BookmarkFileService($this->conf, $history, $mutex, true); | 72 | $this->pluginManager = new PluginManager($this->conf); |
73 | $this->container['db'] = new BookmarkFileService( | ||
74 | $this->conf, | ||
75 | $this->pluginManager, | ||
76 | $history, | ||
77 | $mutex, | ||
78 | true | ||
79 | ); | ||
69 | $this->container['history'] = null; | 80 | $this->container['history'] = null; |
70 | 81 | ||
71 | $this->controller = new Tags($this->container); | 82 | $this->controller = new Tags($this->container); |
diff --git a/tests/api/controllers/tags/GetTagsTest.php b/tests/api/controllers/tags/GetTagsTest.php index b565a8c4..a4b62c51 100644 --- a/tests/api/controllers/tags/GetTagsTest.php +++ b/tests/api/controllers/tags/GetTagsTest.php | |||
@@ -6,6 +6,7 @@ use Shaarli\Bookmark\BookmarkFileService; | |||
6 | use Shaarli\Bookmark\LinkDB; | 6 | use Shaarli\Bookmark\LinkDB; |
7 | use Shaarli\Config\ConfigManager; | 7 | use Shaarli\Config\ConfigManager; |
8 | use Shaarli\History; | 8 | use Shaarli\History; |
9 | use Shaarli\Plugin\PluginManager; | ||
9 | use Slim\Container; | 10 | use Slim\Container; |
10 | use Slim\Http\Environment; | 11 | use Slim\Http\Environment; |
11 | use Slim\Http\Request; | 12 | use Slim\Http\Request; |
@@ -50,6 +51,9 @@ class GetTagsTest extends \Shaarli\TestCase | |||
50 | */ | 51 | */ |
51 | protected $controller; | 52 | protected $controller; |
52 | 53 | ||
54 | /** @var PluginManager */ | ||
55 | protected $pluginManager; | ||
56 | |||
53 | /** | 57 | /** |
54 | * Number of JSON field per link. | 58 | * Number of JSON field per link. |
55 | */ | 59 | */ |
@@ -66,9 +70,14 @@ class GetTagsTest extends \Shaarli\TestCase | |||
66 | $this->refDB = new \ReferenceLinkDB(); | 70 | $this->refDB = new \ReferenceLinkDB(); |
67 | $this->refDB->write(self::$testDatastore); | 71 | $this->refDB->write(self::$testDatastore); |
68 | $history = new History('sandbox/history.php'); | 72 | $history = new History('sandbox/history.php'); |
69 | 73 | $this->pluginManager = new PluginManager($this->conf); | |
70 | $this->bookmarkService = new BookmarkFileService($this->conf, $history, $mutex, true); | 74 | $this->bookmarkService = new BookmarkFileService( |
71 | 75 | $this->conf, | |
76 | $this->pluginManager, | ||
77 | $history, | ||
78 | $mutex, | ||
79 | true | ||
80 | ); | ||
72 | $this->container = new Container(); | 81 | $this->container = new Container(); |
73 | $this->container['conf'] = $this->conf; | 82 | $this->container['conf'] = $this->conf; |
74 | $this->container['db'] = $this->bookmarkService; | 83 | $this->container['db'] = $this->bookmarkService; |
diff --git a/tests/api/controllers/tags/PutTagTest.php b/tests/api/controllers/tags/PutTagTest.php index c73f6d3b..045473e6 100644 --- a/tests/api/controllers/tags/PutTagTest.php +++ b/tests/api/controllers/tags/PutTagTest.php | |||
@@ -8,6 +8,7 @@ use Shaarli\Bookmark\BookmarkFileService; | |||
8 | use Shaarli\Bookmark\LinkDB; | 8 | use Shaarli\Bookmark\LinkDB; |
9 | use Shaarli\Config\ConfigManager; | 9 | use Shaarli\Config\ConfigManager; |
10 | use Shaarli\History; | 10 | use Shaarli\History; |
11 | use Shaarli\Plugin\PluginManager; | ||
11 | use Slim\Container; | 12 | use Slim\Container; |
12 | use Slim\Http\Environment; | 13 | use Slim\Http\Environment; |
13 | use Slim\Http\Request; | 14 | use Slim\Http\Request; |
@@ -55,6 +56,9 @@ class PutTagTest extends \Shaarli\TestCase | |||
55 | */ | 56 | */ |
56 | protected $controller; | 57 | protected $controller; |
57 | 58 | ||
59 | /** @var PluginManager */ | ||
60 | protected $pluginManager; | ||
61 | |||
58 | /** | 62 | /** |
59 | * Number of JSON field per link. | 63 | * Number of JSON field per link. |
60 | */ | 64 | */ |
@@ -73,7 +77,14 @@ class PutTagTest extends \Shaarli\TestCase | |||
73 | $refHistory = new \ReferenceHistory(); | 77 | $refHistory = new \ReferenceHistory(); |
74 | $refHistory->write(self::$testHistory); | 78 | $refHistory->write(self::$testHistory); |
75 | $this->history = new History(self::$testHistory); | 79 | $this->history = new History(self::$testHistory); |
76 | $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, $mutex, true); | 80 | $this->pluginManager = new PluginManager($this->conf); |
81 | $this->bookmarkService = new BookmarkFileService( | ||
82 | $this->conf, | ||
83 | $this->pluginManager, | ||
84 | $this->history, | ||
85 | $mutex, | ||
86 | true | ||
87 | ); | ||
77 | 88 | ||
78 | $this->container = new Container(); | 89 | $this->container = new Container(); |
79 | $this->container['conf'] = $this->conf; | 90 | $this->container['conf'] = $this->conf; |