bug #10904 [HttpKernel] Replace sha1 with sha256 in recently added tests (jakzal)

This PR was merged into the 2.4 branch.

Discussion
----------

[HttpKernel] Replace sha1 with sha256 in recently added tests

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | no
| Fixed tickets | -
| License       | MIT

Tests were introduced in #10896 and are broken starting with 2.4, since the hashing algorithm has changed (introduced in #8609).

Commits
-------

255544f [HttpKernel] Replace sha1 with sha256 in recently added tests.
This commit is contained in:
Fabien Potencier 2014-05-15 09:59:49 +02:00
commit be3c0dcfc0
1 changed files with 2 additions and 4 deletions

View File

@ -609,12 +609,11 @@ class HttpCacheTest extends HttpCacheTestCase
$values = $this->getMetaStorageValues();
$this->assertCount(1, $values);
$tmp = unserialize($values[0]);
$time = \DateTime::createFromFormat('U', time());
$tmp[0][1]['date'] = \DateTime::createFromFormat('U', time() - 5)->format(DATE_RFC2822);
$r = new \ReflectionObject($this->store);
$m = $r->getMethod('save');
$m->setAccessible(true);
$m->invoke($this->store, 'md'.sha1('http://localhost/'), serialize($tmp));
$m->invoke($this->store, 'md'.hash('sha256', 'http://localhost/'), serialize($tmp));
$this->request('GET', '/');
$this->assertHttpKernelIsCalled();
@ -659,12 +658,11 @@ class HttpCacheTest extends HttpCacheTestCase
$values = $this->getMetaStorageValues();
$this->assertCount(1, $values);
$tmp = unserialize($values[0]);
$time = \DateTime::createFromFormat('U', time());
$tmp[0][1]['date'] = \DateTime::createFromFormat('U', time() - 5)->format(DATE_RFC2822);
$r = new \ReflectionObject($this->store);
$m = $r->getMethod('save');
$m->setAccessible(true);
$m->invoke($this->store, 'md'.sha1('http://localhost/'), serialize($tmp));
$m->invoke($this->store, 'md'.hash('sha256', 'http://localhost/'), serialize($tmp));
$this->request('GET', '/');
$this->assertHttpKernelIsCalled();