Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 42... Línea 42...
42
    /**
42
    /**
43
     * Check that a user context is returned if there is any user data for this user.
43
     * Check that a user context is returned if there is any user data for this user.
44
     *
44
     *
45
     * @covers ::get_contexts_for_userid
45
     * @covers ::get_contexts_for_userid
46
     */
46
     */
47
    public function test_get_contexts_for_userid() {
47
    public function test_get_contexts_for_userid(): void {
48
        $user = $this->getDataGenerator()->create_user();
48
        $user = $this->getDataGenerator()->create_user();
49
        $this->assertEmpty(provider::get_contexts_for_userid($user->id));
49
        $this->assertEmpty(provider::get_contexts_for_userid($user->id));
Línea 50... Línea 50...
50
 
50
 
51
        $auth = get_auth_plugin('lti');
51
        $auth = get_auth_plugin('lti');
Línea 63... Línea 63...
63
    /**
63
    /**
64
     * Test that user data is exported correctly.
64
     * Test that user data is exported correctly.
65
     *
65
     *
66
     * @covers ::export_user_data
66
     * @covers ::export_user_data
67
     */
67
     */
68
    public function test_export_user_data() {
68
    public function test_export_user_data(): void {
69
        $user = $this->getDataGenerator()->create_user();
69
        $user = $this->getDataGenerator()->create_user();
70
        $auth = get_auth_plugin('lti');
70
        $auth = get_auth_plugin('lti');
71
        $auth->create_user_binding('https://lms.example.com', 'abc123', $user->id);
71
        $auth->create_user_binding('https://lms.example.com', 'abc123', $user->id);
72
        $usercontext = \context_user::instance($user->id);
72
        $usercontext = \context_user::instance($user->id);
Línea 85... Línea 85...
85
    /**
85
    /**
86
     * Test deleting all user data for a specific context.
86
     * Test deleting all user data for a specific context.
87
     *
87
     *
88
     * @covers ::delete_data_for_all_users_in_context
88
     * @covers ::delete_data_for_all_users_in_context
89
     */
89
     */
90
    public function test_delete_data_for_all_users_in_context() {
90
    public function test_delete_data_for_all_users_in_context(): void {
91
        global $DB;
91
        global $DB;
92
        $auth = get_auth_plugin('lti');
92
        $auth = get_auth_plugin('lti');
Línea 93... Línea 93...
93
 
93
 
94
        $user1 = $this->getDataGenerator()->create_user();
94
        $user1 = $this->getDataGenerator()->create_user();
Línea 117... Línea 117...
117
    /**
117
    /**
118
     * This should work identical to the above test.
118
     * This should work identical to the above test.
119
     *
119
     *
120
     * @covers ::delete_data_for_user
120
     * @covers ::delete_data_for_user
121
     */
121
     */
122
    public function test_delete_data_for_user() {
122
    public function test_delete_data_for_user(): void {
123
        global $DB;
123
        global $DB;
124
        $auth = get_auth_plugin('lti');
124
        $auth = get_auth_plugin('lti');
Línea 125... Línea 125...
125
 
125
 
126
        $user1 = $this->getDataGenerator()->create_user();
126
        $user1 = $this->getDataGenerator()->create_user();
Línea 150... Línea 150...
150
    /**
150
    /**
151
     * Test that only users with a user context are fetched.
151
     * Test that only users with a user context are fetched.
152
     *
152
     *
153
     * @covers ::get_users_in_context
153
     * @covers ::get_users_in_context
154
     */
154
     */
155
    public function test_get_users_in_context() {
155
    public function test_get_users_in_context(): void {
156
        $auth = get_auth_plugin('lti');
156
        $auth = get_auth_plugin('lti');
157
        $component = 'auth_lti';
157
        $component = 'auth_lti';
158
        $user = $this->getDataGenerator()->create_user();
158
        $user = $this->getDataGenerator()->create_user();
159
        $usercontext = \context_user::instance($user->id);
159
        $usercontext = \context_user::instance($user->id);
Línea 182... Línea 182...
182
    /**
182
    /**
183
     * Test that data for users in approved userlist is deleted.
183
     * Test that data for users in approved userlist is deleted.
184
     *
184
     *
185
     * @covers ::delete_data_for_users
185
     * @covers ::delete_data_for_users
186
     */
186
     */
187
    public function test_delete_data_for_users() {
187
    public function test_delete_data_for_users(): void {
188
        $auth = get_auth_plugin('lti');
188
        $auth = get_auth_plugin('lti');
189
        $component = 'auth_lti';
189
        $component = 'auth_lti';
190
        $user1 = $this->getDataGenerator()->create_user();
190
        $user1 = $this->getDataGenerator()->create_user();
191
        $usercontext1 = \context_user::instance($user1->id);
191
        $usercontext1 = \context_user::instance($user1->id);
192
        $user2 = $this->getDataGenerator()->create_user();
192
        $user2 = $this->getDataGenerator()->create_user();