]> git.immae.eu Git - github/shaarli/Shaarli.git/blob - tests/plugins/PluginPlayvideosTest.php
namespacing: add plugin tests to \Shaarli\Plugin\[...]
[github/shaarli/Shaarli.git] / tests / plugins / PluginPlayvideosTest.php
1 <?php
2 namespace Shaarli\Plugin\Playvideos;
3
4 /**
5 * PluginPlayvideosTest.php
6 */
7
8 use Shaarli\Plugin\PluginManager;
9 use Shaarli\Router;
10
11 require_once 'plugins/playvideos/playvideos.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 }