Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 33... Línea 33...
33
 * @package    core_xapi
33
 * @package    core_xapi
34
 * @since      Moodle 3.9
34
 * @since      Moodle 3.9
35
 * @copyright  2020 Ferran Recio
35
 * @copyright  2020 Ferran Recio
36
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37
 */
37
 */
38
class iri_test extends advanced_testcase {
38
final class iri_test extends advanced_testcase {
Línea 39... Línea 39...
39
 
39
 
40
    /**
40
    /**
41
     * Setup to ensure that fixtures are loaded.
41
     * Setup to ensure that fixtures are loaded.
42
     */
42
     */
Línea 51... Línea 51...
51
     * @dataProvider iri_samples_provider
51
     * @dataProvider iri_samples_provider
52
     * @param string $value Value to generate IRI
52
     * @param string $value Value to generate IRI
53
     * @param string $expected Expected result
53
     * @param string $expected Expected result
54
     * @param string $type = null If some special type is provided
54
     * @param string $type = null If some special type is provided
55
     */
55
     */
56
    public function test_generate(string $value, string $expected, string $type = null): void {
56
    public function test_generate(string $value, string $expected, ?string $type = null): void {
57
        $iri = iri::generate($value, $type);
57
        $iri = iri::generate($value, $type);
58
        $this->assertEquals($iri, $expected);
58
        $this->assertEquals($iri, $expected);
59
    }
59
    }
Línea 60... Línea 60...
60
 
60
 
Línea 64... Línea 64...
64
     * @dataProvider iri_samples_provider
64
     * @dataProvider iri_samples_provider
65
     * @param string $expected Expected result
65
     * @param string $expected Expected result
66
     * @param string $value Value to generate IRI
66
     * @param string $value Value to generate IRI
67
     * @param string $type = null If some special type is provided
67
     * @param string $type = null If some special type is provided
68
     */
68
     */
69
    public function test_extract(string $expected, string $value, string $type = null): void {
69
    public function test_extract(string $expected, string $value, ?string $type = null): void {
70
        $extract = iri::extract($value, $type);
70
        $extract = iri::extract($value, $type);
71
        $this->assertEquals($extract, $expected);
71
        $this->assertEquals($extract, $expected);
72
    }
72
    }
Línea 73... Línea 73...
73
 
73
 
74
    /**
74
    /**
75
     * Data provider for the test_generate and test_extract tests.
75
     * Data provider for the test_generate and test_extract tests.
76
     *
76
     *
77
     * @return  array
77
     * @return  array
78
     */
78
     */
79
    public function iri_samples_provider(): array {
79
    public static function iri_samples_provider(): array {
Línea 80... Línea 80...
80
        global $CFG;
80
        global $CFG;
81
 
81
 
82
        return [
82
        return [
Línea 118... Línea 118...
118
    /**
118
    /**
119
     * Data provider for the test_check.
119
     * Data provider for the test_check.
120
     *
120
     *
121
     * @return  array
121
     * @return  array
122
     */
122
     */
123
    public function iri_check_provider(): array {
123
    public static function iri_check_provider(): array {
124
        return [
124
        return [
125
            'Real IRI http' => [
125
            'Real IRI http' => [
126
                'http://adlnet.gov/expapi/activities/example',
126
                'http://adlnet.gov/expapi/activities/example',
127
                true,
127
                true,
128
            ],
128
            ],