]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/front/controller/admin/ThumbnailsControllerTest.php
Handle pagination through BookmarkService
[github/shaarli/Shaarli.git] / tests / front / controller / admin / ThumbnailsControllerTest.php
index 0c0c8a83b0fbcb7ee427c63badb23552012b2e6f..0c9b63c3a44e8e0f695c16fcf688b9f59aee1c9a 100644 (file)
@@ -4,9 +4,10 @@ declare(strict_types=1);
 
 namespace Shaarli\Front\Controller\Admin;
 
-use PHPUnit\Framework\TestCase;
 use Shaarli\Bookmark\Bookmark;
 use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
+use Shaarli\Bookmark\SearchResult;
+use Shaarli\TestCase;
 use Shaarli\Thumbnailer;
 use Slim\Http\Request;
 use Slim\Http\Response;
@@ -40,12 +41,12 @@ class ThumbnailsControllerTest extends TestCase
         $this->container->bookmarkService
             ->expects(static::once())
             ->method('search')
-            ->willReturn([
+            ->willReturn(SearchResult::getSearchResult([
                 (new Bookmark())->setId(1)->setUrl('http://url1.tld')->setTitle('Title 1'),
                 (new Bookmark())->setId(2)->setUrl('?abcdef')->setTitle('Note 1'),
                 (new Bookmark())->setId(3)->setUrl('http://url2.tld')->setTitle('Title 2'),
                 (new Bookmark())->setId(4)->setUrl('ftp://domain.tld', ['ftp'])->setTitle('FTP'),
-            ])
+            ]))
         ;
 
         $result = $this->controller->index($request, $response);
@@ -89,8 +90,10 @@ class ThumbnailsControllerTest extends TestCase
         $this->container->bookmarkService
             ->expects(static::once())
             ->method('set')
-            ->willReturnCallback(function (Bookmark $bookmark) use ($thumb) {
+            ->willReturnCallback(function (Bookmark $bookmark) use ($thumb): Bookmark {
                 static::assertSame($thumb, $bookmark->getThumbnail());
+
+                return $bookmark;
             })
         ;