X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fbookmark%2FLinkDBTest.php;fp=tests%2FLinkDBTest.php;h=ff5c0b970af1e8283d71e68606c3337e3d4c5936;hb=ff3b5dc5542ec150f0d9b447394364a15e9156d0;hp=c763c0cbd5f34ce7797658b7bcae2e72829f3290;hpb=1826e383ecf501302974132fd443cf1ca06e10f6;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/LinkDBTest.php b/tests/bookmark/LinkDBTest.php similarity index 95% rename from tests/LinkDBTest.php rename to tests/bookmark/LinkDBTest.php index c763c0cb..ff5c0b97 100644 --- a/tests/LinkDBTest.php +++ b/tests/bookmark/LinkDBTest.php @@ -3,9 +3,14 @@ * Link datastore tests */ -require_once 'application/Cache.php'; -require_once 'application/FileUtils.php'; -require_once 'application/LinkDB.php'; +namespace Shaarli\Bookmark; + +use DateTime; +use ReferenceLinkDB; +use ReflectionClass; +use Shaarli; + +require_once 'application/feed/Cache.php'; require_once 'application/Utils.php'; require_once 'tests/utils/ReferenceLinkDB.php'; @@ -13,7 +18,7 @@ require_once 'tests/utils/ReferenceLinkDB.php'; /** * Unitary tests for LinkDB */ -class LinkDBTest extends PHPUnit_Framework_TestCase +class LinkDBTest extends \PHPUnit\Framework\TestCase { // datastore to test write operations protected static $testDatastore = 'sandbox/datastore.php'; @@ -73,7 +78,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase */ protected static function getMethod($name) { - $class = new ReflectionClass('LinkDB'); + $class = new ReflectionClass('Shaarli\Bookmark\LinkDB'); $method = $class->getMethod($name); $method->setAccessible(true); return $method; @@ -100,7 +105,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase /** * Attempt to instantiate a LinkDB whereas the datastore is not writable * - * @expectedException IOException + * @expectedException Shaarli\Exceptions\IOException * @expectedExceptionMessageRegExp /Error accessing "null"/ */ public function testConstructDatastoreNotWriteable() @@ -187,12 +192,12 @@ class LinkDBTest extends PHPUnit_Framework_TestCase $link = array( 'id' => 42, - 'title'=>'an additional link', - 'url'=>'http://dum.my', - 'description'=>'One more', - 'private'=>0, - 'created'=> DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150518_190000'), - 'tags'=>'unit test' + 'title' => 'an additional link', + 'url' => 'http://dum.my', + 'description' => 'One more', + 'private' => 0, + 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150518_190000'), + 'tags' => 'unit test' ); $testDB[$link['id']] = $link; $testDB->save('tests'); @@ -451,7 +456,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase /** * Test filterHash() with an invalid smallhash. * - * @expectedException LinkNotFoundException + * @expectedException \Shaarli\Bookmark\Exception\LinkNotFoundException */ public function testFilterHashInValid1() { @@ -462,7 +467,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase /** * Test filterHash() with an empty smallhash. * - * @expectedException LinkNotFoundException + * @expectedException \Shaarli\Bookmark\Exception\LinkNotFoundException */ public function testFilterHashInValid() {