]>
Commit | Line | Data |
---|---|---|
840caea6 A |
1 | <?php |
2 | ||
3 | /** | |
4 | * PluginPlayvideosTest.php | |
5 | */ | |
6 | ||
a932f486 V |
7 | use Shaarli\Router; |
8 | ||
840caea6 A |
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 | */ | |
93b1fe54 | 21 | public function setUp() |
840caea6 A |
22 | { |
23 | PluginManager::$PLUGINS_PATH = 'plugins'; | |
24 | } | |
25 | ||
26 | /** | |
27 | * Test render_linklist hook. | |
28 | */ | |
93b1fe54 | 29 | public function testPlayvideosHeader() |
840caea6 A |
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 | */ | |
93b1fe54 | 48 | public function testPlayvideosFooter() |
840caea6 A |
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 | } |