From 840caea64f8c37f035fb3525f63153eb68492731 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sat, 7 Nov 2015 16:30:56 +0100 Subject: Add unit tests for Playvideos plugin + coding style --- tests/plugins/PluginPlayvideosTest.php | 61 ++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/plugins/PluginPlayvideosTest.php (limited to 'tests/plugins') diff --git a/tests/plugins/PluginPlayvideosTest.php b/tests/plugins/PluginPlayvideosTest.php new file mode 100644 index 00000000..be1ef774 --- /dev/null +++ b/tests/plugins/PluginPlayvideosTest.php @@ -0,0 +1,61 @@ + $str); + $data['_PAGE_'] = Router::$PAGE_LINKLIST; + + $data = hook_playvideos_render_header($data); + $this->assertEquals($str, $data[$str]); + $this->assertEquals(1, count($data['buttons_toolbar'])); + + $data = array($str => $str); + $data['_PAGE_'] = $str; + $this->assertEquals($str, $data[$str]); + $this->assertArrayNotHasKey('buttons_toolbar', $data); + } + + /** + * Test render_footer hook. + */ + function testPlayvideosFooter() + { + $str = 'stuff'; + $data = array($str => $str); + $data['_PAGE_'] = Router::$PAGE_LINKLIST; + + $data = hook_playvideos_render_footer($data); + $this->assertEquals($str, $data[$str]); + $this->assertEquals(2, count($data['js_files'])); + + $data = array($str => $str); + $data['_PAGE_'] = $str; + $this->assertEquals($str, $data[$str]); + $this->assertArrayNotHasKey('js_files', $data); + } +} -- cgit v1.2.3