mirror of
https://github.com/moparisthebest/wallabag
synced 2024-12-17 21:22:15 -05:00
Test to check that the token is properly generated
This commit is contained in:
parent
6f5d4b334c
commit
2e4d38cbf4
@ -15,7 +15,7 @@ class Token
|
|||||||
return substr(base64_encode(file_get_contents('/dev/urandom', false, null, 0, 20)), 0, 15);
|
return substr(base64_encode(file_get_contents('/dev/urandom', false, null, 0, 20)), 0, 15);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return substr(base64_encode(uniqid(mt_rand(), true)), 0, 20);
|
return substr(base64_encode(uniqid(mt_rand(), true)), 0, 15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
tests/units/Token.php
Normal file
17
tests/units/Token.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Poche\Util\tests\units;
|
||||||
|
|
||||||
|
use \atoum;
|
||||||
|
|
||||||
|
class Token extends atoum
|
||||||
|
{
|
||||||
|
public function testTokenSize()
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->integer(strlen(\Poche\Util\Token::generateToken()))
|
||||||
|
->isEqualTo(15)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user