diff options
Diffstat (limited to 'tests/api/controllers/tags/GetTagNameTest.php')
-rw-r--r-- | tests/api/controllers/tags/GetTagNameTest.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/api/controllers/tags/GetTagNameTest.php b/tests/api/controllers/tags/GetTagNameTest.php index b9a81f9b..878de5a4 100644 --- a/tests/api/controllers/tags/GetTagNameTest.php +++ b/tests/api/controllers/tags/GetTagNameTest.php | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | namespace Shaarli\Api\Controllers; | 3 | namespace Shaarli\Api\Controllers; |
4 | 4 | ||
5 | use malkusch\lock\mutex\NoMutex; | ||
5 | use Shaarli\Bookmark\BookmarkFileService; | 6 | use Shaarli\Bookmark\BookmarkFileService; |
6 | use Shaarli\Bookmark\LinkDB; | 7 | use Shaarli\Bookmark\LinkDB; |
7 | use Shaarli\Config\ConfigManager; | 8 | use Shaarli\Config\ConfigManager; |
@@ -18,7 +19,7 @@ use Slim\Http\Response; | |||
18 | * | 19 | * |
19 | * @package Shaarli\Api\Controllers | 20 | * @package Shaarli\Api\Controllers |
20 | */ | 21 | */ |
21 | class GetTagNameTest extends \PHPUnit\Framework\TestCase | 22 | class GetTagNameTest extends \Shaarli\TestCase |
22 | { | 23 | { |
23 | /** | 24 | /** |
24 | * @var string datastore to test write operations | 25 | * @var string datastore to test write operations |
@@ -53,8 +54,9 @@ class GetTagNameTest extends \PHPUnit\Framework\TestCase | |||
53 | /** | 54 | /** |
54 | * Before each test, instantiate a new Api with its config, plugins and bookmarks. | 55 | * Before each test, instantiate a new Api with its config, plugins and bookmarks. |
55 | */ | 56 | */ |
56 | public function setUp() | 57 | protected function setUp(): void |
57 | { | 58 | { |
59 | $mutex = new NoMutex(); | ||
58 | $this->conf = new ConfigManager('tests/utils/config/configJson'); | 60 | $this->conf = new ConfigManager('tests/utils/config/configJson'); |
59 | $this->conf->set('resource.datastore', self::$testDatastore); | 61 | $this->conf->set('resource.datastore', self::$testDatastore); |
60 | $this->refDB = new \ReferenceLinkDB(); | 62 | $this->refDB = new \ReferenceLinkDB(); |
@@ -63,7 +65,7 @@ class GetTagNameTest extends \PHPUnit\Framework\TestCase | |||
63 | 65 | ||
64 | $this->container = new Container(); | 66 | $this->container = new Container(); |
65 | $this->container['conf'] = $this->conf; | 67 | $this->container['conf'] = $this->conf; |
66 | $this->container['db'] = new BookmarkFileService($this->conf, $history, true); | 68 | $this->container['db'] = new BookmarkFileService($this->conf, $history, $mutex, true); |
67 | $this->container['history'] = null; | 69 | $this->container['history'] = null; |
68 | 70 | ||
69 | $this->controller = new Tags($this->container); | 71 | $this->controller = new Tags($this->container); |
@@ -72,7 +74,7 @@ class GetTagNameTest extends \PHPUnit\Framework\TestCase | |||
72 | /** | 74 | /** |
73 | * After each test, remove the test datastore. | 75 | * After each test, remove the test datastore. |
74 | */ | 76 | */ |
75 | public function tearDown() | 77 | protected function tearDown(): void |
76 | { | 78 | { |
77 | @unlink(self::$testDatastore); | 79 | @unlink(self::$testDatastore); |
78 | } | 80 | } |
@@ -117,12 +119,12 @@ class GetTagNameTest extends \PHPUnit\Framework\TestCase | |||
117 | 119 | ||
118 | /** | 120 | /** |
119 | * Test basic getTag service: get non existent tag => ApiTagNotFoundException. | 121 | * Test basic getTag service: get non existent tag => ApiTagNotFoundException. |
120 | * | ||
121 | * @expectedException Shaarli\Api\Exceptions\ApiTagNotFoundException | ||
122 | * @expectedExceptionMessage Tag not found | ||
123 | */ | 122 | */ |
124 | public function testGetTag404() | 123 | public function testGetTag404() |
125 | { | 124 | { |
125 | $this->expectException(\Shaarli\Api\Exceptions\ApiTagNotFoundException::class); | ||
126 | $this->expectExceptionMessage('Tag not found'); | ||
127 | |||
126 | $env = Environment::mock([ | 128 | $env = Environment::mock([ |
127 | 'REQUEST_METHOD' => 'GET', | 129 | 'REQUEST_METHOD' => 'GET', |
128 | ]); | 130 | ]); |