]> git.immae.eu Git - github/shaarli/Shaarli.git/blame - tests/plugins/WallabagInstanceTest.php
Merge pull request #1234 from virtualtam/lint
[github/shaarli/Shaarli.git] / tests / plugins / WallabagInstanceTest.php
CommitLineData
938d9cce
A
1<?php
2
3require_once 'plugins/wallabag/WallabagInstance.php';
4
5/**
6 * Class WallabagInstanceTest
7 */
8class WallabagInstanceTest extends PHPUnit_Framework_TestCase
9{
10 /**
11 * @var string wallabag url.
12 */
13 private $instance;
14
15 /**
16 * Reset plugin path
17 */
93b1fe54 18 public function setUp()
938d9cce
A
19 {
20 $this->instance = 'http://some.url';
21 }
22
23 /**
24 * Test WallabagInstance with API V1.
25 */
93b1fe54 26 public function testWallabagInstanceV1()
938d9cce
A
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 */
93b1fe54 37 public function testWallabagInstanceV2()
938d9cce
A
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 */
93b1fe54 48 public function testWallabagInstanceInvalidVersion()
938d9cce
A
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}