8 require_once 'plugins/qrcode/qrcode.php';
9 require_once 'application/Router.php';
12 * Class PluginQrcodeTest
13 * Unit test for the QR-Code plugin
15 class PluginQrcodeTest
extends PHPUnit_Framework_TestCase
20 public function setUp()
22 PluginManager
::$PLUGINS_PATH = 'plugins';
26 * Test render_linklist hook.
28 public function testQrcodeLinklist()
30 $str = 'http://randomstr.com/test';
40 $data = hook_qrcode_render_linklist($data);
41 $link = $data['links'][0];
42 // data shouldn't be altered
43 $this->assertEquals($str, $data['title']);
44 $this->assertEquals($str, $link['url']);
47 $this->assertEquals(1, count($link['link_plugin']));
48 $this->assertNotFalse(strpos($link['link_plugin'][0], $str));
52 * Test render_footer hook.
54 public function testQrcodeFooter()
57 $data = array($str => $str);
58 $data['_PAGE_'] = Router
::$PAGE_LINKLIST;
60 $data = hook_qrcode_render_footer($data);
61 $this->assertEquals($str, $data[$str]);
62 $this->assertEquals(1, count($data['js_files']));
64 $data = array($str => $str);
65 $data['_PAGE_'] = $str;
66 $this->assertEquals($str, $data[$str]);
67 $this->assertArrayNotHasKey('js_files', $data);