2 namespace Shaarli\Plugin\Wallabag
;
5 * Class WallabagInstanceTest
7 class WallabagInstanceTest
extends \PHPUnit\Framework\TestCase
10 * @var string wallabag url.
17 protected function setUp(): void
19 $this->instance
= 'http://some.url';
23 * Test WallabagInstance with API V1.
25 public function testWallabagInstanceV1()
27 $instance = new WallabagInstance($this->instance
, 1);
28 $expected = $this->instance
. '/?plainurl=';
29 $result = $instance->getWallabagUrl();
30 $this->assertEquals($expected, $result);
34 * Test WallabagInstance with API V2.
36 public function testWallabagInstanceV2()
38 $instance = new WallabagInstance($this->instance
, 2);
39 $expected = $this->instance
. '/bookmarklet?url=';
40 $result = $instance->getWallabagUrl();
41 $this->assertEquals($expected, $result);
45 * Test WallabagInstance with an invalid API version.
47 public function testWallabagInstanceInvalidVersion()
49 $instance = new WallabagInstance($this->instance
, false);
50 $expected = $this->instance
. '/?plainurl=';
51 $result = $instance->getWallabagUrl();
52 $this->assertEquals($expected, $result);
54 $instance = new WallabagInstance($this->instance
, 3);
55 $expected = $this->instance
. '/?plainurl=';
56 $result = $instance->getWallabagUrl();
57 $this->assertEquals($expected, $result);