aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/netscape
diff options
context:
space:
mode:
Diffstat (limited to 'tests/netscape')
-rw-r--r--tests/netscape/BookmarkExportTest.php9
-rw-r--r--tests/netscape/BookmarkImportTest.php10
2 files changed, 10 insertions, 9 deletions
diff --git a/tests/netscape/BookmarkExportTest.php b/tests/netscape/BookmarkExportTest.php
index 509da51d..9b95ccc9 100644
--- a/tests/netscape/BookmarkExportTest.php
+++ b/tests/netscape/BookmarkExportTest.php
@@ -2,12 +2,12 @@
2 2
3namespace Shaarli\Netscape; 3namespace Shaarli\Netscape;
4 4
5use PHPUnit\Framework\TestCase;
6use Shaarli\Bookmark\BookmarkFileService; 5use Shaarli\Bookmark\BookmarkFileService;
7use Shaarli\Config\ConfigManager; 6use Shaarli\Config\ConfigManager;
8use Shaarli\Formatter\BookmarkFormatter; 7use Shaarli\Formatter\BookmarkFormatter;
9use Shaarli\Formatter\FormatterFactory; 8use Shaarli\Formatter\FormatterFactory;
10use Shaarli\History; 9use Shaarli\History;
10use Shaarli\TestCase;
11 11
12require_once 'tests/utils/ReferenceLinkDB.php'; 12require_once 'tests/utils/ReferenceLinkDB.php';
13 13
@@ -54,7 +54,7 @@ class BookmarkExportTest extends TestCase
54 /** 54 /**
55 * Instantiate reference data 55 * Instantiate reference data
56 */ 56 */
57 public static function setUpBeforeClass() 57 public static function setUpBeforeClass(): void
58 { 58 {
59 static::$conf = new ConfigManager('tests/utils/config/configJson'); 59 static::$conf = new ConfigManager('tests/utils/config/configJson');
60 static::$conf->set('resource.datastore', static::$testDatastore); 60 static::$conf->set('resource.datastore', static::$testDatastore);
@@ -77,11 +77,12 @@ class BookmarkExportTest extends TestCase
77 77
78 /** 78 /**
79 * Attempt to export an invalid link selection 79 * Attempt to export an invalid link selection
80 * @expectedException Exception
81 * @expectedExceptionMessageRegExp /Invalid export selection/
82 */ 80 */
83 public function testFilterAndFormatInvalid() 81 public function testFilterAndFormatInvalid()
84 { 82 {
83 $this->expectException(\Exception::class);
84 $this->expectExceptionMessageRegExp('/Invalid export selection/');
85
85 $this->netscapeBookmarkUtils->filterAndFormat( 86 $this->netscapeBookmarkUtils->filterAndFormat(
86 self::$formatter, 87 self::$formatter,
87 'derp', 88 'derp',
diff --git a/tests/netscape/BookmarkImportTest.php b/tests/netscape/BookmarkImportTest.php
index f678e26b..c1e49b5f 100644
--- a/tests/netscape/BookmarkImportTest.php
+++ b/tests/netscape/BookmarkImportTest.php
@@ -3,13 +3,13 @@
3namespace Shaarli\Netscape; 3namespace Shaarli\Netscape;
4 4
5use DateTime; 5use DateTime;
6use PHPUnit\Framework\TestCase;
7use Psr\Http\Message\UploadedFileInterface; 6use Psr\Http\Message\UploadedFileInterface;
8use Shaarli\Bookmark\Bookmark; 7use Shaarli\Bookmark\Bookmark;
9use Shaarli\Bookmark\BookmarkFileService; 8use Shaarli\Bookmark\BookmarkFileService;
10use Shaarli\Bookmark\BookmarkFilter; 9use Shaarli\Bookmark\BookmarkFilter;
11use Shaarli\Config\ConfigManager; 10use Shaarli\Config\ConfigManager;
12use Shaarli\History; 11use Shaarli\History;
12use Shaarli\TestCase;
13use Slim\Http\UploadedFile; 13use Slim\Http\UploadedFile;
14 14
15/** 15/**
@@ -75,7 +75,7 @@ class BookmarkImportTest extends TestCase
75 */ 75 */
76 protected static $defaultTimeZone; 76 protected static $defaultTimeZone;
77 77
78 public static function setUpBeforeClass() 78 public static function setUpBeforeClass(): void
79 { 79 {
80 self::$defaultTimeZone = date_default_timezone_get(); 80 self::$defaultTimeZone = date_default_timezone_get();
81 // Timezone without DST for test consistency 81 // Timezone without DST for test consistency
@@ -85,7 +85,7 @@ class BookmarkImportTest extends TestCase
85 /** 85 /**
86 * Resets test data before each test 86 * Resets test data before each test
87 */ 87 */
88 protected function setUp() 88 protected function setUp(): void
89 { 89 {
90 if (file_exists(self::$testDatastore)) { 90 if (file_exists(self::$testDatastore)) {
91 unlink(self::$testDatastore); 91 unlink(self::$testDatastore);
@@ -104,12 +104,12 @@ class BookmarkImportTest extends TestCase
104 /** 104 /**
105 * Delete history file. 105 * Delete history file.
106 */ 106 */
107 public function tearDown() 107 protected function tearDown(): void
108 { 108 {
109 @unlink(self::$historyFilePath); 109 @unlink(self::$historyFilePath);
110 } 110 }
111 111
112 public static function tearDownAfterClass() 112 public static function tearDownAfterClass(): void
113 { 113 {
114 date_default_timezone_set(self::$defaultTimeZone); 114 date_default_timezone_set(self::$defaultTimeZone);
115 } 115 }