Skip to content

Commit

Permalink
MDL-68244 auth_email: Update unit test, remove hard assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocolate-lightning committed May 25, 2020
1 parent 71965a8 commit a2fc851
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions auth/email/tests/external_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,21 @@ public function test_get_signup_settings() {
$this->assertEquals(print_password_policy(), $result['passwordpolicy']);
$this->assertNotContains('recaptchachallengehash', $result);
$this->assertNotContains('recaptchachallengeimage', $result);
$this->assertCount(2, $result['profilefields']);
$this->assertEquals('text', $result['profilefields'][0]['datatype']);
$this->assertEquals('textarea', $result['profilefields'][1]['datatype']);

// Whip up a array with named entries to easily check against.
$namedarray = array();
foreach ($result['profilefields'] as $key => $value) {
$namedarray[$value['shortname']] = array(
'datatype' => $value['datatype']
);
}

// Just check if we have the fields from this test. If a plugin adds fields we'll let it slide.
$this->assertArrayHasKey('frogname', $namedarray);
$this->assertArrayHasKey('sometext', $namedarray);

$this->assertEquals('text', $namedarray['frogname']['datatype']);
$this->assertEquals('textarea', $namedarray['sometext']['datatype']);
}

public function test_signup_user() {
Expand Down

0 comments on commit a2fc851

Please sign in to comment.