aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/bookmark/BookmarkFileServiceTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-10-02 17:50:59 +0200
committerArthurHoaro <arthur@hoa.ro>2020-10-13 13:50:11 +0200
commitefb7d21b52eb033530e80e5e49d175e6e3b031f4 (patch)
tree4f34052788a08be1a30cb88c3339ae14e0b7c4da /tests/bookmark/BookmarkFileServiceTest.php
parent29c31b7ec6ca48ba37b7eb6da650931fd0cb7164 (diff)
downloadShaarli-efb7d21b52eb033530e80e5e49d175e6e3b031f4.tar.gz
Shaarli-efb7d21b52eb033530e80e5e49d175e6e3b031f4.tar.zst
Shaarli-efb7d21b52eb033530e80e5e49d175e6e3b031f4.zip
Add strict types for bookmarks management
Parameters typing and using strict types overall increase the codebase quality by enforcing the a given parameter will have the expected type. It also removes the need to unnecessary unit tests checking methods behavior with invalid input.
Diffstat (limited to 'tests/bookmark/BookmarkFileServiceTest.php')
-rw-r--r--tests/bookmark/BookmarkFileServiceTest.php44
1 files changed, 0 insertions, 44 deletions
diff --git a/tests/bookmark/BookmarkFileServiceTest.php b/tests/bookmark/BookmarkFileServiceTest.php
index 6c56dfaa..59c0608c 100644
--- a/tests/bookmark/BookmarkFileServiceTest.php
+++ b/tests/bookmark/BookmarkFileServiceTest.php
@@ -265,17 +265,6 @@ class BookmarkFileServiceTest extends TestCase
265 } 265 }
266 266
267 /** 267 /**
268 * Test add() method with an entry which is not a bookmark instance
269 */
270 public function testAddNotABookmark()
271 {
272 $this->expectException(\Exception::class);
273 $this->expectExceptionMessage('Provided data is invalid');
274
275 $this->privateLinkDB->add(['title' => 'hi!']);
276 }
277
278 /**
279 * Test add() method with a Bookmark already containing an ID 268 * Test add() method with a Bookmark already containing an ID
280 */ 269 */
281 public function testAddWithId() 270 public function testAddWithId()
@@ -413,17 +402,6 @@ class BookmarkFileServiceTest extends TestCase
413 } 402 }
414 403
415 /** 404 /**
416 * Test set() method with an entry which is not a bookmark instance
417 */
418 public function testSetNotABookmark()
419 {
420 $this->expectException(\Exception::class);
421 $this->expectExceptionMessage('Provided data is invalid');
422
423 $this->privateLinkDB->set(['title' => 'hi!']);
424 }
425
426 /**
427 * Test set() method with a Bookmark without an ID defined. 405 * Test set() method with a Bookmark without an ID defined.
428 */ 406 */
429 public function testSetWithoutId() 407 public function testSetWithoutId()
@@ -497,17 +475,6 @@ class BookmarkFileServiceTest extends TestCase
497 } 475 }
498 476
499 /** 477 /**
500 * Test addOrSet() method with an entry which is not a bookmark instance
501 */
502 public function testAddOrSetNotABookmark()
503 {
504 $this->expectException(\Exception::class);
505 $this->expectExceptionMessage('Provided data is invalid');
506
507 $this->privateLinkDB->addOrSet(['title' => 'hi!']);
508 }
509
510 /**
511 * Test addOrSet() method for a bookmark without any field set and without writing the data store 478 * Test addOrSet() method for a bookmark without any field set and without writing the data store
512 */ 479 */
513 public function testAddOrSetMinimalNoWrite() 480 public function testAddOrSetMinimalNoWrite()
@@ -565,17 +532,6 @@ class BookmarkFileServiceTest extends TestCase
565 } 532 }
566 533
567 /** 534 /**
568 * Test remove() method with an entry which is not a bookmark instance
569 */
570 public function testRemoveNotABookmark()
571 {
572 $this->expectException(\Exception::class);
573 $this->expectExceptionMessage('Provided data is invalid');
574
575 $this->privateLinkDB->remove(['title' => 'hi!']);
576 }
577
578 /**
579 * Test remove() method with a Bookmark with an unknown ID 535 * Test remove() method with a Bookmark with an unknown ID
580 */ 536 */
581 public function testRemoveWithUnknownId() 537 public function testRemoveWithUnknownId()