diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-09-12 12:14:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-12 12:14:18 +0200 |
commit | 6128ab6a55430a2b705be31ff417c0c552a0db1f (patch) | |
tree | ec34d0b3299cd64a8dd8bc8652b8c29558dbbdae /tests/bookmark/BookmarkInitializerTest.php | |
parent | e2dff28b44fafcf11a1db7985c50cd40e6945821 (diff) | |
parent | da7acb98302b99ec729bcde3e3c9f4bb164a1b34 (diff) | |
download | Shaarli-6128ab6a55430a2b705be31ff417c0c552a0db1f.tar.gz Shaarli-6128ab6a55430a2b705be31ff417c0c552a0db1f.tar.zst Shaarli-6128ab6a55430a2b705be31ff417c0c552a0db1f.zip |
Merge pull request #1552 from ArthurHoaro/feature/better-initializer
Diffstat (limited to 'tests/bookmark/BookmarkInitializerTest.php')
-rw-r--r-- | tests/bookmark/BookmarkInitializerTest.php | 70 |
1 files changed, 48 insertions, 22 deletions
diff --git a/tests/bookmark/BookmarkInitializerTest.php b/tests/bookmark/BookmarkInitializerTest.php index 3906cc7f..454269bb 100644 --- a/tests/bookmark/BookmarkInitializerTest.php +++ b/tests/bookmark/BookmarkInitializerTest.php | |||
@@ -37,7 +37,7 @@ class BookmarkInitializerTest extends TestCase | |||
37 | /** | 37 | /** |
38 | * Initialize an empty BookmarkFileService | 38 | * Initialize an empty BookmarkFileService |
39 | */ | 39 | */ |
40 | public function setUp() | 40 | public function setUp(): void |
41 | { | 41 | { |
42 | if (file_exists(self::$testDatastore)) { | 42 | if (file_exists(self::$testDatastore)) { |
43 | unlink(self::$testDatastore); | 43 | unlink(self::$testDatastore); |
@@ -64,17 +64,26 @@ class BookmarkInitializerTest extends TestCase | |||
64 | 64 | ||
65 | $this->initializer->initialize(); | 65 | $this->initializer->initialize(); |
66 | 66 | ||
67 | $this->assertEquals($refDB->countLinks() + 2, $this->bookmarkService->count()); | 67 | $this->assertEquals($refDB->countLinks() + 3, $this->bookmarkService->count()); |
68 | |||
68 | $bookmark = $this->bookmarkService->get(43); | 69 | $bookmark = $this->bookmarkService->get(43); |
69 | $this->assertEquals(43, $bookmark->getId()); | 70 | $this->assertStringStartsWith( |
70 | $this->assertEquals('My secret stuff... - Pastebin.com', $bookmark->getTitle()); | 71 | 'Shaarli will automatically pick up the thumbnail for links to a variety of websites.', |
72 | $bookmark->getDescription() | ||
73 | ); | ||
71 | $this->assertTrue($bookmark->isPrivate()); | 74 | $this->assertTrue($bookmark->isPrivate()); |
72 | 75 | ||
73 | $bookmark = $this->bookmarkService->get(44); | 76 | $bookmark = $this->bookmarkService->get(44); |
74 | $this->assertEquals(44, $bookmark->getId()); | 77 | $this->assertStringStartsWith( |
75 | $this->assertEquals( | 78 | 'Adding a shaare without entering a URL creates a text-only "note" post such as this one.', |
76 | 'The personal, minimalist, super-fast, database free, bookmarking service', | 79 | $bookmark->getDescription() |
77 | $bookmark->getTitle() | 80 | ); |
81 | $this->assertTrue($bookmark->isPrivate()); | ||
82 | |||
83 | $bookmark = $this->bookmarkService->get(45); | ||
84 | $this->assertStringStartsWith( | ||
85 | 'Welcome to Shaarli!', | ||
86 | $bookmark->getDescription() | ||
78 | ); | 87 | ); |
79 | $this->assertFalse($bookmark->isPrivate()); | 88 | $this->assertFalse($bookmark->isPrivate()); |
80 | 89 | ||
@@ -82,17 +91,26 @@ class BookmarkInitializerTest extends TestCase | |||
82 | 91 | ||
83 | // Reload from file | 92 | // Reload from file |
84 | $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, true); | 93 | $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, true); |
85 | $this->assertEquals($refDB->countLinks() + 2, $this->bookmarkService->count()); | 94 | $this->assertEquals($refDB->countLinks() + 3, $this->bookmarkService->count()); |
95 | |||
86 | $bookmark = $this->bookmarkService->get(43); | 96 | $bookmark = $this->bookmarkService->get(43); |
87 | $this->assertEquals(43, $bookmark->getId()); | 97 | $this->assertStringStartsWith( |
88 | $this->assertEquals('My secret stuff... - Pastebin.com', $bookmark->getTitle()); | 98 | 'Shaarli will automatically pick up the thumbnail for links to a variety of websites.', |
99 | $bookmark->getDescription() | ||
100 | ); | ||
89 | $this->assertTrue($bookmark->isPrivate()); | 101 | $this->assertTrue($bookmark->isPrivate()); |
90 | 102 | ||
91 | $bookmark = $this->bookmarkService->get(44); | 103 | $bookmark = $this->bookmarkService->get(44); |
92 | $this->assertEquals(44, $bookmark->getId()); | 104 | $this->assertStringStartsWith( |
93 | $this->assertEquals( | 105 | 'Adding a shaare without entering a URL creates a text-only "note" post such as this one.', |
94 | 'The personal, minimalist, super-fast, database free, bookmarking service', | 106 | $bookmark->getDescription() |
95 | $bookmark->getTitle() | 107 | ); |
108 | $this->assertTrue($bookmark->isPrivate()); | ||
109 | |||
110 | $bookmark = $this->bookmarkService->get(45); | ||
111 | $this->assertStringStartsWith( | ||
112 | 'Welcome to Shaarli!', | ||
113 | $bookmark->getDescription() | ||
96 | ); | 114 | ); |
97 | $this->assertFalse($bookmark->isPrivate()); | 115 | $this->assertFalse($bookmark->isPrivate()); |
98 | } | 116 | } |
@@ -107,17 +125,25 @@ class BookmarkInitializerTest extends TestCase | |||
107 | 125 | ||
108 | $this->initializer->initialize(); | 126 | $this->initializer->initialize(); |
109 | 127 | ||
110 | $this->assertEquals(2, $this->bookmarkService->count()); | 128 | $this->assertEquals(3, $this->bookmarkService->count()); |
111 | $bookmark = $this->bookmarkService->get(0); | 129 | $bookmark = $this->bookmarkService->get(0); |
112 | $this->assertEquals(0, $bookmark->getId()); | 130 | $this->assertStringStartsWith( |
113 | $this->assertEquals('My secret stuff... - Pastebin.com', $bookmark->getTitle()); | 131 | 'Shaarli will automatically pick up the thumbnail for links to a variety of websites.', |
132 | $bookmark->getDescription() | ||
133 | ); | ||
114 | $this->assertTrue($bookmark->isPrivate()); | 134 | $this->assertTrue($bookmark->isPrivate()); |
115 | 135 | ||
116 | $bookmark = $this->bookmarkService->get(1); | 136 | $bookmark = $this->bookmarkService->get(1); |
117 | $this->assertEquals(1, $bookmark->getId()); | 137 | $this->assertStringStartsWith( |
118 | $this->assertEquals( | 138 | 'Adding a shaare without entering a URL creates a text-only "note" post such as this one.', |
119 | 'The personal, minimalist, super-fast, database free, bookmarking service', | 139 | $bookmark->getDescription() |
120 | $bookmark->getTitle() | 140 | ); |
141 | $this->assertTrue($bookmark->isPrivate()); | ||
142 | |||
143 | $bookmark = $this->bookmarkService->get(2); | ||
144 | $this->assertStringStartsWith( | ||
145 | 'Welcome to Shaarli!', | ||
146 | $bookmark->getDescription() | ||
121 | ); | 147 | ); |
122 | $this->assertFalse($bookmark->isPrivate()); | 148 | $this->assertFalse($bookmark->isPrivate()); |
123 | } | 149 | } |