diff options
Diffstat (limited to 'tests/front/controller/admin/ManageShaareControllerTest')
-rw-r--r-- | tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php | 4 | ||||
-rw-r--r-- | tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php | 20 |
2 files changed, 19 insertions, 5 deletions
diff --git a/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php b/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php index ba774e21..83bbee7c 100644 --- a/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php +++ b/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php | |||
@@ -356,6 +356,10 @@ class DeleteBookmarkTest extends TestCase | |||
356 | ; | 356 | ; |
357 | $response = new Response(); | 357 | $response = new Response(); |
358 | 358 | ||
359 | $this->container->bookmarkService->method('get')->with('123')->willReturn( | ||
360 | (new Bookmark())->setId(123)->setUrl('http://domain.tld')->setTitle('Title 123') | ||
361 | ); | ||
362 | |||
359 | $this->container->formatterFactory = $this->createMock(FormatterFactory::class); | 363 | $this->container->formatterFactory = $this->createMock(FormatterFactory::class); |
360 | $this->container->formatterFactory | 364 | $this->container->formatterFactory |
361 | ->expects(static::once()) | 365 | ->expects(static::once()) |
diff --git a/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php b/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php index f7a68226..37542c26 100644 --- a/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php +++ b/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php | |||
@@ -66,23 +66,27 @@ class SaveBookmarkTest extends TestCase | |||
66 | $this->container->bookmarkService | 66 | $this->container->bookmarkService |
67 | ->expects(static::once()) | 67 | ->expects(static::once()) |
68 | ->method('addOrSet') | 68 | ->method('addOrSet') |
69 | ->willReturnCallback(function (Bookmark $bookmark, bool $save) use ($checkBookmark, $id): void { | 69 | ->willReturnCallback(function (Bookmark $bookmark, bool $save) use ($checkBookmark, $id): Bookmark { |
70 | static::assertFalse($save); | 70 | static::assertFalse($save); |
71 | 71 | ||
72 | $checkBookmark($bookmark); | 72 | $checkBookmark($bookmark); |
73 | 73 | ||
74 | $bookmark->setId($id); | 74 | $bookmark->setId($id); |
75 | |||
76 | return $bookmark; | ||
75 | }) | 77 | }) |
76 | ; | 78 | ; |
77 | $this->container->bookmarkService | 79 | $this->container->bookmarkService |
78 | ->expects(static::once()) | 80 | ->expects(static::once()) |
79 | ->method('set') | 81 | ->method('set') |
80 | ->willReturnCallback(function (Bookmark $bookmark, bool $save) use ($checkBookmark, $id): void { | 82 | ->willReturnCallback(function (Bookmark $bookmark, bool $save) use ($checkBookmark, $id): Bookmark { |
81 | static::assertTrue($save); | 83 | static::assertTrue($save); |
82 | 84 | ||
83 | $checkBookmark($bookmark); | 85 | $checkBookmark($bookmark); |
84 | 86 | ||
85 | static::assertSame($id, $bookmark->getId()); | 87 | static::assertSame($id, $bookmark->getId()); |
88 | |||
89 | return $bookmark; | ||
86 | }) | 90 | }) |
87 | ; | 91 | ; |
88 | 92 | ||
@@ -155,21 +159,25 @@ class SaveBookmarkTest extends TestCase | |||
155 | $this->container->bookmarkService | 159 | $this->container->bookmarkService |
156 | ->expects(static::once()) | 160 | ->expects(static::once()) |
157 | ->method('addOrSet') | 161 | ->method('addOrSet') |
158 | ->willReturnCallback(function (Bookmark $bookmark, bool $save) use ($checkBookmark, $id): void { | 162 | ->willReturnCallback(function (Bookmark $bookmark, bool $save) use ($checkBookmark, $id): Bookmark { |
159 | static::assertFalse($save); | 163 | static::assertFalse($save); |
160 | 164 | ||
161 | $checkBookmark($bookmark); | 165 | $checkBookmark($bookmark); |
166 | |||
167 | return $bookmark; | ||
162 | }) | 168 | }) |
163 | ; | 169 | ; |
164 | $this->container->bookmarkService | 170 | $this->container->bookmarkService |
165 | ->expects(static::once()) | 171 | ->expects(static::once()) |
166 | ->method('set') | 172 | ->method('set') |
167 | ->willReturnCallback(function (Bookmark $bookmark, bool $save) use ($checkBookmark, $id): void { | 173 | ->willReturnCallback(function (Bookmark $bookmark, bool $save) use ($checkBookmark, $id): Bookmark { |
168 | static::assertTrue($save); | 174 | static::assertTrue($save); |
169 | 175 | ||
170 | $checkBookmark($bookmark); | 176 | $checkBookmark($bookmark); |
171 | 177 | ||
172 | static::assertSame($id, $bookmark->getId()); | 178 | static::assertSame($id, $bookmark->getId()); |
179 | |||
180 | return $bookmark; | ||
173 | }) | 181 | }) |
174 | ; | 182 | ; |
175 | 183 | ||
@@ -230,8 +238,10 @@ class SaveBookmarkTest extends TestCase | |||
230 | $this->container->bookmarkService | 238 | $this->container->bookmarkService |
231 | ->expects(static::once()) | 239 | ->expects(static::once()) |
232 | ->method('addOrSet') | 240 | ->method('addOrSet') |
233 | ->willReturnCallback(function (Bookmark $bookmark, bool $save) use ($thumb): void { | 241 | ->willReturnCallback(function (Bookmark $bookmark, bool $save) use ($thumb): Bookmark { |
234 | static::assertSame($thumb, $bookmark->getThumbnail()); | 242 | static::assertSame($thumb, $bookmark->getThumbnail()); |
243 | |||
244 | return $bookmark; | ||
235 | }) | 245 | }) |
236 | ; | 246 | ; |
237 | 247 | ||