Add tests for cacheMethodHasher

This commit is contained in:
Mischa ter Smitten 2016-11-14 10:00:47 +01:00
parent e186ffc6d3
commit 7ffb5c3600

View file

@ -737,6 +737,34 @@ class DboSourceTest extends CakeTestCase {
$this->assertNull($result);
}
/**
* Test that cacheMethodHasher uses md5 by default.
*
* @return void
*/
public function testCacheMethodHasher() {
$name = 'Model.fieldlbqndkezcoapfgirmjsh';
$actual = $this->testDb->cacheMethodHasher($name);
$expected = '4a45dc9ed52f98c393d04ac424ee5078';
$this->assertEquals($expected, $actual);
}
/**
* Test that cacheMethodHasher can be overridden to use a different hashing algorithm.
*
* @return void
*/
public function testCacheMethodHasherOverridden() {
$testDb = new DboThirdTestSource();
$name = 'Model.fieldlbqndkezcoapfgirmjsh';
$actual = $testDb->cacheMethodHasher($name);
$expected = 'f4441bb8fcbe0944';
$this->assertEquals($expected, $actual);
}
/**
* Test that rare collisions do not happen with method caching
*