]> git.immae.eu Git - github/shaarli/Shaarli.git/blob - tests/plugins/PluginPlayvideosTest.php
namespacing: \Shaarli\Router
[github/shaarli/Shaarli.git] / tests / plugins / PluginPlayvideosTest.php
1 <?php
2
3 /**
4 * PluginPlayvideosTest.php
5 */
6
7 use Shaarli\Router;
8
9 require_once 'plugins/playvideos/playvideos.php';
10 require_once 'application/Router.php';
11
12 /**
13 * Class PluginPlayvideosTest
14 * Unit test for the PlayVideos plugin
15 */
16 class PluginPlayvideosTest extends PHPUnit_Framework_TestCase
17 {
18 /**
19 * Reset plugin path
20 */
21 public function setUp()
22 {
23 PluginManager::$PLUGINS_PATH = 'plugins';
24 }
25
26 /**
27 * Test render_linklist hook.
28 */
29 public function testPlayvideosHeader()
30 {
31 $str = 'stuff';
32 $data = array($str => $str);
33 $data['_PAGE_'] = Router::$PAGE_LINKLIST;
34
35 $data = hook_playvideos_render_header($data);
36 $this->assertEquals($str, $data[$str]);
37 $this->assertEquals(1, count($data['buttons_toolbar']));
38
39 $data = array($str => $str);
40 $data['_PAGE_'] = $str;
41 $this->assertEquals($str, $data[$str]);
42 $this->assertArrayNotHasKey('buttons_toolbar', $data);
43 }
44
45 /**
46 * Test render_footer hook.
47 */
48 public function testPlayvideosFooter()
49 {
50 $str = 'stuff';
51 $data = array($str => $str);
52 $data['_PAGE_'] = Router::$PAGE_LINKLIST;
53
54 $data = hook_playvideos_render_footer($data);
55 $this->assertEquals($str, $data[$str]);
56 $this->assertEquals(2, count($data['js_files']));
57
58 $data = array($str => $str);
59 $data['_PAGE_'] = $str;
60 $this->assertEquals($str, $data[$str]);
61 $this->assertArrayNotHasKey('js_files', $data);
62 }
63 }