| Total Complexity | 5 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class UsernameExistTest extends V2TestCase |
||
| 14 | { |
||
| 15 | public function action() |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * test nonexistence of a username which does not exist |
||
| 22 | * assert that the webservice returns false |
||
| 23 | */ |
||
| 24 | public function testUsernameWhichDoesNotExist() |
||
| 25 | { |
||
| 26 | // generate a random name which does not exist in the database |
||
| 27 | do { |
||
| 28 | $loginName = rand(); |
||
| 29 | } while (UserManager::get_user_id_from_username($loginName)); |
||
| 30 | |||
| 31 | // expect the web service to return false |
||
| 32 | $this->assertFalse($this->boolean(['loginname' => $loginName])); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * test existence of a username which does exist |
||
| 37 | * assert that the webservice returns true |
||
| 38 | */ |
||
| 39 | public function testUsernameWhichDoesExist() |
||
| 61 | } |
||
| 62 | } |
||
| 63 |