mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Rename Fever user functions for consistency
This commit is contained in:
parent
f51d20a863
commit
07122b524a
2 changed files with 6 additions and 6 deletions
|
@ -98,7 +98,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function registerUser(string $user, string $password = null): string {
|
public static function userRegister(string $user, string $password = null): string {
|
||||||
$password = $password ?? Arsse::$user->generatePassword();
|
$password = $password ?? Arsse::$user->generatePassword();
|
||||||
$hash = md5("$user:$password");
|
$hash = md5("$user:$password");
|
||||||
$tr = Arsse::$db->begin();
|
$tr = Arsse::$db->begin();
|
||||||
|
@ -108,7 +108,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
return $password;
|
return $password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function unregisterUser(string $user): bool {
|
public static function userUnregister(string $user): bool {
|
||||||
return (bool) Arsse::$db->tokenRevoke($user, "fever.login");
|
return (bool) Arsse::$db->tokenRevoke($user, "fever.login");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,9 +146,9 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
\Phake::when(Arsse::$db)->tokenCreate("john.doe@example.org", $this->anything(), $this->anything())->thenThrow(new UserException("doesNotExist"));
|
\Phake::when(Arsse::$db)->tokenCreate("john.doe@example.org", $this->anything(), $this->anything())->thenThrow(new UserException("doesNotExist"));
|
||||||
if ($exp instanceof \JKingWeb\Arsse\AbstractException) {
|
if ($exp instanceof \JKingWeb\Arsse\AbstractException) {
|
||||||
$this->assertException($exp);
|
$this->assertException($exp);
|
||||||
API::registerUser($user, $password);
|
API::userRegister($user, $password);
|
||||||
} else {
|
} else {
|
||||||
$this->assertSame($exp, API::registerUser($user, $password));
|
$this->assertSame($exp, API::userRegister($user, $password));
|
||||||
}
|
}
|
||||||
\Phake::verify(Arsse::$db)->tokenRevoke($user, "fever.login");
|
\Phake::verify(Arsse::$db)->tokenRevoke($user, "fever.login");
|
||||||
\Phake::verify(Arsse::$db)->tokenCreate($user, "fever.login", md5($user.":".($password ?? "RANDOM_PASSWORD")));
|
\Phake::verify(Arsse::$db)->tokenCreate($user, "fever.login", md5($user.":".($password ?? "RANDOM_PASSWORD")));
|
||||||
|
@ -167,10 +167,10 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
|
|
||||||
public function testUnregisterAUser() {
|
public function testUnregisterAUser() {
|
||||||
\Phake::when(Arsse::$db)->tokenRevoke->thenReturn(3);
|
\Phake::when(Arsse::$db)->tokenRevoke->thenReturn(3);
|
||||||
$this->assertTrue(API::unregisterUser("jane.doe@example.com"));
|
$this->assertTrue(API::userUnregister("jane.doe@example.com"));
|
||||||
\Phake::verify(Arsse::$db)->tokenRevoke("jane.doe@example.com", "fever.login");
|
\Phake::verify(Arsse::$db)->tokenRevoke("jane.doe@example.com", "fever.login");
|
||||||
\Phake::when(Arsse::$db)->tokenRevoke->thenReturn(0);
|
\Phake::when(Arsse::$db)->tokenRevoke->thenReturn(0);
|
||||||
$this->assertFalse(API::unregisterUser("john.doe@example.com"));
|
$this->assertFalse(API::userUnregister("john.doe@example.com"));
|
||||||
\Phake::verify(Arsse::$db)->tokenRevoke("john.doe@example.com", "fever.login");
|
\Phake::verify(Arsse::$db)->tokenRevoke("john.doe@example.com", "fever.login");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue