->with('raw')
->willReturnCallback(function () use ($bookmark): BookmarkFormatter {
$formatter = $this->createMock(BookmarkFormatter::class);
-
- $formatter->expects(static::once())->method('format')->with($bookmark);
+ $formatter
+ ->expects(static::once())
+ ->method('format')
+ ->with($bookmark)
+ ->willReturn(['formatted' => $bookmark])
+ ;
return $formatter;
})
$this->container->pluginManager
->expects(static::once())
->method('executeHooks')
- ->with('delete_link')
+ ->with('delete_link', ['formatted' => $bookmark])
;
$result = $this->controller->deleteBookmark($request, $response);
->withConsecutive(...array_map(function (Bookmark $bookmark): array {
return [$bookmark];
}, $bookmarks))
+ ->willReturnOnConsecutiveCalls(...array_map(function (Bookmark $bookmark): array {
+ return ['formatted' => $bookmark];
+ }, $bookmarks))
;
return $formatter;
->withConsecutive(...array_map(function (Bookmark $bookmark): array {
return [$bookmark];
}, $bookmarks))
+ ->willReturnOnConsecutiveCalls(...array_map(function (Bookmark $bookmark): array {
+ return ['formatted' => $bookmark];
+ }, $bookmarks))
;
return $formatter;
$this->container->formatterFactory
->expects(static::once())
->method('getFormatter')
- ->willReturn($this->createMock(BookmarkFormatter::class))
+ ->willReturnCallback(function (): BookmarkFormatter {
+ $formatter = $this->createMock(BookmarkFormatter::class);
+ $formatter->method('format')->willReturn(['formatted']);
+
+ return $formatter;
+ })
;
$result = $this->controller->deleteBookmark($request, $response);