diff options
author | ArthurHoaro <arthur@hoa.ro> | 2021-01-20 14:45:59 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2021-01-20 15:01:29 +0100 |
commit | 9b8c0a4560fa1d87cab1529099b1b4677e92e265 (patch) | |
tree | 330a9b1a42ff7b7f24a76612b57fae63417ef483 /tests/front/controller/visitor/PictureWallControllerTest.php | |
parent | 055d97f9a9e67d8ee8ae81bbf59a4b846a145d9f (diff) | |
download | Shaarli-9b8c0a4560fa1d87cab1529099b1b4677e92e265.tar.gz Shaarli-9b8c0a4560fa1d87cab1529099b1b4677e92e265.tar.zst Shaarli-9b8c0a4560fa1d87cab1529099b1b4677e92e265.zip |
Handle pagination through BookmarkService
Handle all search results through SearchResult object.
This is a required step toward implementing a BookmarkService based on SQL database.
Related to #953
Diffstat (limited to 'tests/front/controller/visitor/PictureWallControllerTest.php')
-rw-r--r-- | tests/front/controller/visitor/PictureWallControllerTest.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/front/controller/visitor/PictureWallControllerTest.php b/tests/front/controller/visitor/PictureWallControllerTest.php index b868231d..429e99a2 100644 --- a/tests/front/controller/visitor/PictureWallControllerTest.php +++ b/tests/front/controller/visitor/PictureWallControllerTest.php | |||
@@ -5,6 +5,7 @@ declare(strict_types=1); | |||
5 | namespace Shaarli\Front\Controller\Visitor; | 5 | namespace Shaarli\Front\Controller\Visitor; |
6 | 6 | ||
7 | use Shaarli\Bookmark\Bookmark; | 7 | use Shaarli\Bookmark\Bookmark; |
8 | use Shaarli\Bookmark\SearchResult; | ||
8 | use Shaarli\Config\ConfigManager; | 9 | use Shaarli\Config\ConfigManager; |
9 | use Shaarli\Front\Exception\ThumbnailsDisabledException; | 10 | use Shaarli\Front\Exception\ThumbnailsDisabledException; |
10 | use Shaarli\TestCase; | 11 | use Shaarli\TestCase; |
@@ -50,17 +51,17 @@ class PictureWallControllerTest extends TestCase | |||
50 | $this->container->bookmarkService | 51 | $this->container->bookmarkService |
51 | ->expects(static::once()) | 52 | ->expects(static::once()) |
52 | ->method('search') | 53 | ->method('search') |
53 | ->willReturnCallback(function (array $parameters, ?string $visibility): array { | 54 | ->willReturnCallback(function (array $parameters, ?string $visibility): SearchResult { |
54 | // Visibility is set through the container, not the call | 55 | // Visibility is set through the container, not the call |
55 | static::assertNull($visibility); | 56 | static::assertNull($visibility); |
56 | 57 | ||
57 | // No query parameters | 58 | // No query parameters |
58 | if (count($parameters) === 0) { | 59 | if (count($parameters) === 0) { |
59 | return [ | 60 | return SearchResult::getSearchResult([ |
60 | (new Bookmark())->setId(1)->setUrl('http://url.tld')->setThumbnail('thumb1'), | 61 | (new Bookmark())->setId(1)->setUrl('http://url.tld')->setThumbnail('thumb1'), |
61 | (new Bookmark())->setId(2)->setUrl('http://url2.tld'), | 62 | (new Bookmark())->setId(2)->setUrl('http://url2.tld'), |
62 | (new Bookmark())->setId(3)->setUrl('http://url3.tld')->setThumbnail('thumb2'), | 63 | (new Bookmark())->setId(3)->setUrl('http://url3.tld')->setThumbnail('thumb2'), |
63 | ]; | 64 | ]); |
64 | } | 65 | } |
65 | }) | 66 | }) |
66 | ; | 67 | ; |