diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ApplicationUtilsTest.php | 6 | ||||
-rw-r--r-- | tests/bookmark/BookmarkFileServiceTest.php | 3 | ||||
-rw-r--r-- | tests/bookmark/BookmarkFilterTest.php | 4 | ||||
-rw-r--r-- | tests/legacy/LegacyLinkDBTest.php | 3 | ||||
-rw-r--r-- | tests/legacy/LegacyLinkFilterTest.php | 4 | ||||
-rw-r--r-- | tests/legacy/LegacyUpdaterTest.php | 6 | ||||
-rw-r--r-- | tests/netscape/BookmarkExportTest.php | 2 | ||||
-rw-r--r-- | tests/updater/UpdaterTest.php | 6 |
8 files changed, 14 insertions, 20 deletions
diff --git a/tests/ApplicationUtilsTest.php b/tests/ApplicationUtilsTest.php index 7ad1d34c..a232b351 100644 --- a/tests/ApplicationUtilsTest.php +++ b/tests/ApplicationUtilsTest.php | |||
@@ -144,10 +144,10 @@ class ApplicationUtilsTest extends \Shaarli\TestCase | |||
144 | 144 | ||
145 | /** | 145 | /** |
146 | * Test update checks - invalid Git branch | 146 | * Test update checks - invalid Git branch |
147 | * @expectedException Exception | ||
148 | */ | 147 | */ |
149 | public function testCheckUpdateInvalidGitBranch() | 148 | public function testCheckUpdateInvalidGitBranch() |
150 | { | 149 | { |
150 | $this->expectException(\Exception::class); | ||
151 | $this->expectExceptionMessageRegExp('/Invalid branch selected for updates/'); | 151 | $this->expectExceptionMessageRegExp('/Invalid branch selected for updates/'); |
152 | 152 | ||
153 | ApplicationUtils::checkUpdate('', 'null', 0, true, true, 'unstable'); | 153 | ApplicationUtils::checkUpdate('', 'null', 0, true, true, 'unstable'); |
@@ -261,10 +261,10 @@ class ApplicationUtilsTest extends \Shaarli\TestCase | |||
261 | 261 | ||
262 | /** | 262 | /** |
263 | * Check a unsupported PHP version | 263 | * Check a unsupported PHP version |
264 | * @expectedException Exception | ||
265 | */ | 264 | */ |
266 | public function testCheckSupportedPHPVersion51() | 265 | public function testCheckSupportedPHPVersion51() |
267 | { | 266 | { |
267 | $this->expectException(\Exception::class); | ||
268 | $this->expectExceptionMessageRegExp('/Your PHP version is obsolete/'); | 268 | $this->expectExceptionMessageRegExp('/Your PHP version is obsolete/'); |
269 | 269 | ||
270 | $this->assertTrue(ApplicationUtils::checkPHPVersion('5.3', '5.1.0')); | 270 | $this->assertTrue(ApplicationUtils::checkPHPVersion('5.3', '5.1.0')); |
@@ -272,10 +272,10 @@ class ApplicationUtilsTest extends \Shaarli\TestCase | |||
272 | 272 | ||
273 | /** | 273 | /** |
274 | * Check another unsupported PHP version | 274 | * Check another unsupported PHP version |
275 | * @expectedException Exception | ||
276 | */ | 275 | */ |
277 | public function testCheckSupportedPHPVersion52() | 276 | public function testCheckSupportedPHPVersion52() |
278 | { | 277 | { |
278 | $this->expectException(\Exception::class); | ||
279 | $this->expectExceptionMessageRegExp('/Your PHP version is obsolete/'); | 279 | $this->expectExceptionMessageRegExp('/Your PHP version is obsolete/'); |
280 | 280 | ||
281 | $this->assertTrue(ApplicationUtils::checkPHPVersion('5.3', '5.2')); | 281 | $this->assertTrue(ApplicationUtils::checkPHPVersion('5.3', '5.2')); |
diff --git a/tests/bookmark/BookmarkFileServiceTest.php b/tests/bookmark/BookmarkFileServiceTest.php index 51e71a85..c399822b 100644 --- a/tests/bookmark/BookmarkFileServiceTest.php +++ b/tests/bookmark/BookmarkFileServiceTest.php | |||
@@ -637,11 +637,10 @@ class BookmarkFileServiceTest extends TestCase | |||
637 | */ | 637 | */ |
638 | /** | 638 | /** |
639 | * Attempt to instantiate a LinkDB whereas the datastore is not writable | 639 | * Attempt to instantiate a LinkDB whereas the datastore is not writable |
640 | * | ||
641 | * @expectedException Shaarli\Bookmark\Exception\NotWritableDataStoreException | ||
642 | */ | 640 | */ |
643 | public function testConstructDatastoreNotWriteable() | 641 | public function testConstructDatastoreNotWriteable() |
644 | { | 642 | { |
643 | $this->expectException(\Shaarli\Bookmark\Exception\NotWritableDataStoreException::class); | ||
645 | $this->expectExceptionMessageRegExp('#Couldn\'t load data from the data store file "null".*#'); | 644 | $this->expectExceptionMessageRegExp('#Couldn\'t load data from the data store file "null".*#'); |
646 | 645 | ||
647 | $conf = new ConfigManager('tests/utils/config/configJson'); | 646 | $conf = new ConfigManager('tests/utils/config/configJson'); |
diff --git a/tests/bookmark/BookmarkFilterTest.php b/tests/bookmark/BookmarkFilterTest.php index 2f15cb3c..48c7f824 100644 --- a/tests/bookmark/BookmarkFilterTest.php +++ b/tests/bookmark/BookmarkFilterTest.php | |||
@@ -212,10 +212,10 @@ class BookmarkFilterTest extends TestCase | |||
212 | 212 | ||
213 | /** | 213 | /** |
214 | * Use an invalid date format | 214 | * Use an invalid date format |
215 | * @expectedException Exception | ||
216 | */ | 215 | */ |
217 | public function testFilterInvalidDayWithChars() | 216 | public function testFilterInvalidDayWithChars() |
218 | { | 217 | { |
218 | $this->expectException(\Exception::class); | ||
219 | $this->expectExceptionMessageRegExp('/Invalid date format/'); | 219 | $this->expectExceptionMessageRegExp('/Invalid date format/'); |
220 | 220 | ||
221 | self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, 'Rainy day, dream away'); | 221 | self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, 'Rainy day, dream away'); |
@@ -223,10 +223,10 @@ class BookmarkFilterTest extends TestCase | |||
223 | 223 | ||
224 | /** | 224 | /** |
225 | * Use an invalid date format | 225 | * Use an invalid date format |
226 | * @expectedException Exception | ||
227 | */ | 226 | */ |
228 | public function testFilterInvalidDayDigits() | 227 | public function testFilterInvalidDayDigits() |
229 | { | 228 | { |
229 | $this->expectException(\Exception::class); | ||
230 | $this->expectExceptionMessageRegExp('/Invalid date format/'); | 230 | $this->expectExceptionMessageRegExp('/Invalid date format/'); |
231 | 231 | ||
232 | self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, '20'); | 232 | self::$linkFilter->filter(BookmarkFilter::$FILTER_DAY, '20'); |
diff --git a/tests/legacy/LegacyLinkDBTest.php b/tests/legacy/LegacyLinkDBTest.php index 66746dfc..df2cad62 100644 --- a/tests/legacy/LegacyLinkDBTest.php +++ b/tests/legacy/LegacyLinkDBTest.php | |||
@@ -99,11 +99,10 @@ class LegacyLinkDBTest extends \Shaarli\TestCase | |||
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Attempt to instantiate a LinkDB whereas the datastore is not writable | 101 | * Attempt to instantiate a LinkDB whereas the datastore is not writable |
102 | * | ||
103 | * @expectedException Shaarli\Exceptions\IOException | ||
104 | */ | 102 | */ |
105 | public function testConstructDatastoreNotWriteable() | 103 | public function testConstructDatastoreNotWriteable() |
106 | { | 104 | { |
105 | $this->expectException(\Shaarli\Exceptions\IOException::class); | ||
107 | $this->expectExceptionMessageRegExp('/Error accessing "null"/'); | 106 | $this->expectExceptionMessageRegExp('/Error accessing "null"/'); |
108 | 107 | ||
109 | new LegacyLinkDB('null/store.db', false, false); | 108 | new LegacyLinkDB('null/store.db', false, false); |
diff --git a/tests/legacy/LegacyLinkFilterTest.php b/tests/legacy/LegacyLinkFilterTest.php index 82bc93d8..45d7754d 100644 --- a/tests/legacy/LegacyLinkFilterTest.php +++ b/tests/legacy/LegacyLinkFilterTest.php | |||
@@ -197,10 +197,10 @@ class LegacyLinkFilterTest extends \Shaarli\TestCase | |||
197 | 197 | ||
198 | /** | 198 | /** |
199 | * Use an invalid date format | 199 | * Use an invalid date format |
200 | * @expectedException Exception | ||
201 | */ | 200 | */ |
202 | public function testFilterInvalidDayWithChars() | 201 | public function testFilterInvalidDayWithChars() |
203 | { | 202 | { |
203 | $this->expectException(\Exception::class); | ||
204 | $this->expectExceptionMessageRegExp('/Invalid date format/'); | 204 | $this->expectExceptionMessageRegExp('/Invalid date format/'); |
205 | 205 | ||
206 | self::$linkFilter->filter(LegacyLinkFilter::$FILTER_DAY, 'Rainy day, dream away'); | 206 | self::$linkFilter->filter(LegacyLinkFilter::$FILTER_DAY, 'Rainy day, dream away'); |
@@ -208,10 +208,10 @@ class LegacyLinkFilterTest extends \Shaarli\TestCase | |||
208 | 208 | ||
209 | /** | 209 | /** |
210 | * Use an invalid date format | 210 | * Use an invalid date format |
211 | * @expectedException Exception | ||
212 | */ | 211 | */ |
213 | public function testFilterInvalidDayDigits() | 212 | public function testFilterInvalidDayDigits() |
214 | { | 213 | { |
214 | $this->expectException(\Exception::class); | ||
215 | $this->expectExceptionMessageRegExp('/Invalid date format/'); | 215 | $this->expectExceptionMessageRegExp('/Invalid date format/'); |
216 | 216 | ||
217 | self::$linkFilter->filter(LegacyLinkFilter::$FILTER_DAY, '20'); | 217 | self::$linkFilter->filter(LegacyLinkFilter::$FILTER_DAY, '20'); |
diff --git a/tests/legacy/LegacyUpdaterTest.php b/tests/legacy/LegacyUpdaterTest.php index 0ddcb4a6..f7391b86 100644 --- a/tests/legacy/LegacyUpdaterTest.php +++ b/tests/legacy/LegacyUpdaterTest.php | |||
@@ -80,11 +80,10 @@ class LegacyUpdaterTest extends \Shaarli\TestCase | |||
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Test errors in UpdaterUtils::write_updates_file(): empty updates file. | 82 | * Test errors in UpdaterUtils::write_updates_file(): empty updates file. |
83 | * | ||
84 | * @expectedException Exception | ||
85 | */ | 83 | */ |
86 | public function testWriteEmptyUpdatesFile() | 84 | public function testWriteEmptyUpdatesFile() |
87 | { | 85 | { |
86 | $this->expectException(\Exception::class); | ||
88 | $this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/'); | 87 | $this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/'); |
89 | 88 | ||
90 | UpdaterUtils::write_updates_file('', array('test')); | 89 | UpdaterUtils::write_updates_file('', array('test')); |
@@ -92,11 +91,10 @@ class LegacyUpdaterTest extends \Shaarli\TestCase | |||
92 | 91 | ||
93 | /** | 92 | /** |
94 | * Test errors in UpdaterUtils::write_updates_file(): not writable updates file. | 93 | * Test errors in UpdaterUtils::write_updates_file(): not writable updates file. |
95 | * | ||
96 | * @expectedException Exception | ||
97 | */ | 94 | */ |
98 | public function testWriteUpdatesFileNotWritable() | 95 | public function testWriteUpdatesFileNotWritable() |
99 | { | 96 | { |
97 | $this->expectException(\Exception::class); | ||
100 | $this->expectExceptionMessageRegExp('/Unable to write(.*)/'); | 98 | $this->expectExceptionMessageRegExp('/Unable to write(.*)/'); |
101 | 99 | ||
102 | $updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt'; | 100 | $updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt'; |
diff --git a/tests/netscape/BookmarkExportTest.php b/tests/netscape/BookmarkExportTest.php index adf62f4f..9b95ccc9 100644 --- a/tests/netscape/BookmarkExportTest.php +++ b/tests/netscape/BookmarkExportTest.php | |||
@@ -77,10 +77,10 @@ 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 | */ | 80 | */ |
82 | public function testFilterAndFormatInvalid() | 81 | public function testFilterAndFormatInvalid() |
83 | { | 82 | { |
83 | $this->expectException(\Exception::class); | ||
84 | $this->expectExceptionMessageRegExp('/Invalid export selection/'); | 84 | $this->expectExceptionMessageRegExp('/Invalid export selection/'); |
85 | 85 | ||
86 | $this->netscapeBookmarkUtils->filterAndFormat( | 86 | $this->netscapeBookmarkUtils->filterAndFormat( |
diff --git a/tests/updater/UpdaterTest.php b/tests/updater/UpdaterTest.php index 73029e07..a6280b8c 100644 --- a/tests/updater/UpdaterTest.php +++ b/tests/updater/UpdaterTest.php | |||
@@ -87,11 +87,10 @@ class UpdaterTest extends TestCase | |||
87 | 87 | ||
88 | /** | 88 | /** |
89 | * Test errors in UpdaterUtils::write_updates_file(): empty updates file. | 89 | * Test errors in UpdaterUtils::write_updates_file(): empty updates file. |
90 | * | ||
91 | * @expectedException Exception | ||
92 | */ | 90 | */ |
93 | public function testWriteEmptyUpdatesFile() | 91 | public function testWriteEmptyUpdatesFile() |
94 | { | 92 | { |
93 | $this->expectException(\Exception::class); | ||
95 | $this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/'); | 94 | $this->expectExceptionMessageRegExp('/Updates file path is not set(.*)/'); |
96 | 95 | ||
97 | UpdaterUtils::write_updates_file('', array('test')); | 96 | UpdaterUtils::write_updates_file('', array('test')); |
@@ -99,11 +98,10 @@ class UpdaterTest extends TestCase | |||
99 | 98 | ||
100 | /** | 99 | /** |
101 | * Test errors in UpdaterUtils::write_updates_file(): not writable updates file. | 100 | * Test errors in UpdaterUtils::write_updates_file(): not writable updates file. |
102 | * | ||
103 | * @expectedException Exception | ||
104 | */ | 101 | */ |
105 | public function testWriteUpdatesFileNotWritable() | 102 | public function testWriteUpdatesFileNotWritable() |
106 | { | 103 | { |
104 | $this->expectException(\Exception::class); | ||
107 | $this->expectExceptionMessageRegExp('/Unable to write(.*)/'); | 105 | $this->expectExceptionMessageRegExp('/Unable to write(.*)/'); |
108 | 106 | ||
109 | $updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt'; | 107 | $updatesFile = $this->conf->get('resource.data_dir') . '/updates.txt'; |