]> git.immae.eu Git - github/shaarli/Shaarli.git/blame - tests/plugins/PluginPlayvideosTest.php
Compatibility with PHPUnit 9
[github/shaarli/Shaarli.git] / tests / plugins / PluginPlayvideosTest.php
CommitLineData
840caea6 1<?php
95854417 2namespace Shaarli\Plugin\Playvideos;
840caea6
A
3
4/**
5 * PluginPlayvideosTest.php
6 */
7
e1850388 8use Shaarli\Plugin\PluginManager;
1a8ac737 9use Shaarli\Render\TemplatePage;
a932f486 10
840caea6 11require_once 'plugins/playvideos/playvideos.php';
840caea6
A
12
13/**
14 * Class PluginPlayvideosTest
15 * Unit test for the PlayVideos plugin
16 */
a5a9cf23 17class PluginPlayvideosTest extends \Shaarli\TestCase
840caea6
A
18{
19 /**
20 * Reset plugin path
21 */
8f60e120 22 protected function setUp(): void
840caea6
A
23 {
24 PluginManager::$PLUGINS_PATH = 'plugins';
25 }
26
27 /**
28 * Test render_linklist hook.
29 */
93b1fe54 30 public function testPlayvideosHeader()
840caea6
A
31 {
32 $str = 'stuff';
33 $data = array($str => $str);
1a8ac737 34 $data['_PAGE_'] = TemplatePage::LINKLIST;
840caea6
A
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 */
93b1fe54 49 public function testPlayvideosFooter()
840caea6
A
50 {
51 $str = 'stuff';
52 $data = array($str => $str);
1a8ac737 53 $data['_PAGE_'] = TemplatePage::LINKLIST;
840caea6
A
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}