public function testImportInternetExplorerEncoding()
{
$files = file2array('internet_explorer_encoding.htm');
- $this->assertEquals(
- 'File internet_explorer_encoding.htm (356 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File internet_explorer_encoding.htm (356 bytes) was successfully processed in %d seconds:'
.' 1 links imported, 0 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import([], $files, $this->linkDb, $this->conf, $this->history)
);
public function testImportNested()
{
$files = file2array('netscape_nested.htm');
- $this->assertEquals(
- 'File netscape_nested.htm (1337 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File netscape_nested.htm (1337 bytes) was successfully processed in %d seconds:'
.' 8 links imported, 0 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import([], $files, $this->linkDb, $this->conf, $this->history)
);
public function testImportDefaultPrivacyNoPost()
{
$files = file2array('netscape_basic.htm');
- $this->assertEquals(
- 'File netscape_basic.htm (482 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File netscape_basic.htm (482 bytes) was successfully processed in %d seconds:'
.' 2 links imported, 0 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import([], $files, $this->linkDb, $this->conf, $this->history)
);
{
$post = array('privacy' => 'default');
$files = file2array('netscape_basic.htm');
- $this->assertEquals(
- 'File netscape_basic.htm (482 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File netscape_basic.htm (482 bytes) was successfully processed in %d seconds:'
.' 2 links imported, 0 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf, $this->history)
);
{
$post = array('privacy' => 'public');
$files = file2array('netscape_basic.htm');
- $this->assertEquals(
- 'File netscape_basic.htm (482 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File netscape_basic.htm (482 bytes) was successfully processed in %d seconds:'
.' 2 links imported, 0 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf, $this->history)
);
{
$post = array('privacy' => 'private');
$files = file2array('netscape_basic.htm');
- $this->assertEquals(
- 'File netscape_basic.htm (482 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File netscape_basic.htm (482 bytes) was successfully processed in %d seconds:'
.' 2 links imported, 0 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf, $this->history)
);
// import links as private
$post = array('privacy' => 'private');
- $this->assertEquals(
- 'File netscape_basic.htm (482 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File netscape_basic.htm (482 bytes) was successfully processed in %d seconds:'
.' 2 links imported, 0 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf, $this->history)
);
'privacy' => 'public',
'overwrite' => 'true'
);
- $this->assertEquals(
- 'File netscape_basic.htm (482 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File netscape_basic.htm (482 bytes) was successfully processed in %d seconds:'
.' 2 links imported, 2 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf, $this->history)
);
// import links as public
$post = array('privacy' => 'public');
- $this->assertEquals(
- 'File netscape_basic.htm (482 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File netscape_basic.htm (482 bytes) was successfully processed in %d seconds:'
.' 2 links imported, 0 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf, $this->history)
);
'privacy' => 'private',
'overwrite' => 'true'
);
- $this->assertEquals(
- 'File netscape_basic.htm (482 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File netscape_basic.htm (482 bytes) was successfully processed in %d seconds:'
.' 2 links imported, 2 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf, $this->history)
);
{
$post = array('privacy' => 'public');
$files = file2array('netscape_basic.htm');
- $this->assertEquals(
- 'File netscape_basic.htm (482 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File netscape_basic.htm (482 bytes) was successfully processed in %d seconds:'
.' 2 links imported, 0 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf, $this->history)
);
// re-import as private, DO NOT enable overwriting
$post = array('privacy' => 'private');
- $this->assertEquals(
- 'File netscape_basic.htm (482 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File netscape_basic.htm (482 bytes) was successfully processed in %d seconds:'
.' 0 links imported, 0 links overwritten, 2 links skipped.',
NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf, $this->history)
);
'default_tags' => 'tag1,tag2 tag3'
);
$files = file2array('netscape_basic.htm');
- $this->assertEquals(
- 'File netscape_basic.htm (482 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File netscape_basic.htm (482 bytes) was successfully processed in %d seconds:'
.' 2 links imported, 0 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf, $this->history)
);
'default_tags' => 'tag1&,tag2 "tag3"'
);
$files = file2array('netscape_basic.htm');
- $this->assertEquals(
- 'File netscape_basic.htm (482 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File netscape_basic.htm (482 bytes) was successfully processed in %d seconds:'
.' 2 links imported, 0 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf, $this->history)
);
public function testImportSameDate()
{
$files = file2array('same_date.htm');
- $this->assertEquals(
- 'File same_date.htm (453 bytes) was successfully processed:'
+ $this->assertStringMatchesFormat(
+ 'File same_date.htm (453 bytes) was successfully processed in %d seconds:'
.' 3 links imported, 0 links overwritten, 0 links skipped.',
NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->conf, $this->history)
);
'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']));
- }
+ $this->assertEquals(1, count($history));
+ $this->assertEquals(History::IMPORT, $history[0]['event']);
+ $this->assertTrue(new DateTime('-5 seconds') < $history[0]['datetime']);
// 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']));
- }
+ $this->assertEquals(2, count($history));
+ $this->assertEquals(History::IMPORT, $history[0]['event']);
+ $this->assertTrue(new DateTime('-5 seconds') < $history[0]['datetime']);
+ $this->assertEquals(History::IMPORT, $history[1]['event']);
+ $this->assertTrue(new DateTime('-5 seconds') < $history[1]['datetime']);
}
}