MDL-76723 core_external: Handle format properties properly
commit23cbb7ffa40903f9106acfb855438c58fd46c6fe
authorJun Pataleta <jun@moodle.com>
Wed, 22 Nov 2023 15:39:23 +0000 (22 23:39 +0800)
committerJun Pataleta <jun@moodle.com>
Tue, 19 Dec 2023 07:50:30 +0000 (19 15:50 +0800)
treed255011dd7e0678604f778add4a6560c9fdf0c6c
parent09f5efdbd706cadb62d226f5b89cb75c5f3ae4a1
MDL-76723 core_external: Handle format properties properly

- If a text format property defines the 'optional' attribute as true,
then the $required parameter that
is passed to \core\external\exporter::get_format_structure() should be
VALUE_OPTIONAL.
- If a default value is provided for a format property,
\core\external\exporter::get_format_structure() should pass the default
value to the external_format_value constructor.
- Added validation for external_format_value for the default parameter.
  Debugging will be shown in case an invalid default value is passed.
- Amended unit tests for better coverage.
lib/classes/external/exporter.php
lib/external/classes/external_format_value.php
lib/tests/exporter_test.php