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