diff options
Diffstat (limited to 'tests/bookmark/BookmarkArrayTest.php')
-rw-r--r-- | tests/bookmark/BookmarkArrayTest.php | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/tests/bookmark/BookmarkArrayTest.php b/tests/bookmark/BookmarkArrayTest.php index 0f8f04c5..ebed9bfc 100644 --- a/tests/bookmark/BookmarkArrayTest.php +++ b/tests/bookmark/BookmarkArrayTest.php | |||
@@ -2,10 +2,7 @@ | |||
2 | 2 | ||
3 | namespace Shaarli\Bookmark; | 3 | namespace Shaarli\Bookmark; |
4 | 4 | ||
5 | use PHPUnit\Framework\TestCase; | 5 | use Shaarli\TestCase; |
6 | use Shaarli\Bookmark\Exception\InvalidBookmarkException; | ||
7 | use Shaarli\Config\ConfigManager; | ||
8 | use Shaarli\History; | ||
9 | 6 | ||
10 | /** | 7 | /** |
11 | * Class BookmarkArrayTest | 8 | * Class BookmarkArrayTest |
@@ -47,22 +44,22 @@ class BookmarkArrayTest extends TestCase | |||
47 | 44 | ||
48 | /** | 45 | /** |
49 | * Test adding a bad entry: wrong type | 46 | * Test adding a bad entry: wrong type |
50 | * | ||
51 | * @expectedException Shaarli\Bookmark\Exception\InvalidBookmarkException | ||
52 | */ | 47 | */ |
53 | public function testArrayAccessAddBadEntryInstance() | 48 | public function testArrayAccessAddBadEntryInstance() |
54 | { | 49 | { |
50 | $this->expectException(\Shaarli\Bookmark\Exception\InvalidBookmarkException::class); | ||
51 | |||
55 | $array = new BookmarkArray(); | 52 | $array = new BookmarkArray(); |
56 | $array[] = 'nope'; | 53 | $array[] = 'nope'; |
57 | } | 54 | } |
58 | 55 | ||
59 | /** | 56 | /** |
60 | * Test adding a bad entry: no id | 57 | * Test adding a bad entry: no id |
61 | * | ||
62 | * @expectedException Shaarli\Bookmark\Exception\InvalidBookmarkException | ||
63 | */ | 58 | */ |
64 | public function testArrayAccessAddBadEntryNoId() | 59 | public function testArrayAccessAddBadEntryNoId() |
65 | { | 60 | { |
61 | $this->expectException(\Shaarli\Bookmark\Exception\InvalidBookmarkException::class); | ||
62 | |||
66 | $array = new BookmarkArray(); | 63 | $array = new BookmarkArray(); |
67 | $bookmark = new Bookmark(); | 64 | $bookmark = new Bookmark(); |
68 | $array[] = $bookmark; | 65 | $array[] = $bookmark; |
@@ -70,11 +67,11 @@ class BookmarkArrayTest extends TestCase | |||
70 | 67 | ||
71 | /** | 68 | /** |
72 | * Test adding a bad entry: no url | 69 | * Test adding a bad entry: no url |
73 | * | ||
74 | * @expectedException Shaarli\Bookmark\Exception\InvalidBookmarkException | ||
75 | */ | 70 | */ |
76 | public function testArrayAccessAddBadEntryNoUrl() | 71 | public function testArrayAccessAddBadEntryNoUrl() |
77 | { | 72 | { |
73 | $this->expectException(\Shaarli\Bookmark\Exception\InvalidBookmarkException::class); | ||
74 | |||
78 | $array = new BookmarkArray(); | 75 | $array = new BookmarkArray(); |
79 | $bookmark = (new Bookmark())->setId(11); | 76 | $bookmark = (new Bookmark())->setId(11); |
80 | $array[] = $bookmark; | 77 | $array[] = $bookmark; |
@@ -82,11 +79,11 @@ class BookmarkArrayTest extends TestCase | |||
82 | 79 | ||
83 | /** | 80 | /** |
84 | * Test adding a bad entry: invalid offset | 81 | * Test adding a bad entry: invalid offset |
85 | * | ||
86 | * @expectedException Shaarli\Bookmark\Exception\InvalidBookmarkException | ||
87 | */ | 82 | */ |
88 | public function testArrayAccessAddBadEntryOffset() | 83 | public function testArrayAccessAddBadEntryOffset() |
89 | { | 84 | { |
85 | $this->expectException(\Shaarli\Bookmark\Exception\InvalidBookmarkException::class); | ||
86 | |||
90 | $array = new BookmarkArray(); | 87 | $array = new BookmarkArray(); |
91 | $bookmark = (new Bookmark())->setId(11); | 88 | $bookmark = (new Bookmark())->setId(11); |
92 | $bookmark->validate(); | 89 | $bookmark->validate(); |
@@ -95,11 +92,11 @@ class BookmarkArrayTest extends TestCase | |||
95 | 92 | ||
96 | /** | 93 | /** |
97 | * Test adding a bad entry: invalid ID type | 94 | * Test adding a bad entry: invalid ID type |
98 | * | ||
99 | * @expectedException Shaarli\Bookmark\Exception\InvalidBookmarkException | ||
100 | */ | 95 | */ |
101 | public function testArrayAccessAddBadEntryIdType() | 96 | public function testArrayAccessAddBadEntryIdType() |
102 | { | 97 | { |
98 | $this->expectException(\Shaarli\Bookmark\Exception\InvalidBookmarkException::class); | ||
99 | |||
103 | $array = new BookmarkArray(); | 100 | $array = new BookmarkArray(); |
104 | $bookmark = (new Bookmark())->setId('nope'); | 101 | $bookmark = (new Bookmark())->setId('nope'); |
105 | $bookmark->validate(); | 102 | $bookmark->validate(); |
@@ -108,11 +105,11 @@ class BookmarkArrayTest extends TestCase | |||
108 | 105 | ||
109 | /** | 106 | /** |
110 | * Test adding a bad entry: ID/offset not consistent | 107 | * Test adding a bad entry: ID/offset not consistent |
111 | * | ||
112 | * @expectedException Shaarli\Bookmark\Exception\InvalidBookmarkException | ||
113 | */ | 108 | */ |
114 | public function testArrayAccessAddBadEntryIdOffset() | 109 | public function testArrayAccessAddBadEntryIdOffset() |
115 | { | 110 | { |
111 | $this->expectException(\Shaarli\Bookmark\Exception\InvalidBookmarkException::class); | ||
112 | |||
116 | $array = new BookmarkArray(); | 113 | $array = new BookmarkArray(); |
117 | $bookmark = (new Bookmark())->setId(11); | 114 | $bookmark = (new Bookmark())->setId(11); |
118 | $bookmark->validate(); | 115 | $bookmark->validate(); |