Merge branch 'MDL-71970-master' of git://github.com/sarjona/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2021-09-29 23:27:15 +02:00
commit 87e7bcb12a
28 changed files with 135 additions and 85 deletions

View File

@ -29,7 +29,7 @@ use stdClass;
use core_h5p\editor_ajax;
use core_h5p\file_storage;
use core_h5p\local\library\autoloader;
use H5PCore;
use Moodle\H5PCore;
/**
* H5P content bank manager class

View File

@ -129,7 +129,7 @@ class editor extends edit_content {
global $DB;
// The H5P libraries expect data->id as the H5P content id.
// The method \H5PCore::saveContent throws an error if id is set but empty.
// The method H5PCore::saveContent throws an error if id is set but empty.
if (empty($data->id)) {
unset($data->id);
} else {

View File

@ -25,6 +25,8 @@
use core_h5p\factory;
use core_h5p\framework;
use core_h5p\local\library\autoloader;
use Moodle\H5PCore;
use Moodle\H5PEditorEndpoints;
define('AJAX_SCRIPT', true);

View File

@ -24,9 +24,8 @@
namespace core_h5p;
defined('MOODLE_INTERNAL') || die();
use core\lock\lock_config;
use Moodle\H5PCore;
/**
* Contains API class for the H5P area.
@ -809,7 +808,7 @@ class api {
if ($deletefiletree) {
// Remove temp content folder.
\H5PCore::deleteFileTree($path);
H5PCore::deleteFileTree($path);
}
return $isvalid;

View File

@ -28,8 +28,9 @@ defined('MOODLE_INTERNAL') || die();
require_once("$CFG->libdir/filelib.php");
use H5PCore;
use H5PFrameworkInterface;
use Moodle\H5PCore;
use Moodle\H5PFrameworkInterface;
use Moodle\H5PHubEndpoints;
use stdClass;
use moodle_url;
use core_h5p\local\library\autoloader;
@ -41,7 +42,7 @@ use core_h5p\local\library\autoloader;
* @copyright 2019 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core extends \H5PCore {
class core extends H5PCore {
/** @var array The array containing all the present libraries */
protected $libraries;
@ -50,7 +51,7 @@ class core extends \H5PCore {
* Constructor for core_h5p/core.
*
* @param H5PFrameworkInterface $framework The frameworks implementation of the H5PFrameworkInterface
* @param string|\H5PFileStorage $path The H5P file storage directory or class
* @param string|H5PFileStorage $path The H5P file storage directory or class
* @param string $url The URL to the file storage directory
* @param string $language The language code. Defaults to english
* @param boolean $export Whether export is enabled
@ -213,7 +214,7 @@ class core extends \H5PCore {
if ($shoulddownload) {
$installed['id'] = $this->fetch_content_type($library);
if ($installed['id']) {
$installed['name'] = \H5PCore::libraryToString($library);
$installed['name'] = H5PCore::libraryToString($library);
$typesinstalled[] = $installed;
}
}
@ -292,9 +293,9 @@ class core extends \H5PCore {
*/
public function get_api_endpoint(?string $library = null, string $endpoint = 'content'): moodle_url {
if ($endpoint == 'site') {
$h5purl = \H5PHubEndpoints::createURL(\H5PHubEndpoints::SITES );
$h5purl = H5PHubEndpoints::createURL(H5PHubEndpoints::SITES );
} else if ($endpoint == 'content') {
$h5purl = \H5PHubEndpoints::createURL(\H5PHubEndpoints::CONTENT_TYPES ) . $library;
$h5purl = H5PHubEndpoints::createURL(H5PHubEndpoints::CONTENT_TYPES ) . $library;
}
return new moodle_url($h5purl);

View File

@ -26,8 +26,8 @@ namespace core_h5p;
use core_h5p\local\library\autoloader;
use core_h5p\output\h5peditor as editor_renderer;
use H5PCore;
use H5peditor;
use Moodle\H5PCore;
use Moodle\H5peditor;
use stdClass;
use coding_exception;
use MoodleQuickForm;

View File

@ -24,7 +24,7 @@
namespace core_h5p;
use H5PEditorAjaxInterface;
use Moodle\H5PEditorAjaxInterface;
use core\dml\table as dml_table;
/**

View File

@ -24,7 +24,7 @@
namespace core_h5p;
use H5peditorStorage;
use Moodle\H5peditorStorage;
use stdClass;
/**

View File

@ -28,10 +28,10 @@ namespace core_h5p;
defined('MOODLE_INTERNAL') || die();
use core_h5p\local\library\autoloader;
use H5PContentValidator as content_validator;
use H5peditor;
use H5PStorage as storage;
use H5PValidator as validator;
use Moodle\H5PContentValidator as content_validator;
use Moodle\H5peditor;
use Moodle\H5PStorage as storage;
use Moodle\H5PValidator as validator;
/**
* H5P factory class.
@ -122,9 +122,9 @@ class factory {
}
/**
* Returns an instance of the \H5PStorage class.
* Returns an instance of the H5PStorage class.
*
* @return \H5PStorage
* @return \Moodle\H5PStorage
*/
public function get_storage(): storage {
if (null === $this->storage) {
@ -135,9 +135,9 @@ class factory {
}
/**
* Returns an instance of the \H5PValidator class.
* Returns an instance of the H5PValidator class.
*
* @return \H5PValidator
* @return \Moodle\H5PValidator
*/
public function get_validator(): validator {
if (null === $this->validator) {
@ -148,9 +148,9 @@ class factory {
}
/**
* Returns an instance of the \H5PContentValidator class.
* Returns an instance of the H5PContentValidator class.
*
* @return \H5PContentValidator
* @return Moodle\H5PContentValidator
*/
public function get_content_validator(): content_validator {
if (null === $this->content_validator) {

View File

@ -24,8 +24,10 @@
namespace core_h5p;
use H5peditorFile;
use stored_file;
use Moodle\H5PCore;
use Moodle\H5peditorFile;
use Moodle\H5PFileStorage;
/**
* Class to handle storage and export of H5P Content.
@ -34,7 +36,7 @@ use stored_file;
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class file_storage implements \H5PFileStorage {
class file_storage implements H5PFileStorage {
/** The component for H5P. */
public const COMPONENT = 'core_h5p';
@ -84,7 +86,7 @@ class file_storage implements \H5PFileStorage {
'contextid' => $this->context->id,
'component' => self::COMPONENT,
'filearea' => self::LIBRARY_FILEAREA,
'filepath' => '/' . \H5PCore::libraryToString($library, true) . '/',
'filepath' => '/' . H5PCore::libraryToString($library, true) . '/',
'itemid' => $library['libraryId']
];
@ -160,7 +162,7 @@ class file_storage implements \H5PFileStorage {
* @param string $target Where the library folder will be saved
*/
public function exportLibrary($library, $target) {
$folder = \H5PCore::libraryToString($library, true);
$folder = H5PCore::libraryToString($library, true);
$this->export_file_tree($target . '/' . $folder, $this->context->id, self::LIBRARY_FILEAREA,
'/' . $folder . '/', $library['libraryId']);
}
@ -507,7 +509,7 @@ class file_storage implements \H5PFileStorage {
* @return void
*/
public function removeContentFile($file, $contentid): void {
// Although the interface defines $contentid as int, object given in \H5peditor::processParameters.
// Although the interface defines $contentid as int, object given in H5peditor::processParameters.
if (is_object($contentid)) {
$contentid = $contentid->id;
}

View File

@ -24,8 +24,8 @@
namespace core_h5p;
defined('MOODLE_INTERNAL') || die();
use Moodle\H5PFrameworkInterface;
use Moodle\H5PCore;
/**
* Moodle's implementation of the H5P framework interface.
*
@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2019 Mihail Geshoski <mihail@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class framework implements \H5PFrameworkInterface {
class framework implements H5PFrameworkInterface {
/** @var string The path to the last uploaded h5p */
private $lastuploadedfolder;
@ -490,7 +490,7 @@ class framework implements \H5PFrameworkInterface {
// Extract num from records.
foreach ($records as $addon) {
$addons[] = \H5PCore::snakeToCamel($addon);
$addons[] = H5PCore::snakeToCamel($addon);
}
return $addons;
@ -1198,7 +1198,7 @@ class framework implements \H5PFrameworkInterface {
'embedType' => 'iframe',
'disable' => $data->displayoptions,
'title' => $data->title,
'slug' => \H5PCore::slugify($data->title) . '-' . $data->id,
'slug' => H5PCore::slugify($data->title) . '-' . $data->id,
'filtered' => $data->filtered,
'libraryId' => $data->libraryid,
'libraryName' => $data->machinename,
@ -1267,7 +1267,7 @@ class framework implements \H5PFrameworkInterface {
$dependencies = array();
foreach ($data as $dependency) {
unset($dependency->unidepid);
$dependencies[$dependency->machine_name] = \H5PCore::snakeToCamel($dependency);
$dependencies[$dependency->machine_name] = H5PCore::snakeToCamel($dependency);
}
return $dependencies;
@ -1278,7 +1278,7 @@ class framework implements \H5PFrameworkInterface {
* Implements getOption.
*
* To avoid updating the cache libraries when using the Hub selector,
* {@link \H5PEditorAjax::isContentTypeCacheUpdated}, the setting content_type_cache_updated_at
* {@see \Moodle\H5PEditorAjax::isContentTypeCacheUpdated}, the setting content_type_cache_updated_at
* always return the current time.
*
* @param string $name Identifier for the setting
@ -1290,7 +1290,7 @@ class framework implements \H5PFrameworkInterface {
// For now, the download and the embed displayoptions are disabled by default, so only will be rendered when
// defined in the displayoptions DB field.
// This check should be removed if they are added as new H5P settings, to let admins to define the default value.
return \H5PDisplayOptionBehaviour::CONTROLLED_BY_AUTHOR_DEFAULT_OFF;
return \Moodle\H5PDisplayOptionBehaviour::CONTROLLED_BY_AUTHOR_DEFAULT_OFF;
}
// To avoid update the libraries cache using the Hub selector.
@ -1541,7 +1541,7 @@ class framework implements \H5PFrameworkInterface {
* Check whether a user has permissions to execute an action, such as embed H5P content.
* Implements hasPermission.
*
* @param \H5PPermission $permission Permission type
* @param H5PPermission $permission Permission type
* @param int $id Id need by platform to determine permission
* @return boolean true if the user can execute the action defined in $permission; false otherwise
*/

View File

@ -161,19 +161,20 @@ abstract class handler {
*/
protected static function get_class_list(): array {
return [
'H5PCore' => 'h5p.classes.php',
'H5PFrameworkInterface' => 'h5p.classes.php',
'H5PContentValidator' => 'h5p.classes.php',
'H5PValidator' => 'h5p.classes.php',
'H5PStorage' => 'h5p.classes.php',
'H5PDevelopment' => 'h5p-development.class.php',
'H5PFileStorage' => 'h5p-file-storage.interface.php',
'H5PMetadata' => 'h5p-metadata.class.php',
'H5peditor' => 'h5peditor.class.php',
'H5peditorStorage' => 'h5peditor-storage.interface.php',
'H5PEditorAjaxInterface' => 'h5peditor-ajax.interface.php',
'H5PEditorAjax' => 'h5peditor-ajax.class.php',
'H5peditorFile' => 'h5peditor-file.class.php',
'Moodle\H5PCore' => 'h5p.classes.php',
'Moodle\H5PFrameworkInterface' => 'h5p.classes.php',
'Moodle\H5PContentValidator' => 'h5p.classes.php',
'Moodle\H5PValidator' => 'h5p.classes.php',
'Moodle\H5PStorage' => 'h5p.classes.php',
'Moodle\H5PDevelopment' => 'h5p-development.class.php',
'Moodle\H5PFileStorage' => 'h5p-file-storage.interface.php',
'Moodle\H5PDefaultStorage' => 'h5p-default-storage.class.php',
'Moodle\H5PMetadata' => 'h5p-metadata.class.php',
'Moodle\H5peditor' => 'h5peditor.class.php',
'Moodle\H5peditorStorage' => 'h5peditor-storage.interface.php',
'Moodle\H5PEditorAjaxInterface' => 'h5peditor-ajax.interface.php',
'Moodle\H5PEditorAjax' => 'h5peditor-ajax.class.php',
'Moodle\H5peditorFile' => 'h5peditor-file.class.php',
];
}
}

View File

@ -1,5 +1,6 @@
<?php
namespace Moodle;
/**
* File info?
*/
@ -9,13 +10,13 @@
* operations using PHP's standard file operation functions.
*
* Some implementations of H5P that doesn't use the standard file system will
* want to create their own implementation of the \H5P\FileStorage interface.
* want to create their own implementation of the H5PFileStorage interface.
*
* @package H5P
* @copyright 2016 Joubel AS
* @license MIT
*/
class H5PDefaultStorage implements \H5PFileStorage {
class H5PDefaultStorage implements H5PFileStorage {
private $path, $alteditorpath;
/**
@ -39,10 +40,10 @@ class H5PDefaultStorage implements \H5PFileStorage {
* Library properties
*/
public function saveLibrary($library) {
$dest = $this->path . '/libraries/' . \H5PCore::libraryToString($library, TRUE);
$dest = $this->path . '/libraries/' . H5PCore::libraryToString($library, TRUE);
// Make sure destination dir doesn't exist
\H5PCore::deleteFileTree($dest);
H5PCore::deleteFileTree($dest);
// Move library folder
self::copyFileTree($library['uploadDirectory'], $dest);
@ -60,7 +61,7 @@ class H5PDefaultStorage implements \H5PFileStorage {
$dest = "{$this->path}/content/{$content['id']}";
// Remove any old content
\H5PCore::deleteFileTree($dest);
H5PCore::deleteFileTree($dest);
self::copyFileTree($source, $dest);
}
@ -72,7 +73,7 @@ class H5PDefaultStorage implements \H5PFileStorage {
* Content properties
*/
public function deleteContent($content) {
\H5PCore::deleteFileTree("{$this->path}/content/{$content['id']}");
H5PCore::deleteFileTree("{$this->path}/content/{$content['id']}");
}
/**
@ -133,7 +134,7 @@ class H5PDefaultStorage implements \H5PFileStorage {
* Folder that library resides in
*/
public function exportLibrary($library, $target, $developmentPath=NULL) {
$folder = \H5PCore::libraryToString($library, TRUE);
$folder = H5PCore::libraryToString($library, TRUE);
$srcPath = ($developmentPath === NULL ? "/libraries/{$folder}" : $developmentPath);
self::copyFileTree("{$this->path}{$srcPath}", "{$target}/{$folder}");
}

View File

@ -1,5 +1,7 @@
<?php
namespace Moodle;
/**
* This is a data layer which uses the file system so it isn't specific to any framework.
*/

View File

@ -1,5 +1,7 @@
<?php
namespace Moodle;
/**
* The base class for H5P events. Extend to track H5P events in your system.
*

View File

@ -1,5 +1,7 @@
<?php
namespace Moodle;
/**
* File info?
*/

View File

@ -1,4 +1,7 @@
<?php
namespace Moodle;
/**
* Utility class for handling metadata
*/

View File

@ -1,4 +1,9 @@
<?php
namespace Moodle;
use ZipArchive;
/**
* Interface defining functions the h5p library needs the framework to implement
*/
@ -2057,7 +2062,7 @@ class H5PCore {
*
* @param H5PFrameworkInterface $H5PFramework
* The frameworks implementation of the H5PFrameworkInterface
* @param string|\H5PFileStorage $path H5P file storage directory or class.
* @param string|H5PFileStorage $path H5P file storage directory or class.
* @param string $url To file storage directory.
* @param string $language code. Defaults to english.
* @param boolean $export enabled?
@ -2065,7 +2070,7 @@ class H5PCore {
public function __construct(H5PFrameworkInterface $H5PFramework, $path, $url, $language = 'en', $export = FALSE) {
$this->h5pF = $H5PFramework;
$this->fs = ($path instanceof \H5PFileStorage ? $path : new \H5PDefaultStorage($path));
$this->fs = ($path instanceof H5PFileStorage ? $path : new H5PDefaultStorage($path));
$this->url = $url;
$this->exportEnabled = $export;

View File

@ -19,13 +19,13 @@ Downloaded version: 1.24.2 release
Changes:
1. In order to allow the dependency path to be overridden by child H5PCore classes, a couple of minor changes have been added to the
h5p.classes.php file:
- Into the getDependenciesFiles method, the line 2435:
- Into the getDependenciesFiles method, the line 2440:
$dependency['path'] = 'libraries/' . H5PCore::libraryToString($dependency, TRUE);
has been changed to:
$dependency['path'] = $this->getDependencyPath($dependency);
- The method getDependencyPath has been added (line 2455). It might be rewritten by child classes.
- The method getDependencyPath has been added (line 2466). It might be rewritten by child classes.
A PR has been sent to the H5P library with these changes:
https://github.com/h5p/h5p-php-library/compare/master...andrewnicols:libraryPathSubclass
Hopefully, when upgrading, these patch won't be needed because it will be included in the H5P library by default.
@ -74,3 +74,11 @@ with the previous patched and minified JQuery version.
*
* @member
*/
4. Add namespace to this library to avoid collision. It means:
- Add the "namespace Moodle;" line at the top of all the h5p*.php files in the root folder.
- Replace \H5Pxxx uses to H5Pxxx (for instance, in h5p-default-storage.class.php there are several references to \H5PCore that
must be replaced with H5PCore).
- Add "use ZipArchive;" in h5p.classes.h5p (check that it's still used before replacing it when upgrading the library).

View File

@ -1,5 +1,7 @@
<?php
namespace Moodle;
abstract class H5PEditorEndpoints {
/**
@ -54,7 +56,7 @@ abstract class H5PEditorEndpoints {
class H5PEditorAjax {
/**
* @var \H5PCore
* @var H5PCore
*/
public $core;
@ -225,7 +227,7 @@ class H5PEditorAjax {
private function isValidEditorToken($token) {
$isValidToken = $this->editor->ajaxInterface->validateEditorToken($token);
if (!$isValidToken) {
\H5PCore::ajaxError(
H5PCore::ajaxError(
$this->core->h5pF->t('Invalid security token.'),
'INVALID_TOKEN'
);

View File

@ -1,5 +1,6 @@
<?php
namespace Moodle;
/**
* Handles Ajax functionality that must be implemented separately for each of the

View File

@ -1,5 +1,8 @@
<?php
namespace Moodle;
use stdClass;
/**
* Class
*/

View File

@ -1,5 +1,7 @@
<?php
namespace Moodle;
/**
* A defined interface for the editor to communicate with the database of the
* web system.

View File

@ -1,5 +1,9 @@
<?php
namespace Moodle;
use stdClass;
class H5peditor {
private static $hasWYSIWYGEditor = array(
@ -56,9 +60,9 @@ class H5peditor {
/**
* Constructor for the core editor library.
*
* @param \H5PCore $h5p Instance of core
* @param \H5peditorStorage $storage Instance of h5peditor storage interface
* @param \H5PEditorAjaxInterface $ajaxInterface Instance of h5peditor ajax
* @param H5PCore $h5p Instance of core
* @param H5peditorStorage $storage Instance of h5peditor storage interface
* @param H5PEditorAjaxInterface $ajaxInterface Instance of h5peditor ajax
* interface
*/
function __construct($h5p, $storage, $ajaxInterface) {

View File

@ -15,6 +15,13 @@ all the existing strings from the previous version. As you'll see, all the
strings in en.js have been converted following these rules:
* Prefix "editor:" has been added.
* Keys have been lowercased.
- Add namespace to this library to avoid collision. It means:
* Add the "namespace Moodle;" line at the top of all the h5peditor*.php files in the root folder.
* Replace \H5Pxxx uses to H5Pxxx (for instance, in h5peditor-ajax.class.php there are several references to \H5PCore that
must be replaced with H5PCore).
* Add "use stdClass;" in h5peditor.class.php and h5peditor-file.class.php (check that it's still used before replacing it when upgrading the library).
Removed:
* composer.json
@ -26,4 +33,4 @@ Added:
Changed:
* Updated H5peditor::getLibraryData parameters to fix PHP8.0 warnings. See MDL-70903 for details.
Downloaded version: moodle-1.20.2 release
Downloaded version: moodle-1.20.2 release

View File

@ -26,7 +26,7 @@
namespace core_h5p;
use core_h5p\local\library\autoloader;
use ReflectionMethod;
use Moodle\H5PCore;
/**
*
@ -38,7 +38,7 @@ use ReflectionMethod;
*
* @runTestsInSeparateProcesses
*/
class editor_ajax_testcase extends \advanced_testcase {
class editor_ajax_test extends \advanced_testcase {
/** @var editor_ajax H5P editor ajax instance */
protected $editorajax;
@ -141,7 +141,7 @@ class editor_ajax_testcase extends \advanced_testcase {
[$library, $files] = $h5pgenerator->create_library($h5ptempath, $tmplib->id, $datalib['machinename'],
$datalib['majorversion'], $datalib['minorversion'], $datalib['translation']);
$h5pfilestorage->saveLibrary($library);
$stringlibs[] = \H5PCore::libraryToString($library);
$stringlibs[] = H5PCore::libraryToString($library);
}
}

View File

@ -31,6 +31,7 @@ use advanced_testcase;
use core_h5p\local\library\autoloader;
use MoodleQuickForm;
use page_requirements_manager;
use Moodle\H5PCore;
/**
*
@ -42,7 +43,7 @@ use page_requirements_manager;
*
* @runTestsInSeparateProcesses
*/
class editor_testcase extends advanced_testcase {
class editor_test extends advanced_testcase {
/**
* Form object to be used in test case.
@ -205,8 +206,8 @@ class editor_testcase extends advanced_testcase {
$h5pcorepath = autoloader::get_h5p_core_library_url()->out();
$expectedcss = \H5PCore::$styles;
$expectedjs = \H5PCore::$scripts;
$expectedcss = H5PCore::$styles;
$expectedjs = H5PCore::$scripts;
array_walk($expectedcss, function(&$item, $key) use ($h5pcorepath, $cachebuster) {
$item = $h5pcorepath . $item. $cachebuster;

View File

@ -26,6 +26,8 @@
namespace core_h5p;
use core_collator;
use Moodle\H5PCore;
use Moodle\H5PDisplayOptionBehaviour;
/**
*
@ -36,7 +38,7 @@ use core_collator;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @runTestsInSeparateProcesses
*/
class framework_testcase extends \advanced_testcase {
class framework_test extends \advanced_testcase {
/** @var \core_h5p\framework */
private $framework;
@ -1653,7 +1655,7 @@ class framework_testcase extends \advanced_testcase {
'embedType' => 'iframe',
'disable' => $h5p->displayoptions,
'title' => $mainlibrary->title,
'slug' => \H5PCore::slugify($mainlibrary->title) . '-' . $h5p->id,
'slug' => H5PCore::slugify($mainlibrary->title) . '-' . $h5p->id,
'filtered' => $h5p->filtered,
'libraryId' => $mainlibrary->id,
'libraryName' => $mainlibrary->machinename,
@ -1806,13 +1808,13 @@ class framework_testcase extends \advanced_testcase {
$this->resetAfterTest();
// Get value for display_option_download.
$value = $this->framework->getOption(\H5PCore::DISPLAY_OPTION_DOWNLOAD);
$expected = \H5PDisplayOptionBehaviour::CONTROLLED_BY_AUTHOR_DEFAULT_OFF;
$value = $this->framework->getOption(H5PCore::DISPLAY_OPTION_DOWNLOAD);
$expected = H5PDisplayOptionBehaviour::CONTROLLED_BY_AUTHOR_DEFAULT_OFF;
$this->assertEquals($expected, $value);
// Get value for display_option_embed using default value (it should be ignored).
$value = $this->framework->getOption(\H5PCore::DISPLAY_OPTION_EMBED, \H5PDisplayOptionBehaviour::NEVER_SHOW);
$expected = \H5PDisplayOptionBehaviour::CONTROLLED_BY_AUTHOR_DEFAULT_OFF;
$value = $this->framework->getOption(H5PCore::DISPLAY_OPTION_EMBED, H5PDisplayOptionBehaviour::NEVER_SHOW);
$expected = H5PDisplayOptionBehaviour::CONTROLLED_BY_AUTHOR_DEFAULT_OFF;
$this->assertEquals($expected, $value);
// Get value for unexisting setting without default.
@ -1842,11 +1844,11 @@ class framework_testcase extends \advanced_testcase {
$this->assertEquals($newvalue, $value);
// Set value for display_option_download and then get it again. Check it hasn't changed.
$name = \H5PCore::DISPLAY_OPTION_DOWNLOAD;
$newvalue = \H5PDisplayOptionBehaviour::NEVER_SHOW;
$name = H5PCore::DISPLAY_OPTION_DOWNLOAD;
$newvalue = H5PDisplayOptionBehaviour::NEVER_SHOW;
$this->framework->setOption($name, $newvalue);
$value = $this->framework->getOption($name);
$expected = \H5PDisplayOptionBehaviour::CONTROLLED_BY_AUTHOR_DEFAULT_OFF;
$expected = H5PDisplayOptionBehaviour::CONTROLLED_BY_AUTHOR_DEFAULT_OFF;
$this->assertEquals($expected, $value);
}