aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/front/controller/visitor/DailyControllerTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2021-02-04 10:57:44 +0100
committerGitHub <noreply@github.com>2021-02-04 10:57:44 +0100
commit8997ae6c8e24286f7d47981eaf905e80d2481c10 (patch)
tree9906b122998ca4420af68b1bb110033b99f7d8bf /tests/front/controller/visitor/DailyControllerTest.php
parent11edc143b42a7be09c0c9dc02730c83e8cbb73c2 (diff)
parent9b8c0a4560fa1d87cab1529099b1b4677e92e265 (diff)
downloadShaarli-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.php45
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);
5namespace Shaarli\Front\Controller\Visitor; 5namespace Shaarli\Front\Controller\Visitor;
6 6
7use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
8use Shaarli\Bookmark\SearchResult;
8use Shaarli\Feed\CachedPage; 9use Shaarli\Feed\CachedPage;
9use Shaarli\TestCase; 10use Shaarli\TestCase;
10use Slim\Http\Request; 11use 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 = [];