2015-11-07 16:30:56 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PluginPlayvideosTest.php
|
|
|
|
*/
|
|
|
|
|
|
|
|
require_once 'plugins/playvideos/playvideos.php';
|
|
|
|
require_once 'application/Router.php';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class PluginPlayvideosTest
|
|
|
|
* Unit test for the PlayVideos plugin
|
|
|
|
*/
|
|
|
|
class PluginPlayvideosTest extends PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Reset plugin path
|
|
|
|
*/
|
2017-01-05 19:33:06 +01:00
|
|
|
public function setUp()
|
2015-11-07 16:30:56 +01:00
|
|
|
{
|
|
|
|
PluginManager::$PLUGINS_PATH = 'plugins';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test render_linklist hook.
|
|
|
|
*/
|
2017-01-05 19:33:06 +01:00
|
|
|
public function testPlayvideosHeader()
|
2015-11-07 16:30:56 +01:00
|
|
|
{
|
|
|
|
$str = 'stuff';
|
|
|
|
$data = array($str => $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.
|
|
|
|
*/
|
2017-01-05 19:33:06 +01:00
|
|
|
public function testPlayvideosFooter()
|
2015-11-07 16:30:56 +01:00
|
|
|
{
|
|
|
|
$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);
|
|
|
|
}
|
|
|
|
}
|