diff --git a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php index 911faec5cb5..b55fb5088c5 100644 --- a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php @@ -737,6 +737,34 @@ public function testCacheMethod() { $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 *