Tests/authjwtTest : add logout tests

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5816 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2019-12-09 13:22:08 +00:00
parent 552fa6ab12
commit 9195426608

View File

@@ -167,9 +167,42 @@ class authjwtTest extends PHPUnit_Framework_TestCase
$authjwt->cipherKey = $this->cipherKey; $authjwt->cipherKey = $this->cipherKey;
$_SERVER["HTTP_AUTHENTICATION"] = "Bearer $this->token"; $_SERVER["HTTP_AUTHENTICATION"] = "Bearer $this->token";
$res = $authjwt->logout (); $res = $authjwt->logout ();
$this->assertSame ($res, true);
} }
// }}} // }}}
/** Logout : No Auth provided
*/
public function testLogout2 ()
// {{{
{
$this->expectException ("Exception", "No Authentication available", 401);
$authjwt = new authjwt ();
$authjwt->cacheDir = $this->cacheDir;
$authjwt->serverKey = $this->serverKey;
$authjwt->cipherKey = $this->cipherKey;
unset ($_SERVER["HTTP_AUTHENTICATION"]);
$res = $authjwt->logout ();
}
// }}}
/** Logout : No Bearer available
*/
public function testLogout3 ()
// {{{
{
$this->expectException ("Exception", "No Bearer Authentication available",
401);
$authjwt = new authjwt ();
$authjwt->cacheDir = $this->cacheDir;
$authjwt->serverKey = $this->serverKey;
$authjwt->cipherKey = $this->cipherKey;
$_SERVER["HTTP_AUTHENTICATION"] = "Another auth";
$res = $authjwt->logout ();
}
// }}}
/** Not needed function connect /** Not needed function connect
*/ */
public function testUnusedFunctions1 () public function testUnusedFunctions1 ()