From 938d9cce77ed5098dd69643795cb4014f3688b35 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Tue, 22 Dec 2015 10:20:27 +0100 Subject: Wallabag plugin improvement * Fixes a bug where URL weren't properly encoded. * Adds Wallabag V2 support. * Adds a URL function to handle trailing slash. * UT. * README updated. --- tests/plugins/WallabagInstanceTest.php | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tests/plugins/WallabagInstanceTest.php (limited to 'tests/plugins/WallabagInstanceTest.php') 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 @@ +instance = 'http://some.url'; + } + + /** + * Test WallabagInstance with API V1. + */ + function testWallabagInstanceV1() + { + $instance = new WallabagInstance($this->instance, 1); + $expected = $this->instance . '/?plainurl='; + $result = $instance->getWallabagUrl(); + $this->assertEquals($expected, $result); + } + + /** + * Test WallabagInstance with API V2. + */ + function testWallabagInstanceV2() + { + $instance = new WallabagInstance($this->instance, 2); + $expected = $this->instance . '/bookmarklet?url='; + $result = $instance->getWallabagUrl(); + $this->assertEquals($expected, $result); + } + + /** + * Test WallabagInstance with an invalid API version. + */ + function testWallabagInstanceInvalidVersion() + { + $instance = new WallabagInstance($this->instance, false); + $expected = $this->instance . '/?plainurl='; + $result = $instance->getWallabagUrl(); + $this->assertEquals($expected, $result); + + $instance = new WallabagInstance($this->instance, 3); + $expected = $this->instance . '/?plainurl='; + $result = $instance->getWallabagUrl(); + $this->assertEquals($expected, $result); + } +} -- cgit v1.2.3