Skip to content

Commit de0de1a

Browse files
committed
add user exists tests
1 parent df1197c commit de0de1a

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

tests/phpunit/UserTest.php

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,41 @@ public function testUserStorage() {
248248
$this->assertTrue(in_array($storageUrl, $user['storage']));
249249
}
250250

251+
public function testUserExistsById() {
252+
$newUser = [
253+
"password" => "hello123!@#ABC",
254+
"email" => "[email protected]",
255+
"hello" => "world"
256+
];
257+
$createdUser = User::createUser($newUser);
258+
259+
$userExists = User::userIdExists($createdUser['userId']);
260+
$this->assertTrue($userExists);
261+
}
262+
263+
public function testUserDoesNotExistsById() {
264+
$userExists = User::userIdExists("foo");
265+
$this->assertFalse($userExists);
266+
}
267+
268+
public function testUserExistsByEmail() {
269+
$newUser = [
270+
"password" => "hello123!@#ABC",
271+
"email" => "[email protected]",
272+
"hello" => "world"
273+
];
274+
$createdUser = User::createUser($newUser);
275+
276+
$userExists = User::userEmailExists($newUser['email']);
277+
$this->assertTrue($userExists);
278+
}
279+
280+
public function testUserDoesNotExistsByEmail() {
281+
$userExists = User::userIdExists("[email protected]");
282+
$this->assertFalse($userExists);
283+
}
284+
251285
// @TODO Write tests for these functions:
252-
// userIdExists
253-
// userEmailExists
254286
// deleteAccount
255287
// cleanupTokens
256288
}

0 commit comments

Comments
 (0)