diff options
author | ArthurHoaro <arthur@hoa.ro> | 2021-02-04 10:57:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-04 10:57:44 +0100 |
commit | 8997ae6c8e24286f7d47981eaf905e80d2481c10 (patch) | |
tree | 9906b122998ca4420af68b1bb110033b99f7d8bf /tests/front/controller/visitor/DailyControllerTest.php | |
parent | 11edc143b42a7be09c0c9dc02730c83e8cbb73c2 (diff) | |
parent | 9b8c0a4560fa1d87cab1529099b1b4677e92e265 (diff) | |
download | Shaarli-8997ae6c8e24286f7d47981eaf905e80d2481c10.tar.gz Shaarli-8997ae6c8e24286f7d47981eaf905e80d2481c10.tar.zst Shaarli-8997ae6c8e24286f7d47981eaf905e80d2481c10.zip |
Merge pull request #1697 from ArthurHoaro/feature/pagination
Handle pagination through BookmarkService
Diffstat (limited to 'tests/front/controller/visitor/DailyControllerTest.php')
-rw-r--r-- | tests/front/controller/visitor/DailyControllerTest.php | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/tests/front/controller/visitor/DailyControllerTest.php b/tests/front/controller/visitor/DailyControllerTest.php index 70fbce54..821ba321 100644 --- a/tests/front/controller/visitor/DailyControllerTest.php +++ b/tests/front/controller/visitor/DailyControllerTest.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\Feed\CachedPage; | 9 | use Shaarli\Feed\CachedPage; |
9 | use Shaarli\TestCase; | 10 | use Shaarli\TestCase; |
10 | use Slim\Http\Request; | 11 | use Slim\Http\Request; |
@@ -347,13 +348,15 @@ class DailyControllerTest extends TestCase | |||
347 | $request = $this->createMock(Request::class); | 348 | $request = $this->createMock(Request::class); |
348 | $response = new Response(); | 349 | $response = new Response(); |
349 | 350 | ||
350 | $this->container->bookmarkService->expects(static::once())->method('search')->willReturn([ | 351 | $this->container->bookmarkService->expects(static::once())->method('search')->willReturn( |
351 | (new Bookmark())->setId(1)->setCreated($dates[0])->setUrl('http://domain.tld/1'), | 352 | SearchResult::getSearchResult([ |
352 | (new Bookmark())->setId(2)->setCreated($dates[1])->setUrl('http://domain.tld/2'), | 353 | (new Bookmark())->setId(1)->setCreated($dates[0])->setUrl('http://domain.tld/1'), |
353 | (new Bookmark())->setId(3)->setCreated($dates[1])->setUrl('http://domain.tld/3'), | 354 | (new Bookmark())->setId(2)->setCreated($dates[1])->setUrl('http://domain.tld/2'), |
354 | (new Bookmark())->setId(4)->setCreated($dates[2])->setUrl('http://domain.tld/4'), | 355 | (new Bookmark())->setId(3)->setCreated($dates[1])->setUrl('http://domain.tld/3'), |
355 | (new Bookmark())->setId(5)->setCreated($dates[3])->setUrl('http://domain.tld/5'), | 356 | (new Bookmark())->setId(4)->setCreated($dates[2])->setUrl('http://domain.tld/4'), |
356 | ]); | 357 | (new Bookmark())->setId(5)->setCreated($dates[3])->setUrl('http://domain.tld/5'), |
358 | ]) | ||
359 | ); | ||
357 | 360 | ||
358 | $this->container->pageCacheManager | 361 | $this->container->pageCacheManager |
359 | ->expects(static::once()) | 362 | ->expects(static::once()) |
@@ -454,7 +457,9 @@ class DailyControllerTest extends TestCase | |||
454 | $request = $this->createMock(Request::class); | 457 | $request = $this->createMock(Request::class); |
455 | $response = new Response(); | 458 | $response = new Response(); |
456 | 459 | ||
457 | $this->container->bookmarkService->expects(static::once())->method('search')->willReturn([]); | 460 | $this->container->bookmarkService |
461 | ->expects(static::once())->method('search') | ||
462 | ->willReturn(SearchResult::getSearchResult([])); | ||
458 | 463 | ||
459 | // Save RainTPL assigned variables | 464 | // Save RainTPL assigned variables |
460 | $assignedVariables = []; | 465 | $assignedVariables = []; |
@@ -613,11 +618,13 @@ class DailyControllerTest extends TestCase | |||
613 | }); | 618 | }); |
614 | $response = new Response(); | 619 | $response = new Response(); |
615 | 620 | ||
616 | $this->container->bookmarkService->expects(static::once())->method('search')->willReturn([ | 621 | $this->container->bookmarkService->expects(static::once())->method('search')->willReturn( |
617 | (new Bookmark())->setId(1)->setCreated($dates[0])->setUrl('http://domain.tld/1'), | 622 | SearchResult::getSearchResult([ |
618 | (new Bookmark())->setId(2)->setCreated($dates[1])->setUrl('http://domain.tld/2'), | 623 | (new Bookmark())->setId(1)->setCreated($dates[0])->setUrl('http://domain.tld/1'), |
619 | (new Bookmark())->setId(3)->setCreated($dates[1])->setUrl('http://domain.tld/3'), | 624 | (new Bookmark())->setId(2)->setCreated($dates[1])->setUrl('http://domain.tld/2'), |
620 | ]); | 625 | (new Bookmark())->setId(3)->setCreated($dates[1])->setUrl('http://domain.tld/3'), |
626 | ]) | ||
627 | ); | ||
621 | 628 | ||
622 | // Save RainTPL assigned variables | 629 | // Save RainTPL assigned variables |
623 | $assignedVariables = []; | 630 | $assignedVariables = []; |
@@ -674,11 +681,13 @@ class DailyControllerTest extends TestCase | |||
674 | }); | 681 | }); |
675 | $response = new Response(); | 682 | $response = new Response(); |
676 | 683 | ||
677 | $this->container->bookmarkService->expects(static::once())->method('search')->willReturn([ | 684 | $this->container->bookmarkService->expects(static::once())->method('search')->willReturn( |
678 | (new Bookmark())->setId(1)->setCreated($dates[0])->setUrl('http://domain.tld/1'), | 685 | SearchResult::getSearchResult([ |
679 | (new Bookmark())->setId(2)->setCreated($dates[1])->setUrl('http://domain.tld/2'), | 686 | (new Bookmark())->setId(1)->setCreated($dates[0])->setUrl('http://domain.tld/1'), |
680 | (new Bookmark())->setId(3)->setCreated($dates[1])->setUrl('http://domain.tld/3'), | 687 | (new Bookmark())->setId(2)->setCreated($dates[1])->setUrl('http://domain.tld/2'), |
681 | ]); | 688 | (new Bookmark())->setId(3)->setCreated($dates[1])->setUrl('http://domain.tld/3'), |
689 | ]) | ||
690 | ); | ||
682 | 691 | ||
683 | // Save RainTPL assigned variables | 692 | // Save RainTPL assigned variables |
684 | $assignedVariables = []; | 693 | $assignedVariables = []; |