| Conditions | 2 |
| Paths | 1 |
| Total Lines | 22 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 39 | public function testUsernameWhichDoesExist() |
||
| 40 | { |
||
| 41 | // generate a random name which does not exist in the database |
||
| 42 | do { |
||
| 43 | $loginName = rand(); |
||
| 44 | } while (UserManager::get_user_id_from_username($loginName)); |
||
| 45 | |||
| 46 | // create a test user with this login name |
||
| 47 | $userId = UserManager::create_user( |
||
| 48 | $loginName, |
||
| 49 | $loginName, |
||
| 50 | STUDENT, |
||
| 51 | $loginName.'@local', |
||
| 52 | $loginName, |
||
| 53 | $loginName |
||
| 54 | ); |
||
| 55 | |||
| 56 | // expect the web service to return true |
||
| 57 | $this->assertTrue($this->boolean(['loginname' => $loginName])); |
||
| 58 | |||
| 59 | // clean up |
||
| 60 | UserManager::delete_users([$userId]); |
||
| 61 | } |
||
| 63 |