diff options
Diffstat (limited to 'tests/front/controller/admin/ManageShaareControllerTest')
-rw-r--r-- | tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php b/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php index caaf549d..dee622bb 100644 --- a/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php +++ b/tests/front/controller/admin/ManageShaareControllerTest/DeleteBookmarkTest.php | |||
@@ -59,8 +59,12 @@ class DeleteBookmarkTest extends TestCase | |||
59 | ->with('raw') | 59 | ->with('raw') |
60 | ->willReturnCallback(function () use ($bookmark): BookmarkFormatter { | 60 | ->willReturnCallback(function () use ($bookmark): BookmarkFormatter { |
61 | $formatter = $this->createMock(BookmarkFormatter::class); | 61 | $formatter = $this->createMock(BookmarkFormatter::class); |
62 | 62 | $formatter | |
63 | $formatter->expects(static::once())->method('format')->with($bookmark); | 63 | ->expects(static::once()) |
64 | ->method('format') | ||
65 | ->with($bookmark) | ||
66 | ->willReturn(['formatted' => $bookmark]) | ||
67 | ; | ||
64 | 68 | ||
65 | return $formatter; | 69 | return $formatter; |
66 | }) | 70 | }) |
@@ -70,7 +74,7 @@ class DeleteBookmarkTest extends TestCase | |||
70 | $this->container->pluginManager | 74 | $this->container->pluginManager |
71 | ->expects(static::once()) | 75 | ->expects(static::once()) |
72 | ->method('executeHooks') | 76 | ->method('executeHooks') |
73 | ->with('delete_link') | 77 | ->with('delete_link', ['formatted' => $bookmark]) |
74 | ; | 78 | ; |
75 | 79 | ||
76 | $result = $this->controller->deleteBookmark($request, $response); | 80 | $result = $this->controller->deleteBookmark($request, $response); |
@@ -129,6 +133,9 @@ class DeleteBookmarkTest extends TestCase | |||
129 | ->withConsecutive(...array_map(function (Bookmark $bookmark): array { | 133 | ->withConsecutive(...array_map(function (Bookmark $bookmark): array { |
130 | return [$bookmark]; | 134 | return [$bookmark]; |
131 | }, $bookmarks)) | 135 | }, $bookmarks)) |
136 | ->willReturnOnConsecutiveCalls(...array_map(function (Bookmark $bookmark): array { | ||
137 | return ['formatted' => $bookmark]; | ||
138 | }, $bookmarks)) | ||
132 | ; | 139 | ; |
133 | 140 | ||
134 | return $formatter; | 141 | return $formatter; |
@@ -254,6 +261,9 @@ class DeleteBookmarkTest extends TestCase | |||
254 | ->withConsecutive(...array_map(function (Bookmark $bookmark): array { | 261 | ->withConsecutive(...array_map(function (Bookmark $bookmark): array { |
255 | return [$bookmark]; | 262 | return [$bookmark]; |
256 | }, $bookmarks)) | 263 | }, $bookmarks)) |
264 | ->willReturnOnConsecutiveCalls(...array_map(function (Bookmark $bookmark): array { | ||
265 | return ['formatted' => $bookmark]; | ||
266 | }, $bookmarks)) | ||
257 | ; | 267 | ; |
258 | 268 | ||
259 | return $formatter; | 269 | return $formatter; |
@@ -350,7 +360,12 @@ class DeleteBookmarkTest extends TestCase | |||
350 | $this->container->formatterFactory | 360 | $this->container->formatterFactory |
351 | ->expects(static::once()) | 361 | ->expects(static::once()) |
352 | ->method('getFormatter') | 362 | ->method('getFormatter') |
353 | ->willReturn($this->createMock(BookmarkFormatter::class)) | 363 | ->willReturnCallback(function (): BookmarkFormatter { |
364 | $formatter = $this->createMock(BookmarkFormatter::class); | ||
365 | $formatter->method('format')->willReturn(['formatted']); | ||
366 | |||
367 | return $formatter; | ||
368 | }) | ||
354 | ; | 369 | ; |
355 | 370 | ||
356 | $result = $this->controller->deleteBookmark($request, $response); | 371 | $result = $this->controller->deleteBookmark($request, $response); |