MDL-67707 core_h5p: add public H5P player methods

This commit is contained in:
Ferran Recio 2020-02-12 12:24:14 +01:00
parent 1e7e255d72
commit f3c7e00f13
4 changed files with 69 additions and 8 deletions

View file

@ -41,14 +41,14 @@ class helper_testcase extends \advanced_testcase {
/**
* Test the behaviour of get_display_options().
*
* @dataProvider get_display_options_provider
* @dataProvider display_options_provider
* @param bool $frame Whether the frame should be displayed or not
* @param bool $export Whether the export action button should be displayed or not
* @param bool $embed Whether the embed action button should be displayed or not
* @param bool $copyright Whether the copyright action button should be displayed or not
* @param int $expected The expectation with the displayoptions value
*/
public function test_get_display_options(bool $frame, bool $export, bool $embed, bool $copyright, int $expected): void {
public function test_display_options(bool $frame, bool $export, bool $embed, bool $copyright, int $expected): void {
$this->setRunTestInSeparateProcess(true);
$this->resetAfterTest();
@ -60,9 +60,16 @@ class helper_testcase extends \advanced_testcase {
'embed' => $embed,
'copyright' => $copyright,
];
$displayoptions = helper::get_display_options($core, $config);
// Test getting display options.
$displayoptions = helper::get_display_options($core, $config);
$this->assertEquals($expected, $displayoptions);
// Test decoding display options.
$decoded = helper::decode_display_options($core, $expected);
$this->assertEquals($decoded->export, $config->export);
$this->assertEquals($decoded->embed, $config->embed);
$this->assertEquals($decoded->copyright, $config->copyright);
}
/**
@ -70,7 +77,7 @@ class helper_testcase extends \advanced_testcase {
*
* @return array
*/
public function get_display_options_provider(): array {
public function display_options_provider(): array {
return [
'All display options disabled' => [
false,