+
+ public function testImportCreateUpdateHistory()
+ {
+ $post = [
+ 'privacy' => 'public',
+ 'overwrite' => 'true',
+ ];
+ $files = file2array('netscape_basic.htm');
+ $nbLinks = 2;
+ NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf, $this->history);
+ $history = $this->history->getHistory();
+ $this->assertEquals($nbLinks, count($history));
+ foreach ($history as $value) {
+ $this->assertEquals(History::CREATED, $value['event']);
+ $this->assertTrue(new DateTime('-5 seconds') < $value['datetime']);
+ $this->assertTrue(is_int($value['id']));
+ }
+
+ // re-import as private, enable overwriting
+ NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf, $this->history);
+ $history = $this->history->getHistory();
+ $this->assertEquals($nbLinks * 2, count($history));
+ for ($i = 0 ; $i < $nbLinks ; $i++) {
+ $this->assertEquals(History::UPDATED, $history[$i]['event']);
+ $this->assertTrue(new DateTime('-5 seconds') < $history[$i]['datetime']);
+ $this->assertTrue(is_int($history[$i]['id']));
+ }
+ }