diff options
Diffstat (limited to 'tests/legacy/LegacyLinkDBTest.php')
-rw-r--r-- | tests/legacy/LegacyLinkDBTest.php | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/legacy/LegacyLinkDBTest.php b/tests/legacy/LegacyLinkDBTest.php index 0884ad03..df2cad62 100644 --- a/tests/legacy/LegacyLinkDBTest.php +++ b/tests/legacy/LegacyLinkDBTest.php | |||
@@ -18,7 +18,7 @@ require_once 'tests/utils/ReferenceLinkDB.php'; | |||
18 | /** | 18 | /** |
19 | * Unitary tests for LegacyLinkDBTest | 19 | * Unitary tests for LegacyLinkDBTest |
20 | */ | 20 | */ |
21 | class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase | 21 | class LegacyLinkDBTest extends \Shaarli\TestCase |
22 | { | 22 | { |
23 | // datastore to test write operations | 23 | // datastore to test write operations |
24 | protected static $testDatastore = 'sandbox/datastore.php'; | 24 | protected static $testDatastore = 'sandbox/datastore.php'; |
@@ -52,7 +52,7 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase | |||
52 | * | 52 | * |
53 | * Resets test data for each test | 53 | * Resets test data for each test |
54 | */ | 54 | */ |
55 | protected function setUp() | 55 | protected function setUp(): void |
56 | { | 56 | { |
57 | if (file_exists(self::$testDatastore)) { | 57 | if (file_exists(self::$testDatastore)) { |
58 | unlink(self::$testDatastore); | 58 | unlink(self::$testDatastore); |
@@ -99,12 +99,12 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\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 | * @expectedExceptionMessageRegExp /Error accessing "null"/ | ||
105 | */ | 102 | */ |
106 | public function testConstructDatastoreNotWriteable() | 103 | public function testConstructDatastoreNotWriteable() |
107 | { | 104 | { |
105 | $this->expectException(\Shaarli\Exceptions\IOException::class); | ||
106 | $this->expectExceptionMessageRegExp('/Error accessing "null"/'); | ||
107 | |||
108 | new LegacyLinkDB('null/store.db', false, false); | 108 | new LegacyLinkDB('null/store.db', false, false); |
109 | } | 109 | } |
110 | 110 | ||
@@ -257,7 +257,7 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase | |||
257 | $link = self::$publicLinkDB->getLinkFromUrl('http://mediagoblin.org/'); | 257 | $link = self::$publicLinkDB->getLinkFromUrl('http://mediagoblin.org/'); |
258 | 258 | ||
259 | $this->assertNotEquals(false, $link); | 259 | $this->assertNotEquals(false, $link); |
260 | $this->assertContains( | 260 | $this->assertContainsPolyfill( |
261 | 'A free software media publishing platform', | 261 | 'A free software media publishing platform', |
262 | $link['description'] | 262 | $link['description'] |
263 | ); | 263 | ); |
@@ -420,22 +420,22 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase | |||
420 | 420 | ||
421 | /** | 421 | /** |
422 | * Test filterHash() with an invalid smallhash. | 422 | * Test filterHash() with an invalid smallhash. |
423 | * | ||
424 | * @expectedException \Shaarli\Bookmark\Exception\BookmarkNotFoundException | ||
425 | */ | 423 | */ |
426 | public function testFilterHashInValid1() | 424 | public function testFilterHashInValid1() |
427 | { | 425 | { |
426 | $this->expectException(\Shaarli\Bookmark\Exception\BookmarkNotFoundException::class); | ||
427 | |||
428 | $request = 'blabla'; | 428 | $request = 'blabla'; |
429 | self::$publicLinkDB->filterHash($request); | 429 | self::$publicLinkDB->filterHash($request); |
430 | } | 430 | } |
431 | 431 | ||
432 | /** | 432 | /** |
433 | * Test filterHash() with an empty smallhash. | 433 | * Test filterHash() with an empty smallhash. |
434 | * | ||
435 | * @expectedException \Shaarli\Bookmark\Exception\BookmarkNotFoundException | ||
436 | */ | 434 | */ |
437 | public function testFilterHashInValid() | 435 | public function testFilterHashInValid() |
438 | { | 436 | { |
437 | $this->expectException(\Shaarli\Bookmark\Exception\BookmarkNotFoundException::class); | ||
438 | |||
439 | self::$publicLinkDB->filterHash(''); | 439 | self::$publicLinkDB->filterHash(''); |
440 | } | 440 | } |
441 | 441 | ||
@@ -470,9 +470,9 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase | |||
470 | 470 | ||
471 | $res = $linkDB->renameTag('cartoon', 'Taz'); | 471 | $res = $linkDB->renameTag('cartoon', 'Taz'); |
472 | $this->assertEquals(3, count($res)); | 472 | $this->assertEquals(3, count($res)); |
473 | $this->assertContains(' Taz ', $linkDB[4]['tags']); | 473 | $this->assertContainsPolyfill(' Taz ', $linkDB[4]['tags']); |
474 | $this->assertContains(' Taz ', $linkDB[1]['tags']); | 474 | $this->assertContainsPolyfill(' Taz ', $linkDB[1]['tags']); |
475 | $this->assertContains(' Taz ', $linkDB[0]['tags']); | 475 | $this->assertContainsPolyfill(' Taz ', $linkDB[0]['tags']); |
476 | } | 476 | } |
477 | 477 | ||
478 | /** | 478 | /** |
@@ -512,7 +512,7 @@ class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase | |||
512 | 512 | ||
513 | $res = $linkDB->renameTag('cartoon', null); | 513 | $res = $linkDB->renameTag('cartoon', null); |
514 | $this->assertEquals(3, count($res)); | 514 | $this->assertEquals(3, count($res)); |
515 | $this->assertNotContains('cartoon', $linkDB[4]['tags']); | 515 | $this->assertNotContainsPolyfill('cartoon', $linkDB[4]['tags']); |
516 | } | 516 | } |
517 | 517 | ||
518 | /** | 518 | /** |