aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/bookmark/BookmarkInitializerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bookmark/BookmarkInitializerTest.php')
-rw-r--r--tests/bookmark/BookmarkInitializerTest.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/bookmark/BookmarkInitializerTest.php b/tests/bookmark/BookmarkInitializerTest.php
index d23eb069..3906cc7f 100644
--- a/tests/bookmark/BookmarkInitializerTest.php
+++ b/tests/bookmark/BookmarkInitializerTest.php
@@ -3,7 +3,6 @@
3namespace Shaarli\Bookmark; 3namespace Shaarli\Bookmark;
4 4
5use PHPUnit\Framework\TestCase; 5use PHPUnit\Framework\TestCase;
6use ReferenceLinkDB;
7use Shaarli\Config\ConfigManager; 6use Shaarli\Config\ConfigManager;
8use Shaarli\History; 7use Shaarli\History;
9 8
@@ -54,9 +53,9 @@ class BookmarkInitializerTest extends TestCase
54 } 53 }
55 54
56 /** 55 /**
57 * Test initialize() with an empty data store. 56 * Test initialize() with a data store containing bookmarks.
58 */ 57 */
59 public function testInitializeEmptyDataStore() 58 public function testInitializeNotEmptyDataStore(): void
60 { 59 {
61 $refDB = new \ReferenceLinkDB(); 60 $refDB = new \ReferenceLinkDB();
62 $refDB->write(self::$testDatastore); 61 $refDB->write(self::$testDatastore);
@@ -79,6 +78,8 @@ class BookmarkInitializerTest extends TestCase
79 ); 78 );
80 $this->assertFalse($bookmark->isPrivate()); 79 $this->assertFalse($bookmark->isPrivate());
81 80
81 $this->bookmarkService->save();
82
82 // Reload from file 83 // Reload from file
83 $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, true); 84 $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, true);
84 $this->assertEquals($refDB->countLinks() + 2, $this->bookmarkService->count()); 85 $this->assertEquals($refDB->countLinks() + 2, $this->bookmarkService->count());
@@ -97,10 +98,13 @@ class BookmarkInitializerTest extends TestCase
97 } 98 }
98 99
99 /** 100 /**
100 * Test initialize() with a data store containing bookmarks. 101 * Test initialize() with an a non existent datastore file .
101 */ 102 */
102 public function testInitializeNotEmptyDataStore() 103 public function testInitializeNonExistentDataStore(): void
103 { 104 {
105 $this->conf->set('resource.datastore', static::$testDatastore . '_empty');
106 $this->bookmarkService = new BookmarkFileService($this->conf, $this->history, true);
107
104 $this->initializer->initialize(); 108 $this->initializer->initialize();
105 109
106 $this->assertEquals(2, $this->bookmarkService->count()); 110 $this->assertEquals(2, $this->bookmarkService->count());