$bookmark = $this->privateLinkDB->get(43);
$this->assertEquals(43, $bookmark->getId());
- $this->assertRegExp('/\?[\w\-]{6}/', $bookmark->getUrl());
+ $this->assertRegExp('#/shaare/[\w\-]{6}#', $bookmark->getUrl());
$this->assertRegExp('/[\w\-]{6}/', $bookmark->getShortUrl());
$this->assertEquals($bookmark->getUrl(), $bookmark->getTitle());
$this->assertEmpty($bookmark->getDescription());
$bookmark = $this->privateLinkDB->get(43);
$this->assertEquals(43, $bookmark->getId());
- $this->assertRegExp('/\?[\w\-]{6}/', $bookmark->getUrl());
+ $this->assertRegExp('#/shaare/[\w\-]{6}#', $bookmark->getUrl());
$this->assertRegExp('/[\w\-]{6}/', $bookmark->getShortUrl());
$this->assertEquals($bookmark->getUrl(), $bookmark->getTitle());
$this->assertEmpty($bookmark->getDescription());
$bookmark = $this->privateLinkDB->get(42);
$this->assertEquals(42, $bookmark->getId());
- $this->assertEquals('?WDWyig', $bookmark->getUrl());
+ $this->assertEquals('/shaare/WDWyig', $bookmark->getUrl());
$this->assertEquals('1eYJ1Q', $bookmark->getShortUrl());
$this->assertEquals('Note: I have a big ID but an old date', $bookmark->getTitle());
$this->assertEquals('Used to test bookmarks reordering.', $bookmark->getDescription());
$bookmark = $this->privateLinkDB->get(42);
$this->assertEquals(42, $bookmark->getId());
- $this->assertEquals('?WDWyig', $bookmark->getUrl());
+ $this->assertEquals('/shaare/WDWyig', $bookmark->getUrl());
$this->assertEquals('1eYJ1Q', $bookmark->getShortUrl());
$this->assertEquals('Note: I have a big ID but an old date', $bookmark->getTitle());
$this->assertEquals('Used to test bookmarks reordering.', $bookmark->getDescription());
public function testFilterHashValid()
{
$request = smallHash('20150310_114651');
- $this->assertEquals(
- 1,
- count($this->publicLinkDB->findByHash($request))
+ $this->assertSame(
+ $request,
+ $this->publicLinkDB->findByHash($request)->getShortUrl()
);
$request = smallHash('20150310_114633' . 8);
- $this->assertEquals(
- 1,
- count($this->publicLinkDB->findByHash($request))
+ $this->assertSame(
+ $request,
+ $this->publicLinkDB->findByHash($request)->getShortUrl()
);
}
/**
* Test filterHash() with an invalid smallhash.
- *
- * @expectedException \Shaarli\Bookmark\Exception\BookmarkNotFoundException
*/
public function testFilterHashInValid1()
{
+ $this->expectException(BookmarkNotFoundException::class);
+
$request = 'blabla';
$this->publicLinkDB->findByHash($request);
}
/**
* Test filterHash() with an empty smallhash.
- *
- * @expectedException \Shaarli\Bookmark\Exception\BookmarkNotFoundException
*/
public function testFilterHashInValid()
{
+ $this->expectException(BookmarkNotFoundException::class);
+
$this->publicLinkDB->findByHash('');
}