diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/formatter/BookmarkDefaultFormatterTest.php | 20 | ||||
-rw-r--r-- | tests/front/controller/admin/ShaareManageControllerTest/DeleteBookmarkTest.php | 6 |
2 files changed, 25 insertions, 1 deletions
diff --git a/tests/formatter/BookmarkDefaultFormatterTest.php b/tests/formatter/BookmarkDefaultFormatterTest.php index 3fc6f8dc..4fcc5dd1 100644 --- a/tests/formatter/BookmarkDefaultFormatterTest.php +++ b/tests/formatter/BookmarkDefaultFormatterTest.php | |||
@@ -289,4 +289,24 @@ class BookmarkDefaultFormatterTest extends TestCase | |||
289 | $link['taglist_html'] | 289 | $link['taglist_html'] |
290 | ); | 290 | ); |
291 | } | 291 | } |
292 | |||
293 | /** | ||
294 | * Test default formatting with formatter_settings.autolink set to false: | ||
295 | * URLs and hashtags should not be transformed | ||
296 | */ | ||
297 | public function testFormatDescriptionWithoutLinkification(): void | ||
298 | { | ||
299 | $this->conf->set('formatter_settings.autolink', false); | ||
300 | $this->formatter = new BookmarkDefaultFormatter($this->conf, false); | ||
301 | |||
302 | $bookmark = new Bookmark(); | ||
303 | $bookmark->setDescription('Hi!' . PHP_EOL . 'https://thisisaurl.tld #hashtag'); | ||
304 | |||
305 | $link = $this->formatter->format($bookmark); | ||
306 | |||
307 | static::assertSame( | ||
308 | 'Hi!<br />' . PHP_EOL . 'https://thisisaurl.tld #hashtag', | ||
309 | $link['description'] | ||
310 | ); | ||
311 | } | ||
292 | } | 312 | } |
diff --git a/tests/front/controller/admin/ShaareManageControllerTest/DeleteBookmarkTest.php b/tests/front/controller/admin/ShaareManageControllerTest/DeleteBookmarkTest.php index 770a16d7..a276d988 100644 --- a/tests/front/controller/admin/ShaareManageControllerTest/DeleteBookmarkTest.php +++ b/tests/front/controller/admin/ShaareManageControllerTest/DeleteBookmarkTest.php | |||
@@ -38,6 +38,8 @@ class DeleteBookmarkTest extends TestCase | |||
38 | { | 38 | { |
39 | $parameters = ['id' => '123']; | 39 | $parameters = ['id' => '123']; |
40 | 40 | ||
41 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli/subfolder/shaare/abcdef'; | ||
42 | |||
41 | $request = $this->createMock(Request::class); | 43 | $request = $this->createMock(Request::class); |
42 | $request | 44 | $request |
43 | ->method('getParam') | 45 | ->method('getParam') |
@@ -90,6 +92,8 @@ class DeleteBookmarkTest extends TestCase | |||
90 | { | 92 | { |
91 | $parameters = ['id' => '123 456 789']; | 93 | $parameters = ['id' => '123 456 789']; |
92 | 94 | ||
95 | $this->container->environment['HTTP_REFERER'] = 'http://shaarli/subfolder/?searchtags=abcdef'; | ||
96 | |||
93 | $request = $this->createMock(Request::class); | 97 | $request = $this->createMock(Request::class); |
94 | $request | 98 | $request |
95 | ->method('getParam') | 99 | ->method('getParam') |
@@ -152,7 +156,7 @@ class DeleteBookmarkTest extends TestCase | |||
152 | $result = $this->controller->deleteBookmark($request, $response); | 156 | $result = $this->controller->deleteBookmark($request, $response); |
153 | 157 | ||
154 | static::assertSame(302, $result->getStatusCode()); | 158 | static::assertSame(302, $result->getStatusCode()); |
155 | static::assertSame(['/subfolder/'], $result->getHeader('location')); | 159 | static::assertSame(['/subfolder/?searchtags=abcdef'], $result->getHeader('location')); |
156 | } | 160 | } |
157 | 161 | ||
158 | /** | 162 | /** |