aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/front/controller/admin
diff options
context:
space:
mode:
Diffstat (limited to 'tests/front/controller/admin')
-rw-r--r--tests/front/controller/admin/ManageTagControllerTest.php9
-rw-r--r--tests/front/controller/admin/ThumbnailsControllerTest.php5
2 files changed, 8 insertions, 6 deletions
diff --git a/tests/front/controller/admin/ManageTagControllerTest.php b/tests/front/controller/admin/ManageTagControllerTest.php
index af6f273f..56a64cbb 100644
--- a/tests/front/controller/admin/ManageTagControllerTest.php
+++ b/tests/front/controller/admin/ManageTagControllerTest.php
@@ -6,6 +6,7 @@ namespace Shaarli\Front\Controller\Admin;
6 6
7use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
8use Shaarli\Bookmark\BookmarkFilter; 8use Shaarli\Bookmark\BookmarkFilter;
9use Shaarli\Bookmark\SearchResult;
9use Shaarli\Config\ConfigManager; 10use Shaarli\Config\ConfigManager;
10use Shaarli\Front\Exception\WrongTokenException; 11use Shaarli\Front\Exception\WrongTokenException;
11use Shaarli\Security\SessionManager; 12use Shaarli\Security\SessionManager;
@@ -100,11 +101,11 @@ class ManageTagControllerTest extends TestCase
100 ->expects(static::once()) 101 ->expects(static::once())
101 ->method('search') 102 ->method('search')
102 ->with(['searchtags' => 'old-tag'], BookmarkFilter::$ALL, true) 103 ->with(['searchtags' => 'old-tag'], BookmarkFilter::$ALL, true)
103 ->willReturnCallback(function () use ($bookmark1, $bookmark2): array { 104 ->willReturnCallback(function () use ($bookmark1, $bookmark2): SearchResult {
104 $bookmark1->expects(static::once())->method('renameTag')->with('old-tag', 'new-tag'); 105 $bookmark1->expects(static::once())->method('renameTag')->with('old-tag', 'new-tag');
105 $bookmark2->expects(static::once())->method('renameTag')->with('old-tag', 'new-tag'); 106 $bookmark2->expects(static::once())->method('renameTag')->with('old-tag', 'new-tag');
106 107
107 return [$bookmark1, $bookmark2]; 108 return SearchResult::getSearchResult([$bookmark1, $bookmark2]);
108 }) 109 })
109 ; 110 ;
110 $this->container->bookmarkService 111 $this->container->bookmarkService
@@ -153,11 +154,11 @@ class ManageTagControllerTest extends TestCase
153 ->expects(static::once()) 154 ->expects(static::once())
154 ->method('search') 155 ->method('search')
155 ->with(['searchtags' => 'old-tag'], BookmarkFilter::$ALL, true) 156 ->with(['searchtags' => 'old-tag'], BookmarkFilter::$ALL, true)
156 ->willReturnCallback(function () use ($bookmark1, $bookmark2): array { 157 ->willReturnCallback(function () use ($bookmark1, $bookmark2): SearchResult {
157 $bookmark1->expects(static::once())->method('deleteTag')->with('old-tag'); 158 $bookmark1->expects(static::once())->method('deleteTag')->with('old-tag');
158 $bookmark2->expects(static::once())->method('deleteTag')->with('old-tag'); 159 $bookmark2->expects(static::once())->method('deleteTag')->with('old-tag');
159 160
160 return [$bookmark1, $bookmark2]; 161 return SearchResult::getSearchResult([$bookmark1, $bookmark2]);
161 }) 162 })
162 ; 163 ;
163 $this->container->bookmarkService 164 $this->container->bookmarkService
diff --git a/tests/front/controller/admin/ThumbnailsControllerTest.php b/tests/front/controller/admin/ThumbnailsControllerTest.php
index e5749654..0c9b63c3 100644
--- a/tests/front/controller/admin/ThumbnailsControllerTest.php
+++ b/tests/front/controller/admin/ThumbnailsControllerTest.php
@@ -6,6 +6,7 @@ namespace Shaarli\Front\Controller\Admin;
6 6
7use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
8use Shaarli\Bookmark\Exception\BookmarkNotFoundException; 8use Shaarli\Bookmark\Exception\BookmarkNotFoundException;
9use Shaarli\Bookmark\SearchResult;
9use Shaarli\TestCase; 10use Shaarli\TestCase;
10use Shaarli\Thumbnailer; 11use Shaarli\Thumbnailer;
11use Slim\Http\Request; 12use Slim\Http\Request;
@@ -40,12 +41,12 @@ class ThumbnailsControllerTest extends TestCase
40 $this->container->bookmarkService 41 $this->container->bookmarkService
41 ->expects(static::once()) 42 ->expects(static::once())
42 ->method('search') 43 ->method('search')
43 ->willReturn([ 44 ->willReturn(SearchResult::getSearchResult([
44 (new Bookmark())->setId(1)->setUrl('http://url1.tld')->setTitle('Title 1'), 45 (new Bookmark())->setId(1)->setUrl('http://url1.tld')->setTitle('Title 1'),
45 (new Bookmark())->setId(2)->setUrl('?abcdef')->setTitle('Note 1'), 46 (new Bookmark())->setId(2)->setUrl('?abcdef')->setTitle('Note 1'),
46 (new Bookmark())->setId(3)->setUrl('http://url2.tld')->setTitle('Title 2'), 47 (new Bookmark())->setId(3)->setUrl('http://url2.tld')->setTitle('Title 2'),
47 (new Bookmark())->setId(4)->setUrl('ftp://domain.tld', ['ftp'])->setTitle('FTP'), 48 (new Bookmark())->setId(4)->setUrl('ftp://domain.tld', ['ftp'])->setTitle('FTP'),
48 ]) 49 ]))
49 ; 50 ;
50 51
51 $result = $this->controller->index($request, $response); 52 $result = $this->controller->index($request, $response);