Use hash_hmac on cookie hashes.
This commit is contained in:
@@ -67,7 +67,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase {
|
||||
*/
|
||||
public function testHasMethodIndicatesIfCookieInSet()
|
||||
{
|
||||
Cookie::$jar['foo'] = array('value' => sha1('bar'.Config::get('application.key')).'+bar');
|
||||
Cookie::$jar['foo'] = array('value' => Cookie::hash('bar').'+bar');
|
||||
$this->assertTrue(Cookie::has('foo'));
|
||||
$this->assertFalse(Cookie::has('bar'));
|
||||
|
||||
@@ -82,7 +82,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase {
|
||||
*/
|
||||
public function testGetMethodCanReturnValueOfCookies()
|
||||
{
|
||||
Cookie::$jar['foo'] = array('value' => sha1('bar'.Config::get('application.key')).'+bar');
|
||||
Cookie::$jar['foo'] = array('value' => Cookie::hash('bar').'+bar');
|
||||
$this->assertEquals('bar', Cookie::get('foo'));
|
||||
|
||||
Cookie::put('bar', 'baz');
|
||||
@@ -97,7 +97,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testForeverShouldUseATonOfMinutes()
|
||||
{
|
||||
Cookie::forever('foo', 'bar');
|
||||
$this->assertEquals(sha1('bar'.Config::get('application.key')).'+bar', Cookie::$jar['foo']['value']);
|
||||
$this->assertEquals(Cookie::hash('bar').'+bar', Cookie::$jar['foo']['value']);
|
||||
|
||||
// Shouldn't be able to test this cause while we indicate -2000 seconds
|
||||
// cookie expiration store timestamp.
|
||||
|
||||
@@ -372,7 +372,7 @@ class SessionTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
$cookie = Cookie::$jar[Config::get('session.cookie')];
|
||||
|
||||
$this->assertEquals(sha1('foo'.Config::get('application.key')).'+foo', $cookie['value']);
|
||||
$this->assertEquals(Cookie::hash('foo').'+foo', $cookie['value']);
|
||||
// Shouldn't be able to test this cause session.lifetime store number of minutes
|
||||
// while cookie expiration store timestamp when it going to expired.
|
||||
// $this->assertEquals(Config::get('session.lifetime'), $cookie['expiration']);
|
||||
|
||||
Reference in New Issue
Block a user