2015-11-07 16:30:56 +01:00
|
|
|
<?php
|
2018-12-04 23:17:23 +01:00
|
|
|
namespace Shaarli\Plugin\Playvideos;
|
2015-11-07 16:30:56 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* PluginPlayvideosTest.php
|
|
|
|
*/
|
|
|
|
|
2018-12-04 00:26:50 +01:00
|
|
|
use Shaarli\Plugin\PluginManager;
|
2020-07-06 08:04:35 +02:00
|
|
|
use Shaarli\Render\TemplatePage;
|
2018-12-04 00:02:17 +01:00
|
|
|
|
2015-11-07 16:30:56 +01:00
|
|
|
require_once 'plugins/playvideos/playvideos.php';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class PluginPlayvideosTest
|
|
|
|
* Unit test for the PlayVideos plugin
|
|
|
|
*/
|
2020-09-29 14:41:40 +02:00
|
|
|
class PluginPlayvideosTest extends \Shaarli\TestCase
|
2015-11-07 16:30:56 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Reset plugin path
|
|
|
|
*/
|
2020-09-26 15:08:39 +02:00
|
|
|
protected function setUp(): void
|
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);
|
2020-07-06 08:04:35 +02:00
|
|
|
$data['_PAGE_'] = TemplatePage::LINKLIST;
|
2015-11-07 16:30:56 +01:00
|
|
|
|
|
|
|
$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);
|
2020-07-06 08:04:35 +02:00
|
|
|
$data['_PAGE_'] = TemplatePage::LINKLIST;
|
2015-11-07 16:30:56 +01:00
|
|
|
|
|
|
|
$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);
|
|
|
|
}
|
|
|
|
}
|