aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/api/controllers/links
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-09-29 11:36:27 +0200
committerGitHub <noreply@github.com>2020-09-29 11:36:27 +0200
commit6cdca9562c7685e9a0eb77b51584d0cc458c44e0 (patch)
tree518de2057da549d0baa982c6aa689aa813377774 /tests/api/controllers/links
parentd0ae1ba273b6decea8d35ef79bfabb055b0fb6df (diff)
parentb1baca99f280570d0336b4d71ad1f9dca213a35b (diff)
downloadShaarli-6cdca9562c7685e9a0eb77b51584d0cc458c44e0.tar.gz
Shaarli-6cdca9562c7685e9a0eb77b51584d0cc458c44e0.tar.zst
Shaarli-6cdca9562c7685e9a0eb77b51584d0cc458c44e0.zip
Merge pull request #1572 from ArthurHoaro/feature/php8
Diffstat (limited to 'tests/api/controllers/links')
-rw-r--r--tests/api/controllers/links/DeleteLinkTest.php8
-rw-r--r--tests/api/controllers/links/GetLinkIdTest.php10
-rw-r--r--tests/api/controllers/links/GetLinksTest.php4
-rw-r--r--tests/api/controllers/links/PostLinkTest.php4
-rw-r--r--tests/api/controllers/links/PutLinkTest.php10
5 files changed, 18 insertions, 18 deletions
diff --git a/tests/api/controllers/links/DeleteLinkTest.php b/tests/api/controllers/links/DeleteLinkTest.php
index 6c2b3698..bd8403cf 100644
--- a/tests/api/controllers/links/DeleteLinkTest.php
+++ b/tests/api/controllers/links/DeleteLinkTest.php
@@ -56,7 +56,7 @@ class DeleteLinkTest extends \PHPUnit\Framework\TestCase
56 /** 56 /**
57 * Before each test, instantiate a new Api with its config, plugins and bookmarks. 57 * Before each test, instantiate a new Api with its config, plugins and bookmarks.
58 */ 58 */
59 public function setUp() 59 protected function setUp(): void
60 { 60 {
61 $this->conf = new ConfigManager('tests/utils/config/configJson'); 61 $this->conf = new ConfigManager('tests/utils/config/configJson');
62 $this->conf->set('resource.datastore', self::$testDatastore); 62 $this->conf->set('resource.datastore', self::$testDatastore);
@@ -78,7 +78,7 @@ class DeleteLinkTest extends \PHPUnit\Framework\TestCase
78 /** 78 /**
79 * After each test, remove the test datastore. 79 * After each test, remove the test datastore.
80 */ 80 */
81 public function tearDown() 81 protected function tearDown(): void
82 { 82 {
83 @unlink(self::$testDatastore); 83 @unlink(self::$testDatastore);
84 @unlink(self::$testHistory); 84 @unlink(self::$testHistory);
@@ -113,11 +113,11 @@ class DeleteLinkTest extends \PHPUnit\Framework\TestCase
113 113
114 /** 114 /**
115 * Test DELETE link endpoint: reach not existing ID. 115 * Test DELETE link endpoint: reach not existing ID.
116 *
117 * @expectedException \Shaarli\Api\Exceptions\ApiLinkNotFoundException
118 */ 116 */
119 public function testDeleteLink404() 117 public function testDeleteLink404()
120 { 118 {
119 $this->expectException(\Shaarli\Api\Exceptions\ApiLinkNotFoundException::class);
120
121 $id = -1; 121 $id = -1;
122 $this->assertFalse($this->bookmarkService->exists($id)); 122 $this->assertFalse($this->bookmarkService->exists($id));
123 $env = Environment::mock([ 123 $env = Environment::mock([
diff --git a/tests/api/controllers/links/GetLinkIdTest.php b/tests/api/controllers/links/GetLinkIdTest.php
index 8bb81dc8..3a3aaa7b 100644
--- a/tests/api/controllers/links/GetLinkIdTest.php
+++ b/tests/api/controllers/links/GetLinkIdTest.php
@@ -55,7 +55,7 @@ class GetLinkIdTest extends \PHPUnit\Framework\TestCase
55 /** 55 /**
56 * Before each test, instantiate a new Api with its config, plugins and bookmarks. 56 * Before each test, instantiate a new Api with its config, plugins and bookmarks.
57 */ 57 */
58 public function setUp() 58 protected function setUp(): void
59 { 59 {
60 $this->conf = new ConfigManager('tests/utils/config/configJson'); 60 $this->conf = new ConfigManager('tests/utils/config/configJson');
61 $this->conf->set('resource.datastore', self::$testDatastore); 61 $this->conf->set('resource.datastore', self::$testDatastore);
@@ -74,7 +74,7 @@ class GetLinkIdTest extends \PHPUnit\Framework\TestCase
74 /** 74 /**
75 * After each test, remove the test datastore. 75 * After each test, remove the test datastore.
76 */ 76 */
77 public function tearDown() 77 protected function tearDown(): void
78 { 78 {
79 @unlink(self::$testDatastore); 79 @unlink(self::$testDatastore);
80 } 80 }
@@ -120,12 +120,12 @@ class GetLinkIdTest extends \PHPUnit\Framework\TestCase
120 120
121 /** 121 /**
122 * Test basic getLink service: get non existent link => ApiLinkNotFoundException. 122 * Test basic getLink service: get non existent link => ApiLinkNotFoundException.
123 *
124 * @expectedException Shaarli\Api\Exceptions\ApiLinkNotFoundException
125 * @expectedExceptionMessage Link not found
126 */ 123 */
127 public function testGetLink404() 124 public function testGetLink404()
128 { 125 {
126 $this->expectException(\Shaarli\Api\Exceptions\ApiLinkNotFoundException::class);
127 $this->expectExceptionMessage('Link not found');
128
129 $env = Environment::mock([ 129 $env = Environment::mock([
130 'REQUEST_METHOD' => 'GET', 130 'REQUEST_METHOD' => 'GET',
131 ]); 131 ]);
diff --git a/tests/api/controllers/links/GetLinksTest.php b/tests/api/controllers/links/GetLinksTest.php
index d02e6fad..01c40c2f 100644
--- a/tests/api/controllers/links/GetLinksTest.php
+++ b/tests/api/controllers/links/GetLinksTest.php
@@ -55,7 +55,7 @@ class GetLinksTest extends \PHPUnit\Framework\TestCase
55 /** 55 /**
56 * Before every test, instantiate a new Api with its config, plugins and bookmarks. 56 * Before every test, instantiate a new Api with its config, plugins and bookmarks.
57 */ 57 */
58 public function setUp() 58 protected function setUp(): void
59 { 59 {
60 $this->conf = new ConfigManager('tests/utils/config/configJson'); 60 $this->conf = new ConfigManager('tests/utils/config/configJson');
61 $this->conf->set('resource.datastore', self::$testDatastore); 61 $this->conf->set('resource.datastore', self::$testDatastore);
@@ -74,7 +74,7 @@ class GetLinksTest extends \PHPUnit\Framework\TestCase
74 /** 74 /**
75 * After every test, remove the test datastore. 75 * After every test, remove the test datastore.
76 */ 76 */
77 public function tearDown() 77 protected function tearDown(): void
78 { 78 {
79 @unlink(self::$testDatastore); 79 @unlink(self::$testDatastore);
80 } 80 }
diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php
index 4e791a04..b1c9008b 100644
--- a/tests/api/controllers/links/PostLinkTest.php
+++ b/tests/api/controllers/links/PostLinkTest.php
@@ -70,7 +70,7 @@ class PostLinkTest extends TestCase
70 /** 70 /**
71 * Before every test, instantiate a new Api with its config, plugins and bookmarks. 71 * Before every test, instantiate a new Api with its config, plugins and bookmarks.
72 */ 72 */
73 public function setUp() 73 protected function setUp(): void
74 { 74 {
75 $this->conf = new ConfigManager('tests/utils/config/configJson'); 75 $this->conf = new ConfigManager('tests/utils/config/configJson');
76 $this->conf->set('resource.datastore', self::$testDatastore); 76 $this->conf->set('resource.datastore', self::$testDatastore);
@@ -107,7 +107,7 @@ class PostLinkTest extends TestCase
107 /** 107 /**
108 * After every test, remove the test datastore. 108 * After every test, remove the test datastore.
109 */ 109 */
110 public function tearDown() 110 protected function tearDown(): void
111 { 111 {
112 @unlink(self::$testDatastore); 112 @unlink(self::$testDatastore);
113 @unlink(self::$testHistory); 113 @unlink(self::$testHistory);
diff --git a/tests/api/controllers/links/PutLinkTest.php b/tests/api/controllers/links/PutLinkTest.php
index 302cac0f..3d62a1b1 100644
--- a/tests/api/controllers/links/PutLinkTest.php
+++ b/tests/api/controllers/links/PutLinkTest.php
@@ -62,7 +62,7 @@ class PutLinkTest extends \PHPUnit\Framework\TestCase
62 /** 62 /**
63 * Before every test, instantiate a new Api with its config, plugins and bookmarks. 63 * Before every test, instantiate a new Api with its config, plugins and bookmarks.
64 */ 64 */
65 public function setUp() 65 protected function setUp(): void
66 { 66 {
67 $this->conf = new ConfigManager('tests/utils/config/configJson'); 67 $this->conf = new ConfigManager('tests/utils/config/configJson');
68 $this->conf->set('resource.datastore', self::$testDatastore); 68 $this->conf->set('resource.datastore', self::$testDatastore);
@@ -91,7 +91,7 @@ class PutLinkTest extends \PHPUnit\Framework\TestCase
91 /** 91 /**
92 * After every test, remove the test datastore. 92 * After every test, remove the test datastore.
93 */ 93 */
94 public function tearDown() 94 protected function tearDown(): void
95 { 95 {
96 @unlink(self::$testDatastore); 96 @unlink(self::$testDatastore);
97 @unlink(self::$testHistory); 97 @unlink(self::$testHistory);
@@ -218,12 +218,12 @@ class PutLinkTest extends \PHPUnit\Framework\TestCase
218 218
219 /** 219 /**
220 * Test link update on non existent link => ApiLinkNotFoundException. 220 * Test link update on non existent link => ApiLinkNotFoundException.
221 *
222 * @expectedException Shaarli\Api\Exceptions\ApiLinkNotFoundException
223 * @expectedExceptionMessage Link not found
224 */ 221 */
225 public function testGetLink404() 222 public function testGetLink404()
226 { 223 {
224 $this->expectException(\Shaarli\Api\Exceptions\ApiLinkNotFoundException::class);
225 $this->expectExceptionMessage('Link not found');
226
227 $env = Environment::mock([ 227 $env = Environment::mock([
228 'REQUEST_METHOD' => 'PUT', 228 'REQUEST_METHOD' => 'PUT',
229 ]); 229 ]);