diff options
author | VirtualTam <virtualtam@flibidi.net> | 2017-01-05 19:33:06 +0100 |
---|---|---|
committer | VirtualTam <virtualtam+github@flibidi.net> | 2017-01-05 19:52:04 +0100 |
commit | 93b1fe54fb99efff30eec0d405cc7319fbbc1f95 (patch) | |
tree | 21d2aa9b09c1944e19a4f8fe4741277a3213cc5b /tests/plugins/PluginQrcodeTest.php | |
parent | 724f1e322943b0506a4a4f17e78eaf4b2e464553 (diff) | |
download | Shaarli-93b1fe54fb99efff30eec0d405cc7319fbbc1f95.tar.gz Shaarli-93b1fe54fb99efff30eec0d405cc7319fbbc1f95.tar.zst Shaarli-93b1fe54fb99efff30eec0d405cc7319fbbc1f95.zip |
Cleanup: explicit method visibility
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
Diffstat (limited to 'tests/plugins/PluginQrcodeTest.php')
-rw-r--r-- | tests/plugins/PluginQrcodeTest.php | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/plugins/PluginQrcodeTest.php b/tests/plugins/PluginQrcodeTest.php new file mode 100644 index 00000000..211ee89c --- /dev/null +++ b/tests/plugins/PluginQrcodeTest.php | |||
@@ -0,0 +1,67 @@ | |||
1 | <?php | ||
2 | |||
3 | /** | ||
4 | * PluginQrcodeTest.php | ||
5 | */ | ||
6 | |||
7 | require_once 'plugins/qrcode/qrcode.php'; | ||
8 | require_once 'application/Router.php'; | ||
9 | |||
10 | /** | ||
11 | * Class PluginQrcodeTest | ||
12 | * Unit test for the QR-Code plugin | ||
13 | */ | ||
14 | class PluginQrcodeTest extends PHPUnit_Framework_TestCase | ||
15 | { | ||
16 | /** | ||
17 | * Reset plugin path | ||
18 | */ | ||
19 | public function setUp() { | ||
20 | PluginManager::$PLUGINS_PATH = 'plugins'; | ||
21 | } | ||
22 | |||
23 | /** | ||
24 | * Test render_linklist hook. | ||
25 | */ | ||
26 | public function testQrcodeLinklist() | ||
27 | { | ||
28 | $str = 'http://randomstr.com/test'; | ||
29 | $data = array( | ||
30 | 'title' => $str, | ||
31 | 'links' => array( | ||
32 | array( | ||
33 | 'url' => $str, | ||
34 | ) | ||
35 | ) | ||
36 | ); | ||
37 | |||
38 | $data = hook_qrcode_render_linklist($data); | ||
39 | $link = $data['links'][0]; | ||
40 | // data shouldn't be altered | ||
41 | $this->assertEquals($str, $data['title']); | ||
42 | $this->assertEquals($str, $link['url']); | ||
43 | |||
44 | // plugin data | ||
45 | $this->assertEquals(1, count($link['link_plugin'])); | ||
46 | $this->assertNotFalse(strpos($link['link_plugin'][0], $str)); | ||
47 | } | ||
48 | |||
49 | /** | ||
50 | * Test render_footer hook. | ||
51 | */ | ||
52 | public function testQrcodeFooter() | ||
53 | { | ||
54 | $str = 'stuff'; | ||
55 | $data = array($str => $str); | ||
56 | $data['_PAGE_'] = Router::$PAGE_LINKLIST; | ||
57 | |||
58 | $data = hook_qrcode_render_footer($data); | ||
59 | $this->assertEquals($str, $data[$str]); | ||
60 | $this->assertEquals(1, count($data['js_files'])); | ||
61 | |||
62 | $data = array($str => $str); | ||
63 | $data['_PAGE_'] = $str; | ||
64 | $this->assertEquals($str, $data[$str]); | ||
65 | $this->assertArrayNotHasKey('js_files', $data); | ||
66 | } | ||
67 | } | ||