use Shaarli;
use Shaarli\Bookmark\Bookmark;
-require_once 'application/feed/Cache.php';
require_once 'application/Utils.php';
require_once 'tests/utils/ReferenceLinkDB.php';
/**
* Unitary tests for LegacyLinkDBTest
*/
-class LegacyLinkDBTest extends \PHPUnit\Framework\TestCase
+class LegacyLinkDBTest extends \Shaarli\TestCase
{
// datastore to test write operations
protected static $testDatastore = 'sandbox/datastore.php';
*
* Resets test data for each test
*/
- protected function setUp()
+ protected function setUp(): void
{
if (file_exists(self::$testDatastore)) {
unlink(self::$testDatastore);
* Attempt to instantiate a LinkDB whereas the datastore is not writable
*
* @expectedException Shaarli\Exceptions\IOException
- * @expectedExceptionMessageRegExp /Error accessing "null"/
*/
public function testConstructDatastoreNotWriteable()
{
+ $this->expectExceptionMessageRegExp('/Error accessing "null"/');
+
new LegacyLinkDB('null/store.db', false, false);
}
$link = self::$publicLinkDB->getLinkFromUrl('http://mediagoblin.org/');
$this->assertNotEquals(false, $link);
- $this->assertContains(
+ $this->assertContainsPolyfill(
'A free software media publishing platform',
$link['description']
);
/**
* Test filterHash() with an invalid smallhash.
- *
- * @expectedException \Shaarli\Bookmark\Exception\BookmarkNotFoundException
*/
public function testFilterHashInValid1()
{
+ $this->expectException(\Shaarli\Bookmark\Exception\BookmarkNotFoundException::class);
+
$request = 'blabla';
self::$publicLinkDB->filterHash($request);
}
/**
* Test filterHash() with an empty smallhash.
- *
- * @expectedException \Shaarli\Bookmark\Exception\BookmarkNotFoundException
*/
public function testFilterHashInValid()
{
+ $this->expectException(\Shaarli\Bookmark\Exception\BookmarkNotFoundException::class);
+
self::$publicLinkDB->filterHash('');
}
$res = $linkDB->renameTag('cartoon', 'Taz');
$this->assertEquals(3, count($res));
- $this->assertContains(' Taz ', $linkDB[4]['tags']);
- $this->assertContains(' Taz ', $linkDB[1]['tags']);
- $this->assertContains(' Taz ', $linkDB[0]['tags']);
+ $this->assertContainsPolyfill(' Taz ', $linkDB[4]['tags']);
+ $this->assertContainsPolyfill(' Taz ', $linkDB[1]['tags']);
+ $this->assertContainsPolyfill(' Taz ', $linkDB[0]['tags']);
}
/**
$res = $linkDB->renameTag('cartoon', null);
$this->assertEquals(3, count($res));
- $this->assertNotContains('cartoon', $linkDB[4]['tags']);
+ $this->assertNotContainsPolyfill('cartoon', $linkDB[4]['tags']);
}
/**