mirror of
https://github.com/moodle/moodle.git
synced 2025-02-21 09:52:54 +01:00
MDL-80653 h5p: handle content type creation errors in test.
See also same in c7d08f85.
This commit is contained in:
parent
9d3e70fe06
commit
6435680f5a
@ -14,6 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace core_h5p;
|
||||
|
||||
use core_h5p\local\library\autoloader;
|
||||
|
||||
use invalid_response_exception;
|
||||
|
||||
/**
|
||||
* Testing the H5P core methods.
|
||||
*
|
||||
@ -21,20 +27,7 @@
|
||||
* @category test
|
||||
* @copyright 2019 Victor Deniz <victor@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core_h5p;
|
||||
|
||||
use core_h5p\local\library\autoloader;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Test class covering the H5PFileStorage interface implementation.
|
||||
*
|
||||
* @package core_h5p
|
||||
* @copyright 2019 Victor Deniz <victor@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \core_h5p\core
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
*/
|
||||
@ -70,10 +63,14 @@ class h5p_core_test extends \advanced_testcase {
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
// Get info of latest content types versions.
|
||||
$contenttypes = $this->core->get_latest_content_types()->contentTypes;
|
||||
$response = $this->core->get_latest_content_types();
|
||||
if (!empty($response->error)) {
|
||||
throw new invalid_response_exception($response->error);
|
||||
}
|
||||
|
||||
// We are installing the first content type with tutorial and example fields (or the first one if none has them).
|
||||
$librarydata = $contenttypes[0];
|
||||
foreach ($contenttypes as $contentype) {
|
||||
$librarydata = $response->contentTypes[0];
|
||||
foreach ($response->contentTypes as $contenttype) {
|
||||
if (isset($contenttype->tutorial) && isset($contenttype->example)) {
|
||||
$librarydata = $contenttype;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user