aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/bookmark/BookmarkTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-10-20 10:30:02 +0200
committerGitHub <noreply@github.com>2020-10-20 10:30:02 +0200
commitd8030c8155ee4c20573848b2444f6df0b65d1662 (patch)
treeb6c0b8208f004e1b2b37b1af54e8d4c40310d56e /tests/bookmark/BookmarkTest.php
parent9b3c1270bcbe4f8e30e0160da8badd43dd94871a (diff)
parent21e72da9ee34cec56b10c83ae0c75b4bf320dfcb (diff)
downloadShaarli-d8030c8155ee4c20573848b2444f6df0b65d1662.tar.gz
Shaarli-d8030c8155ee4c20573848b2444f6df0b65d1662.tar.zst
Shaarli-d8030c8155ee4c20573848b2444f6df0b65d1662.zip
Merge pull request #1584 from ArthurHoaro/feature/async-thumbnail-retrieval
Asynchronous retrieval of bookmark's thumbnails
Diffstat (limited to 'tests/bookmark/BookmarkTest.php')
-rw-r--r--tests/bookmark/BookmarkTest.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/bookmark/BookmarkTest.php b/tests/bookmark/BookmarkTest.php
index 4c7ae4c0..4c1ae25d 100644
--- a/tests/bookmark/BookmarkTest.php
+++ b/tests/bookmark/BookmarkTest.php
@@ -347,4 +347,48 @@ class BookmarkTest extends TestCase
347 $bookmark->deleteTag('nope'); 347 $bookmark->deleteTag('nope');
348 $this->assertEquals(['tag1', 'tag2', 'chair'], $bookmark->getTags()); 348 $this->assertEquals(['tag1', 'tag2', 'chair'], $bookmark->getTags());
349 } 349 }
350
351 /**
352 * Test shouldUpdateThumbnail() with bookmarks needing an update.
353 */
354 public function testShouldUpdateThumbnail(): void
355 {
356 $bookmark = (new Bookmark())->setUrl('http://domain.tld/with-image');
357
358 static::assertTrue($bookmark->shouldUpdateThumbnail());
359
360 $bookmark = (new Bookmark())
361 ->setUrl('http://domain.tld/with-image')
362 ->setThumbnail('unknown file')
363 ;
364
365 static::assertTrue($bookmark->shouldUpdateThumbnail());
366 }
367
368 /**
369 * Test shouldUpdateThumbnail() with bookmarks that should not update.
370 */
371 public function testShouldNotUpdateThumbnail(): void
372 {
373 $bookmark = (new Bookmark());
374
375 static::assertFalse($bookmark->shouldUpdateThumbnail());
376
377 $bookmark = (new Bookmark())
378 ->setUrl('ftp://domain.tld/other-protocol', ['ftp'])
379 ;
380
381 static::assertFalse($bookmark->shouldUpdateThumbnail());
382
383 $bookmark = (new Bookmark())
384 ->setUrl('http://domain.tld/with-image')
385 ->setThumbnail(__FILE__)
386 ;
387
388 static::assertFalse($bookmark->shouldUpdateThumbnail());
389
390 $bookmark = (new Bookmark())->setUrl('/shaare/abcdef');
391
392 static::assertFalse($bookmark->shouldUpdateThumbnail());
393 }
350} 394}