Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 29... Línea 29...
29
 * @category   test
29
 * @category   test
30
 * @copyright  2023 Sara Arjona (sara@moodle.com)
30
 * @copyright  2023 Sara Arjona (sara@moodle.com)
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32
 * @covers     \core_xapi\privacy\provider
32
 * @covers     \core_xapi\privacy\provider
33
 */
33
 */
34
class provider_test extends provider_testcase {
34
final class provider_test extends provider_testcase {
Línea 35... Línea 35...
35
 
35
 
36
    /**
36
    /**
37
     * Setup to ensure that fixtures are loaded.
37
     * Setup to ensure that fixtures are loaded.
38
     */
38
     */
39
    public static function setUpBeforeClass(): void {
39
    public static function setUpBeforeClass(): void {
40
        global $CFG;
40
        global $CFG;
-
 
41
        require_once($CFG->dirroot.'/lib/xapi/tests/helper.php');
41
        require_once($CFG->dirroot.'/lib/xapi/tests/helper.php');
42
        parent::setUpBeforeClass();
Línea 42... Línea 43...
42
    }
43
    }
43
 
44
 
44
    /**
45
    /**
Línea 155... Línea 156...
155
        // Get the states info for user1 in the system context.
156
        // Get the states info for user1 in the system context.
156
        $result = provider::get_xapi_states_for_user($user1->id, 'fake_component', $systemcontext->id);
157
        $result = provider::get_xapi_states_for_user($user1->id, 'fake_component', $systemcontext->id);
157
        $info = (object) reset($result);
158
        $info = (object) reset($result);
158
        // Ensure the correct data has been returned.
159
        // Ensure the correct data has been returned.
159
        $this->assertNotEmpty($info->statedata);
160
        $this->assertNotEmpty($info->statedata);
-
 
161
 
160
        $this->assertNotEmpty(transform::datetime($info->timecreated));
162
        $this->assertNotEmpty($info->timecreated);
161
        $this->assertNotEmpty(transform::datetime($info->timemodified));
163
        $this->assertNotEmpty($info->timemodified);
Línea 162... Línea 164...
162
 
164
 
163
        // Get the states info for user2 in the system context.
165
        // Get the states info for user2 in the system context.
164
        $result = provider::get_xapi_states_for_user($user2->id, 'fake_component', $systemcontext->id);
166
        $result = provider::get_xapi_states_for_user($user2->id, 'fake_component', $systemcontext->id);
165
        $info = (object) reset($result);
167
        $info = (object) reset($result);
166
        // Ensure the correct data has been returned.
168
        // Ensure the correct data has been returned.
167
        $this->assertNotEmpty($info->statedata);
169
        $this->assertNotEmpty($info->statedata);
168
        $this->assertNotEmpty(transform::datetime($info->timecreated));
170
        $this->assertNotEmpty($info->timecreated);
Línea 169... Línea 171...
169
        $this->assertNotEmpty(transform::datetime($info->timemodified));
171
        $this->assertNotEmpty($info->timemodified);
170
 
172
 
171
        // Get the states info for user3 in the system context (it should be empty).
173
        // Get the states info for user3 in the system context (it should be empty).
172
        $info = provider::get_xapi_states_for_user($user3->id, 'fake_component', $systemcontext->id);
174
        $info = provider::get_xapi_states_for_user($user3->id, 'fake_component', $systemcontext->id);