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;
*
* @package Shaarli\Api\Controllers
*/
-class GetLinkIdTest extends \PHPUnit_Framework_TestCase
+class GetLinkIdTest extends \PHPUnit\Framework\TestCase
{
/**
* @var string datastore to test write operations
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);
$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(
$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']);