diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-02-09 20:54:56 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-03-10 18:46:53 +0100 |
commit | 48417aed1d83f1566c039529faf0354ec3b42e4b (patch) | |
tree | 60a6a584e1ee868165d97d2a9d51a546c720abbb /tests/NetscapeBookmarkUtils/BookmarkImportTest.php | |
parent | 844021ab4c0d3dd6c26704648a736fa53244c914 (diff) | |
download | Shaarli-48417aed1d83f1566c039529faf0354ec3b42e4b.tar.gz Shaarli-48417aed1d83f1566c039529faf0354ec3b42e4b.tar.zst Shaarli-48417aed1d83f1566c039529faf0354ec3b42e4b.zip |
Link imports are now logged in `data/` folder, and can be debug using `dev.debug=true` setting
related to #741 and #681
Diffstat (limited to 'tests/NetscapeBookmarkUtils/BookmarkImportTest.php')
-rw-r--r-- | tests/NetscapeBookmarkUtils/BookmarkImportTest.php | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/tests/NetscapeBookmarkUtils/BookmarkImportTest.php b/tests/NetscapeBookmarkUtils/BookmarkImportTest.php index 0ca07eac..36425d85 100644 --- a/tests/NetscapeBookmarkUtils/BookmarkImportTest.php +++ b/tests/NetscapeBookmarkUtils/BookmarkImportTest.php | |||
@@ -43,6 +43,11 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
43 | protected $pagecache = 'tests'; | 43 | protected $pagecache = 'tests'; |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * @var ConfigManager instance. | ||
47 | */ | ||
48 | protected $conf; | ||
49 | |||
50 | /** | ||
46 | * @var string Save the current timezone. | 51 | * @var string Save the current timezone. |
47 | */ | 52 | */ |
48 | protected static $defaultTimeZone; | 53 | protected static $defaultTimeZone; |
@@ -65,6 +70,8 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
65 | // start with an empty datastore | 70 | // start with an empty datastore |
66 | file_put_contents(self::$testDatastore, '<?php /* S7QysKquBQA= */ ?>'); | 71 | file_put_contents(self::$testDatastore, '<?php /* S7QysKquBQA= */ ?>'); |
67 | $this->linkDb = new LinkDB(self::$testDatastore, true, false); | 72 | $this->linkDb = new LinkDB(self::$testDatastore, true, false); |
73 | $this->conf = new ConfigManager('tests/utils/config/configJson'); | ||
74 | $this->conf->set('resource.page_cache', $this->pagecache); | ||
68 | } | 75 | } |
69 | 76 | ||
70 | public static function tearDownAfterClass() | 77 | public static function tearDownAfterClass() |
@@ -81,7 +88,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
81 | $this->assertEquals( | 88 | $this->assertEquals( |
82 | 'File empty.htm (0 bytes) has an unknown file format.' | 89 | 'File empty.htm (0 bytes) has an unknown file format.' |
83 | .' Nothing was imported.', | 90 | .' Nothing was imported.', |
84 | NetscapeBookmarkUtils::import(NULL, $files, NULL, NULL) | 91 | NetscapeBookmarkUtils::import(NULL, $files, NULL, $this->conf) |
85 | ); | 92 | ); |
86 | $this->assertEquals(0, count($this->linkDb)); | 93 | $this->assertEquals(0, count($this->linkDb)); |
87 | } | 94 | } |
@@ -94,7 +101,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
94 | $files = file2array('no_doctype.htm'); | 101 | $files = file2array('no_doctype.htm'); |
95 | $this->assertEquals( | 102 | $this->assertEquals( |
96 | 'File no_doctype.htm (350 bytes) has an unknown file format. Nothing was imported.', | 103 | 'File no_doctype.htm (350 bytes) has an unknown file format. Nothing was imported.', |
97 | NetscapeBookmarkUtils::import(NULL, $files, NULL, NULL) | 104 | NetscapeBookmarkUtils::import(NULL, $files, NULL, $this->conf) |
98 | ); | 105 | ); |
99 | $this->assertEquals(0, count($this->linkDb)); | 106 | $this->assertEquals(0, count($this->linkDb)); |
100 | } | 107 | } |
@@ -108,7 +115,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
108 | $this->assertEquals( | 115 | $this->assertEquals( |
109 | 'File internet_explorer_encoding.htm (356 bytes) was successfully processed:' | 116 | 'File internet_explorer_encoding.htm (356 bytes) was successfully processed:' |
110 | .' 1 links imported, 0 links overwritten, 0 links skipped.', | 117 | .' 1 links imported, 0 links overwritten, 0 links skipped.', |
111 | NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->pagecache) | 118 | NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->conf) |
112 | ); | 119 | ); |
113 | $this->assertEquals(1, count($this->linkDb)); | 120 | $this->assertEquals(1, count($this->linkDb)); |
114 | $this->assertEquals(0, count_private($this->linkDb)); | 121 | $this->assertEquals(0, count_private($this->linkDb)); |
@@ -137,7 +144,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
137 | $this->assertEquals( | 144 | $this->assertEquals( |
138 | 'File netscape_nested.htm (1337 bytes) was successfully processed:' | 145 | 'File netscape_nested.htm (1337 bytes) was successfully processed:' |
139 | .' 8 links imported, 0 links overwritten, 0 links skipped.', | 146 | .' 8 links imported, 0 links overwritten, 0 links skipped.', |
140 | NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->pagecache) | 147 | NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->conf) |
141 | ); | 148 | ); |
142 | $this->assertEquals(8, count($this->linkDb)); | 149 | $this->assertEquals(8, count($this->linkDb)); |
143 | $this->assertEquals(2, count_private($this->linkDb)); | 150 | $this->assertEquals(2, count_private($this->linkDb)); |
@@ -259,7 +266,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
259 | $this->assertEquals( | 266 | $this->assertEquals( |
260 | 'File netscape_basic.htm (482 bytes) was successfully processed:' | 267 | 'File netscape_basic.htm (482 bytes) was successfully processed:' |
261 | .' 2 links imported, 0 links overwritten, 0 links skipped.', | 268 | .' 2 links imported, 0 links overwritten, 0 links skipped.', |
262 | NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->pagecache) | 269 | NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->conf) |
263 | ); | 270 | ); |
264 | 271 | ||
265 | $this->assertEquals(2, count($this->linkDb)); | 272 | $this->assertEquals(2, count($this->linkDb)); |
@@ -304,7 +311,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
304 | $this->assertEquals( | 311 | $this->assertEquals( |
305 | 'File netscape_basic.htm (482 bytes) was successfully processed:' | 312 | 'File netscape_basic.htm (482 bytes) was successfully processed:' |
306 | .' 2 links imported, 0 links overwritten, 0 links skipped.', | 313 | .' 2 links imported, 0 links overwritten, 0 links skipped.', |
307 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) | 314 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf) |
308 | ); | 315 | ); |
309 | $this->assertEquals(2, count($this->linkDb)); | 316 | $this->assertEquals(2, count($this->linkDb)); |
310 | $this->assertEquals(1, count_private($this->linkDb)); | 317 | $this->assertEquals(1, count_private($this->linkDb)); |
@@ -348,7 +355,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
348 | $this->assertEquals( | 355 | $this->assertEquals( |
349 | 'File netscape_basic.htm (482 bytes) was successfully processed:' | 356 | 'File netscape_basic.htm (482 bytes) was successfully processed:' |
350 | .' 2 links imported, 0 links overwritten, 0 links skipped.', | 357 | .' 2 links imported, 0 links overwritten, 0 links skipped.', |
351 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) | 358 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf) |
352 | ); | 359 | ); |
353 | $this->assertEquals(2, count($this->linkDb)); | 360 | $this->assertEquals(2, count($this->linkDb)); |
354 | $this->assertEquals(0, count_private($this->linkDb)); | 361 | $this->assertEquals(0, count_private($this->linkDb)); |
@@ -372,7 +379,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
372 | $this->assertEquals( | 379 | $this->assertEquals( |
373 | 'File netscape_basic.htm (482 bytes) was successfully processed:' | 380 | 'File netscape_basic.htm (482 bytes) was successfully processed:' |
374 | .' 2 links imported, 0 links overwritten, 0 links skipped.', | 381 | .' 2 links imported, 0 links overwritten, 0 links skipped.', |
375 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) | 382 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf) |
376 | ); | 383 | ); |
377 | $this->assertEquals(2, count($this->linkDb)); | 384 | $this->assertEquals(2, count($this->linkDb)); |
378 | $this->assertEquals(2, count_private($this->linkDb)); | 385 | $this->assertEquals(2, count_private($this->linkDb)); |
@@ -398,7 +405,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
398 | $this->assertEquals( | 405 | $this->assertEquals( |
399 | 'File netscape_basic.htm (482 bytes) was successfully processed:' | 406 | 'File netscape_basic.htm (482 bytes) was successfully processed:' |
400 | .' 2 links imported, 0 links overwritten, 0 links skipped.', | 407 | .' 2 links imported, 0 links overwritten, 0 links skipped.', |
401 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) | 408 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf) |
402 | ); | 409 | ); |
403 | $this->assertEquals(2, count($this->linkDb)); | 410 | $this->assertEquals(2, count($this->linkDb)); |
404 | $this->assertEquals(2, count_private($this->linkDb)); | 411 | $this->assertEquals(2, count_private($this->linkDb)); |
@@ -418,7 +425,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
418 | $this->assertEquals( | 425 | $this->assertEquals( |
419 | 'File netscape_basic.htm (482 bytes) was successfully processed:' | 426 | 'File netscape_basic.htm (482 bytes) was successfully processed:' |
420 | .' 2 links imported, 2 links overwritten, 0 links skipped.', | 427 | .' 2 links imported, 2 links overwritten, 0 links skipped.', |
421 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) | 428 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf) |
422 | ); | 429 | ); |
423 | $this->assertEquals(2, count($this->linkDb)); | 430 | $this->assertEquals(2, count($this->linkDb)); |
424 | $this->assertEquals(0, count_private($this->linkDb)); | 431 | $this->assertEquals(0, count_private($this->linkDb)); |
@@ -444,7 +451,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
444 | $this->assertEquals( | 451 | $this->assertEquals( |
445 | 'File netscape_basic.htm (482 bytes) was successfully processed:' | 452 | 'File netscape_basic.htm (482 bytes) was successfully processed:' |
446 | .' 2 links imported, 0 links overwritten, 0 links skipped.', | 453 | .' 2 links imported, 0 links overwritten, 0 links skipped.', |
447 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) | 454 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf) |
448 | ); | 455 | ); |
449 | $this->assertEquals(2, count($this->linkDb)); | 456 | $this->assertEquals(2, count($this->linkDb)); |
450 | $this->assertEquals(0, count_private($this->linkDb)); | 457 | $this->assertEquals(0, count_private($this->linkDb)); |
@@ -465,7 +472,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
465 | $this->assertEquals( | 472 | $this->assertEquals( |
466 | 'File netscape_basic.htm (482 bytes) was successfully processed:' | 473 | 'File netscape_basic.htm (482 bytes) was successfully processed:' |
467 | .' 2 links imported, 2 links overwritten, 0 links skipped.', | 474 | .' 2 links imported, 2 links overwritten, 0 links skipped.', |
468 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) | 475 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf) |
469 | ); | 476 | ); |
470 | $this->assertEquals(2, count($this->linkDb)); | 477 | $this->assertEquals(2, count($this->linkDb)); |
471 | $this->assertEquals(2, count_private($this->linkDb)); | 478 | $this->assertEquals(2, count_private($this->linkDb)); |
@@ -489,7 +496,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
489 | $this->assertEquals( | 496 | $this->assertEquals( |
490 | 'File netscape_basic.htm (482 bytes) was successfully processed:' | 497 | 'File netscape_basic.htm (482 bytes) was successfully processed:' |
491 | .' 2 links imported, 0 links overwritten, 0 links skipped.', | 498 | .' 2 links imported, 0 links overwritten, 0 links skipped.', |
492 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) | 499 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf) |
493 | ); | 500 | ); |
494 | $this->assertEquals(2, count($this->linkDb)); | 501 | $this->assertEquals(2, count($this->linkDb)); |
495 | $this->assertEquals(0, count_private($this->linkDb)); | 502 | $this->assertEquals(0, count_private($this->linkDb)); |
@@ -499,7 +506,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
499 | $this->assertEquals( | 506 | $this->assertEquals( |
500 | 'File netscape_basic.htm (482 bytes) was successfully processed:' | 507 | 'File netscape_basic.htm (482 bytes) was successfully processed:' |
501 | .' 0 links imported, 0 links overwritten, 2 links skipped.', | 508 | .' 0 links imported, 0 links overwritten, 2 links skipped.', |
502 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) | 509 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf) |
503 | ); | 510 | ); |
504 | $this->assertEquals(2, count($this->linkDb)); | 511 | $this->assertEquals(2, count($this->linkDb)); |
505 | $this->assertEquals(0, count_private($this->linkDb)); | 512 | $this->assertEquals(0, count_private($this->linkDb)); |
@@ -518,7 +525,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
518 | $this->assertEquals( | 525 | $this->assertEquals( |
519 | 'File netscape_basic.htm (482 bytes) was successfully processed:' | 526 | 'File netscape_basic.htm (482 bytes) was successfully processed:' |
520 | .' 2 links imported, 0 links overwritten, 0 links skipped.', | 527 | .' 2 links imported, 0 links overwritten, 0 links skipped.', |
521 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) | 528 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf) |
522 | ); | 529 | ); |
523 | $this->assertEquals(2, count($this->linkDb)); | 530 | $this->assertEquals(2, count($this->linkDb)); |
524 | $this->assertEquals(0, count_private($this->linkDb)); | 531 | $this->assertEquals(0, count_private($this->linkDb)); |
@@ -545,7 +552,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
545 | $this->assertEquals( | 552 | $this->assertEquals( |
546 | 'File netscape_basic.htm (482 bytes) was successfully processed:' | 553 | 'File netscape_basic.htm (482 bytes) was successfully processed:' |
547 | .' 2 links imported, 0 links overwritten, 0 links skipped.', | 554 | .' 2 links imported, 0 links overwritten, 0 links skipped.', |
548 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->pagecache) | 555 | NetscapeBookmarkUtils::import($post, $files, $this->linkDb, $this->conf) |
549 | ); | 556 | ); |
550 | $this->assertEquals(2, count($this->linkDb)); | 557 | $this->assertEquals(2, count($this->linkDb)); |
551 | $this->assertEquals(0, count_private($this->linkDb)); | 558 | $this->assertEquals(0, count_private($this->linkDb)); |
@@ -570,7 +577,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
570 | $this->assertEquals( | 577 | $this->assertEquals( |
571 | 'File same_date.htm (453 bytes) was successfully processed:' | 578 | 'File same_date.htm (453 bytes) was successfully processed:' |
572 | .' 3 links imported, 0 links overwritten, 0 links skipped.', | 579 | .' 3 links imported, 0 links overwritten, 0 links skipped.', |
573 | NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->pagecache) | 580 | NetscapeBookmarkUtils::import(array(), $files, $this->linkDb, $this->conf) |
574 | ); | 581 | ); |
575 | $this->assertEquals(3, count($this->linkDb)); | 582 | $this->assertEquals(3, count($this->linkDb)); |
576 | $this->assertEquals(0, count_private($this->linkDb)); | 583 | $this->assertEquals(0, count_private($this->linkDb)); |