diff options
author | VirtualTam <virtualtam@flibidi.net> | 2016-01-02 20:09:29 +0100 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2016-01-02 20:09:29 +0100 |
commit | defc8a3f033a44602c598c2028a9ee3ee2a86d1d (patch) | |
tree | efb09f1c0d7b16e2c2dcb0313157d93ece6775b4 /tests/plugins/WallabagInstanceTest.php | |
parent | 66d86ea521d737b1bc92b16b9c9b4126f545916c (diff) | |
parent | 938d9cce77ed5098dd69643795cb4014f3688b35 (diff) | |
download | Shaarli-defc8a3f033a44602c598c2028a9ee3ee2a86d1d.tar.gz Shaarli-defc8a3f033a44602c598c2028a9ee3ee2a86d1d.tar.zst Shaarli-defc8a3f033a44602c598c2028a9ee3ee2a86d1d.zip |
Merge pull request #417 from ArthurHoaro/wallabag-improve
Wallabag plugin improvement
Diffstat (limited to 'tests/plugins/WallabagInstanceTest.php')
-rw-r--r-- | tests/plugins/WallabagInstanceTest.php | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/plugins/WallabagInstanceTest.php b/tests/plugins/WallabagInstanceTest.php new file mode 100644 index 00000000..7c14c1df --- /dev/null +++ b/tests/plugins/WallabagInstanceTest.php | |||
@@ -0,0 +1,60 @@ | |||
1 | <?php | ||
2 | |||
3 | require_once 'plugins/wallabag/WallabagInstance.php'; | ||
4 | |||
5 | /** | ||
6 | * Class WallabagInstanceTest | ||
7 | */ | ||
8 | class WallabagInstanceTest extends PHPUnit_Framework_TestCase | ||
9 | { | ||
10 | /** | ||
11 | * @var string wallabag url. | ||
12 | */ | ||
13 | private $instance; | ||
14 | |||
15 | /** | ||
16 | * Reset plugin path | ||
17 | */ | ||
18 | function setUp() | ||
19 | { | ||
20 | $this->instance = 'http://some.url'; | ||
21 | } | ||
22 | |||
23 | /** | ||
24 | * Test WallabagInstance with API V1. | ||
25 | */ | ||
26 | function testWallabagInstanceV1() | ||
27 | { | ||
28 | $instance = new WallabagInstance($this->instance, 1); | ||
29 | $expected = $this->instance . '/?plainurl='; | ||
30 | $result = $instance->getWallabagUrl(); | ||
31 | $this->assertEquals($expected, $result); | ||
32 | } | ||
33 | |||
34 | /** | ||
35 | * Test WallabagInstance with API V2. | ||
36 | */ | ||
37 | function testWallabagInstanceV2() | ||
38 | { | ||
39 | $instance = new WallabagInstance($this->instance, 2); | ||
40 | $expected = $this->instance . '/bookmarklet?url='; | ||
41 | $result = $instance->getWallabagUrl(); | ||
42 | $this->assertEquals($expected, $result); | ||
43 | } | ||
44 | |||
45 | /** | ||
46 | * Test WallabagInstance with an invalid API version. | ||
47 | */ | ||
48 | function testWallabagInstanceInvalidVersion() | ||
49 | { | ||
50 | $instance = new WallabagInstance($this->instance, false); | ||
51 | $expected = $this->instance . '/?plainurl='; | ||
52 | $result = $instance->getWallabagUrl(); | ||
53 | $this->assertEquals($expected, $result); | ||
54 | |||
55 | $instance = new WallabagInstance($this->instance, 3); | ||
56 | $expected = $this->instance . '/?plainurl='; | ||
57 | $result = $instance->getWallabagUrl(); | ||
58 | $this->assertEquals($expected, $result); | ||
59 | } | ||
60 | } | ||