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

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

require_once(__DIR__ . '/fixtures/lib.php');

/**
 * Grade object testcase.
 *
 * @package    core
 * @category   test
 * @copyright  2014 Frédéric Massart - FMCorz.net
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
final class grade_object_test extends \grade_base_testcase {

    public function test_fetch_all_helper(): void {
        // Simple ID lookup.
        $params = array('id' => $this->grade_items[0]->id);
        $items = \grade_object::fetch_all_helper('grade_items', 'grade_item', $params);
        $this->assertCount(1, $items);
        $item = array_shift($items);
        $this->assertInstanceOf('grade_item', $item);
        $this->assertEquals($item->id, $this->grade_items[0]->id);

        // Various parameters lookup, multiple results.
        $params = array('courseid' => $this->course->id, 'categoryid' => $this->grade_categories[1]->id);
        $items = \grade_object::fetch_all_helper('grade_items', 'grade_item', $params);
        $this->assertCount(2, $items);
        $expecteditems = array($this->grade_items[0]->id => true, $this->grade_items[1]->id => true);
        foreach ($items as $item) {
            $this->assertInstanceOf('grade_item', $item);
            $this->assertArrayHasKey($item->id, $expecteditems);
            unset($expecteditems[$item->id]);
        }

        // Text column lookup.
        $params = array('iteminfo' => $this->grade_items[2]->iteminfo);
        $items = \grade_object::fetch_all_helper('grade_items', 'grade_item', $params);
        $this->assertCount(1, $items);
        $item = array_shift($items);
        $this->assertInstanceOf('grade_item', $item);
        $this->assertEquals($item->id, $this->grade_items[2]->id);

        // Lookup using non-existing columns.
        $params = array('doesnotexist' => 'ignoreme', 'id' => $this->grade_items[0]->id);
        $items = \grade_object::fetch_all_helper('grade_items', 'grade_item', $params);
        $this->assertCount(1, $items);
        $item = array_shift($items);
        $this->assertInstanceOf('grade_item', $item);
        $this->assertEquals($item->id, $this->grade_items[0]->id);
    }

}

Filemanager

Name Type Size Permission Actions
fixtures Folder 0777
grade_category_test.php File 46.27 KB 0777
grade_grade_test.php File 30.03 KB 0777
grade_item_test.php File 50.28 KB 0777
grade_object_test.php File 2.84 KB 0777
grade_outcome_test.php File 4.1 KB 0777
grade_scale_test.php File 6.6 KB 0777
Filemanager