From: ArthurHoaro Date: Sat, 7 Nov 2015 15:30:56 +0000 (+0100) Subject: Add unit tests for Playvideos plugin X-Git-Tag: v0.6.0~3^2~5^2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=refs%2Fpull%2F284%2Fhead;p=github%2Fshaarli%2FShaarli.git Add unit tests for Playvideos plugin + coding style --- diff --git a/plugins/playvideos/playvideos.php b/plugins/playvideos/playvideos.php index 9918453c..0a80aa58 100644 --- a/plugins/playvideos/playvideos.php +++ b/plugins/playvideos/playvideos.php @@ -1,12 +1,20 @@ $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); + } +}