1
0
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:
Vincent Jousse 2013-11-21 23:02:33 +01:00
parent 6f5d4b334c
commit 2e4d38cbf4
2 changed files with 18 additions and 1 deletions

View File

@ -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
View 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)
;
}
}