first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,56 @@
@core @core_question @report @report_questioninstance
Feature: A Teacher can generate question instance reports
In order to see question instance reports
As a Teacher
I need to generate them
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | weeks |
And the following "question categories" exist:
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "activities" exist:
| activity | course | name |
| quiz | C1 | Test quiz Q001 |
And the following "questions" exist:
| questioncategory | qtype | name |
| Test questions | truefalse | TF |
| Test questions | shortanswer | SA |
And quiz "Test quiz Q001" contains the following questions:
| question | page | maxmark |
| TF | 1 | 5.0 |
| SA | 1 | 5.0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "question categories" exist:
| contextlevel | reference | name |
| Activity module | Test quiz Q001 | Quiz category |
Scenario: Generate general and specific report
Given I am on the "C1" "Course" page logged in as "admin"
And I navigate to "Reports > Question instances" in site administration
When I press "Get the report"
Then "Course: Course 1" row "Total" column of "generaltable" table should contain "2"
And "Course: Course 1" row "Visible" column of "generaltable" table should contain "2"
And "Course: Course 1" row "Hidden" column of "generaltable" table should contain "0"
Scenario: Generate report displaying hidden questions
Given I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "admin"
And I choose "Delete" action for "TF" in the question bank
And I press "Delete"
And I navigate to "Reports > Question instances" in site administration
When I press "Get the report"
Then "Course: Course 1" row "Total" column of "generaltable" table should contain "2"
And "Course: Course 1" row "Visible" column of "generaltable" table should contain "1"
And "Course: Course 1" row "Hidden" column of "generaltable" table should contain "1"
And I set the field "menuqtype" to "True/False"
And I press "Get the report"
And "Course: Course 1" row "Total" column of "generaltable" table should contain "1"
And "Course: Course 1" row "Visible" column of "generaltable" table should contain "0"
And "Course: Course 1" row "Hidden" column of "generaltable" table should contain "1"
@@ -0,0 +1,64 @@
<?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/>.
/**
* Tests for question instances events.
*
* @package report_questioninstances
* @copyright 2014 Petr Skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/
namespace report_questioninstances\event;
/**
* Class for question instances events.
*
* @package report_questioninstances
* @copyright 2014 Petr Skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/
class events_test extends \advanced_testcase {
/**
* Setup testcase.
*/
public function setUp(): void {
$this->setAdminUser();
$this->resetAfterTest();
}
/**
* Test the report viewed event.
*/
public function test_report_viewed(): void {
$requestedqtype = 'all';
$event = \report_questioninstances\event\report_viewed::create(array('other' => array('requestedqtype' => $requestedqtype)));
// Trigger and capture the event.
$sink = $this->redirectEvents();
$event->trigger();
$events = $sink->get_events();
$event = reset($events);
$this->assertInstanceOf('\report_questioninstances\event\report_viewed', $event);
$this->assertEquals(\context_system::instance(), $event->get_context());
$this->assertEventContextNotUsed($event);
$url = new \moodle_url('/report/questioninstances/index.php', array('qtype' => $requestedqtype));
$this->assertEquals($url, $event->get_url());
$event->get_name();
}
}