]> git.immae.eu Git - github/shaarli/Shaarli.git/blame - tests/plugins/PluginAddlinkTest.php
fix translation string
[github/shaarli/Shaarli.git] / tests / plugins / PluginAddlinkTest.php
CommitLineData
ff5bda82
A
1<?php
2
3/**
4 * PluginPlayvideosTest.php
5 */
6
7require_once 'plugins/addlink_toolbar/addlink_toolbar.php';
8require_once 'application/Router.php';
9
10/**
11 * Class PluginAddlinkTest
12 * Unit test for the Addlink toolbar plugin
13 */
14class PluginAddlinkTest extends PHPUnit_Framework_TestCase
15{
16 /**
17 * Reset plugin path.
18 */
93b1fe54 19 public function setUp()
ff5bda82
A
20 {
21 PluginManager::$PLUGINS_PATH = 'plugins';
22 }
23
24 /**
25 * Test render_header hook while logged in.
26 */
93b1fe54 27 public function testAddlinkHeaderLoggedIn()
ff5bda82
A
28 {
29 $str = 'stuff';
30 $data = array($str => $str);
31 $data['_PAGE_'] = Router::$PAGE_LINKLIST;
32 $data['_LOGGEDIN_'] = true;
33
34 $data = hook_addlink_toolbar_render_header($data);
35 $this->assertEquals($str, $data[$str]);
36 $this->assertEquals(1, count($data['fields_toolbar']));
37
38 $data = array($str => $str);
39 $data['_PAGE_'] = $str;
40 $data['_LOGGEDIN_'] = true;
41 $data = hook_addlink_toolbar_render_header($data);
42 $this->assertEquals($str, $data[$str]);
43 $this->assertArrayNotHasKey('fields_toolbar', $data);
44 }
45
46 /**
47 * Test render_header hook while logged out.
48 */
93b1fe54 49 public function testAddlinkHeaderLoggedOut()
ff5bda82
A
50 {
51 $str = 'stuff';
52 $data = array($str => $str);
53 $data['_PAGE_'] = Router::$PAGE_LINKLIST;
54 $data['_LOGGEDIN_'] = false;
55
56 $data = hook_addlink_toolbar_render_header($data);
57 $this->assertEquals($str, $data[$str]);
58 $this->assertArrayNotHasKey('fields_toolbar', $data);
59 }
ff5bda82 60}