*
* @package Shaarli\Api\Controllers
*/
-class GetLinkIdTest extends \PHPUnit\Framework\TestCase
+class GetLinkIdTest extends \Shaarli\TestCase
{
/**
* @var string datastore to test write operations
/**
* Before each test, instantiate a new Api with its config, plugins and bookmarks.
*/
- public function setUp()
+ protected function setUp(): void
{
$this->conf = new ConfigManager('tests/utils/config/configJson');
$this->conf->set('resource.datastore', self::$testDatastore);
/**
* After each test, remove the test datastore.
*/
- public function tearDown()
+ protected function tearDown(): void
{
@unlink(self::$testDatastore);
}
$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(
/**
* Test basic getLink service: get non existent link => ApiLinkNotFoundException.
- *
- * @expectedException Shaarli\Api\Exceptions\ApiLinkNotFoundException
- * @expectedExceptionMessage Link not found
*/
public function testGetLink404()
{
+ $this->expectException(\Shaarli\Api\Exceptions\ApiLinkNotFoundException::class);
+ $this->expectExceptionMessage('Link not found');
+
$env = Environment::mock([
'REQUEST_METHOD' => 'GET',
]);