forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'MDL-68333-master' of git://github.com/marinaglancy/moodle
- Loading branch information
Showing
13 changed files
with
101 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,15 +173,15 @@ Feature: Teacher can search and enrol users one by one into the course | |
When I log in as "admin" | ||
Then the following "users" exist: | ||
| username | firstname | lastname | email | phone1 | phone2 | department | institution | city | country | | ||
| student100 | Student | 100 | student100@example.com | 1234567892 | 1234567893 | ABC1 | ABC2 | CITY1 | UK | | ||
| student100 | Student | 100 | student100@example.com | 1234567892 | 1234567893 | ABC1 | ABC2 | CITY1 | GB | | ||
And the following config values are set as admin: | ||
| showuseridentity | idnumber,email,city,country,phone1,phone2,department,institution | | ||
When I am on "Course 001" course homepage | ||
Then I navigate to course participants | ||
And I press "Enrol users" | ||
When I set the field "Select users" to "[email protected]" | ||
And I click on ".form-autocomplete-downarrow" "css_element" in the "Select users" "form_row" | ||
Then I should see "[email protected], CITY1, UK, 1234567892, 1234567893, ABC1, ABC2" | ||
Then I should see "[email protected], CITY1, GB, 1234567892, 1234567893, ABC1, ABC2" | ||
# Remove identity field in setting User policies | ||
And the following config values are set as admin: | ||
| showuseridentity | idnumber,email,phone1,phone2,department,institution | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,6 @@ public function test_create_user() { | |
$this->assertEquals($count + 1, $DB->count_records('user')); | ||
$this->assertSame($user->username, core_user::clean_field($user->username, 'username')); | ||
$this->assertSame($user->email, core_user::clean_field($user->email, 'email')); | ||
$this->assertSame(AUTH_PASSWORD_NOT_CACHED, $user->password); | ||
$this->assertNotEmpty($user->firstnamephonetic); | ||
$this->assertNotEmpty($user->lastnamephonetic); | ||
$this->assertNotEmpty($user->alternatename); | ||
|
@@ -97,7 +96,6 @@ public function test_create_user() { | |
'password' => 'password1', | ||
'email' => '[email protected]', | ||
'confirmed' => '1', | ||
'lang' => 'cs', | ||
'maildisplay' => '1', | ||
'mailformat' => '0', | ||
'maildigest' => '1', | ||
|
@@ -128,7 +126,7 @@ public function test_create_user() { | |
$this->assertEquals($count + 3, $DB->count_records('user')); | ||
$this->assertSame('', $user->idnumber); | ||
$this->assertSame(md5($record['username']), $user->email); | ||
$this->assertFalse(context_user::instance($user->id, IGNORE_MISSING)); | ||
$this->assertEquals(1, $user->deleted); | ||
|
||
// Test generating user with interests. | ||
$user = $generator->create_user(array('interests' => 'Cats, Dogs')); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2862,10 +2862,12 @@ public function test_update_internal_user_password() { | |
* the user table and fire event. | ||
*/ | ||
public function test_update_internal_user_password_no_cache() { | ||
global $DB; | ||
$this->resetAfterTest(); | ||
|
||
$user = $this->getDataGenerator()->create_user(array('auth' => 'cas')); | ||
$this->assertEquals(AUTH_PASSWORD_NOT_CACHED, $user->password); | ||
$DB->update_record('user', ['id' => $user->id, 'password' => AUTH_PASSWORD_NOT_CACHED]); | ||
$user->password = AUTH_PASSWORD_NOT_CACHED; | ||
|
||
$sink = $this->redirectEvents(); | ||
update_internal_user_password($user, 'wonkawonka'); | ||
|
@@ -3594,7 +3596,7 @@ public function test_generate_confirmation_link($username, $confirmationurl, $ex | |
$user = $this->getDataGenerator()->create_user( | ||
[ | ||
"username" => $username, | ||
"confirmed" => false, | ||
"confirmed" => 0, | ||
"email" => '[email protected]', | ||
] | ||
); | ||
|
@@ -3623,7 +3625,7 @@ public function test_generate_confirmation_link_with_custom_admin() { | |
$user = $this->getDataGenerator()->create_user( | ||
[ | ||
"username" => "many_-.@characters@[email protected]..", | ||
"confirmed" => false, | ||
"confirmed" => 0, | ||
"email" => '[email protected]', | ||
] | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,11 +140,17 @@ public function test_get_url() { | |
$user2 = $this->getDataGenerator()->create_user(array('picture'=>0, 'email'=>'[email protected]')); | ||
$context2 = context_user::instance($user2->id); | ||
|
||
// User 3 is deleted. | ||
$user3 = $this->getDataGenerator()->create_user(array('picture'=>1, 'deleted'=>1, 'email'=>'[email protected]')); | ||
$context3 = context_user::instance($user3->id, IGNORE_MISSING); | ||
$this->assertNotEmpty(context_user::instance($user3->id)); | ||
$this->assertEquals(0, $user3->picture); | ||
$this->assertNotEquals('[email protected]', $user3->email); | ||
$this->assertFalse($context3); | ||
|
||
// User 4 is incorrectly deleted with its context deleted as well (testing legacy code). | ||
$user4 = $this->getDataGenerator()->create_user(['picture' => 1, 'deleted' => 1, 'email' => '[email protected]']); | ||
context_helper::delete_instance(CONTEXT_USER, $user4->id); | ||
$this->assertEquals(0, $user4->picture); | ||
$this->assertNotEquals('[email protected]', $user4->email); | ||
|
||
// Try legacy picture == 1. | ||
$user1->picture = 1; | ||
|
@@ -186,13 +192,14 @@ public function test_get_url() { | |
$this->assertSame($CFG->wwwroot.'/theme/image.php/boost/core/1/u/f2', $up3->get_url($page, $renderer)->out(false)); | ||
$this->assertEquals($reads, $DB->perf_get_reads()); | ||
|
||
// Try incorrectly deleted users (with valid email and pciture flag) - some DB reads expected. | ||
$user3->email = '[email protected]'; | ||
$user3->picture = 1; | ||
// Try incorrectly deleted users (with valid email and picture flag, but user context removed) - some DB reads expected. | ||
unset($user4->deleted); | ||
$user4->email = '[email protected]'; | ||
$user4->picture = 1; | ||
$reads = $DB->perf_get_reads(); | ||
$up3 = new user_picture($user3); | ||
$up4 = new user_picture($user4); | ||
$this->assertEquals($reads, $DB->perf_get_reads()); | ||
$this->assertSame($CFG->wwwroot.'/theme/image.php/boost/core/1/u/f2', $up3->get_url($page, $renderer)->out(false)); | ||
$this->assertSame($CFG->wwwroot.'/theme/image.php/boost/core/1/u/f2', $up4->get_url($page, $renderer)->out(false)); | ||
$this->assertGreaterThan($reads, $DB->perf_get_reads()); | ||
|
||
// Test gravatar. | ||
|
@@ -203,6 +210,10 @@ public function test_get_url() { | |
$user3->picture = 0; | ||
$up3 = new user_picture($user3); | ||
$this->assertSame($CFG->wwwroot.'/theme/image.php/boost/core/1/u/f2', $up3->get_url($page, $renderer)->out(false)); | ||
$user4->email = 'deleted'; | ||
$user4->picture = 0; | ||
$up4 = new user_picture($user4); | ||
$this->assertSame($CFG->wwwroot.'/theme/image.php/boost/core/1/u/f2', $up4->get_url($page, $renderer)->out(false)); | ||
|
||
// Http version. | ||
$CFG->wwwroot = str_replace('https:', 'http:', $CFG->wwwroot); | ||
|
@@ -237,11 +248,14 @@ public function test_get_url() { | |
$up1 = new user_picture($user1); | ||
$this->assertSame($CFG->wwwroot.'/pluginfile.php/'.$context1->id.'/user/icon/boost/f2?rev=11', $up1->get_url($page, $renderer)->out(false)); | ||
|
||
$up2 = new user_picture($user2); | ||
$this->assertSame('https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?s=35&d=https%3A%2F%2Fwww.example.com%2Fmoodle%2Fpix%2Fu%2Ff2.png', $up2->get_url($page, $renderer)->out(false)); | ||
|
||
$up3 = new user_picture($user3); | ||
$this->assertSame($CFG->wwwroot.'/theme/image.php/boost/core/1/u/f2', $up3->get_url($page, $renderer)->out(false)); | ||
|
||
$up2 = new user_picture($user2); | ||
$this->assertSame('https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?s=35&d=https%3A%2F%2Fwww.example.com%2Fmoodle%2Fpix%2Fu%2Ff2.png', $up2->get_url($page, $renderer)->out(false)); | ||
$up4 = new user_picture($user4); | ||
$this->assertSame($CFG->wwwroot.'/theme/image.php/boost/core/1/u/f2', $up4->get_url($page, $renderer)->out(false)); | ||
|
||
// TODO MDL-44792 Rewrite those tests to use a fixture. | ||
// Now test gravatar with one theme having own images (afterburner). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.