X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fapi%2Fcontrollers%2Flinks%2FGetLinkIdTest.php;h=8bb81dc8f8f1a7c313da25d9c8ce54c1c2dd9d25;hb=a975d97a8da64864c3c49f1c54f571eb4ea5b81a;hp=57528d5aee7c7372dee4dff3fd6f15abe0a6d8af;hpb=c9fcaaee931cca31e66ff594905e18e23a9f05ae;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/api/controllers/links/GetLinkIdTest.php b/tests/api/controllers/links/GetLinkIdTest.php index 57528d5a..8bb81dc8 100644 --- a/tests/api/controllers/links/GetLinkIdTest.php +++ b/tests/api/controllers/links/GetLinkIdTest.php @@ -2,8 +2,10 @@ namespace Shaarli\Api\Controllers; +use Shaarli\Bookmark\Bookmark; +use Shaarli\Bookmark\BookmarkFileService; use Shaarli\Config\ConfigManager; - +use Shaarli\History; use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; @@ -18,7 +20,7 @@ use Slim\Http\Response; * * @package Shaarli\Api\Controllers */ -class GetLinkIdTest extends \PHPUnit_Framework_TestCase +class GetLinkIdTest extends \PHPUnit\Framework\TestCase { /** * @var string datastore to test write operations @@ -51,17 +53,19 @@ class GetLinkIdTest extends \PHPUnit_Framework_TestCase const NB_FIELDS_LINK = 9; /** - * Before each test, instantiate a new Api with its config, plugins and links. + * Before each test, instantiate a new Api with its config, plugins and bookmarks. */ public function setUp() { $this->conf = new ConfigManager('tests/utils/config/configJson'); + $this->conf->set('resource.datastore', self::$testDatastore); $this->refDB = new \ReferenceLinkDB(); $this->refDB->write(self::$testDatastore); + $history = new History('sandbox/history.php'); $this->container = new Container(); $this->container['conf'] = $this->conf; - $this->container['db'] = new \LinkDB(self::$testDatastore, true, false); + $this->container['db'] = new BookmarkFileService($this->conf, $history, true); $this->container['history'] = null; $this->controller = new Links($this->container); @@ -98,7 +102,7 @@ class GetLinkIdTest extends \PHPUnit_Framework_TestCase $this->assertEquals($id, $data['id']); // Check link elements - $this->assertEquals('http://domain.tld/?WDWyig', $data['url']); + $this->assertEquals('http://domain.tld/shaare/WDWyig', $data['url']); $this->assertEquals('WDWyig', $data['shorturl']); $this->assertEquals('Link title: @website', $data['title']); $this->assertEquals( @@ -108,7 +112,7 @@ class GetLinkIdTest extends \PHPUnit_Framework_TestCase $this->assertEquals('sTuff', $data['tags'][0]); $this->assertEquals(false, $data['private']); $this->assertEquals( - \DateTime::createFromFormat(\LinkDB::LINK_DATE_FORMAT, '20150310_114651')->format(\DateTime::ATOM), + \DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651')->format(\DateTime::ATOM), $data['created'] ); $this->assertEmpty($data['updated']);