aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bookmark/LinkUtilsTest.php13
-rw-r--r--tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php24
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/bookmark/LinkUtilsTest.php b/tests/bookmark/LinkUtilsTest.php
index 7d4a7b89..0d07897b 100644
--- a/tests/bookmark/LinkUtilsTest.php
+++ b/tests/bookmark/LinkUtilsTest.php
@@ -43,6 +43,19 @@ class LinkUtilsTest extends TestCase
43 } 43 }
44 44
45 /** 45 /**
46 * Test headers_extract_charset() when the charset is found with odd quotes.
47 */
48 public function testHeadersExtractExistentCharsetWithQuotes()
49 {
50 $charset = 'x-MacCroatian';
51 $headers = 'text/html; charset="' . $charset . '"otherstuff="test"';
52 $this->assertEquals(strtolower($charset), header_extract_charset($headers));
53
54 $headers = 'text/html; charset=\'' . $charset . '\'otherstuff="test"';
55 $this->assertEquals(strtolower($charset), header_extract_charset($headers));
56 }
57
58 /**
46 * Test headers_extract_charset() when the charset is not found. 59 * Test headers_extract_charset() when the charset is not found.
47 */ 60 */
48 public function testHeadersExtractNonExistentCharset() 61 public function testHeadersExtractNonExistentCharset()
diff --git a/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php b/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php
index 58eaaa9b..a5e2dbc5 100644
--- a/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php
+++ b/tests/front/controller/admin/ManageShaareControllerTest/SaveBookmarkTest.php
@@ -239,6 +239,30 @@ class SaveBookmarkTest extends TestCase
239 } 239 }
240 240
241 /** 241 /**
242 * Test save a bookmark - with ID #0
243 */
244 public function testSaveBookmarkWithIdZero(): void
245 {
246 $parameters = ['lf_id' => '0'];
247
248 $request = $this->createMock(Request::class);
249 $request
250 ->method('getParam')
251 ->willReturnCallback(function (string $key) use ($parameters): ?string {
252 return $parameters[$key] ?? null;
253 })
254 ;
255 $response = new Response();
256
257 $this->container->bookmarkService->expects(static::once())->method('exists')->with(0)->willReturn(true);
258 $this->container->bookmarkService->expects(static::once())->method('get')->with(0)->willReturn(new Bookmark());
259
260 $result = $this->controller->save($request, $response);
261
262 static::assertSame(302, $result->getStatusCode());
263 }
264
265 /**
242 * Change the password with a wrong existing password 266 * Change the password with a wrong existing password
243 */ 267 */
244 public function testSaveBookmarkFromBookmarklet(): void 268 public function testSaveBookmarkFromBookmarklet(): void