Skip to content

Commit

Permalink
Add tests for cacheMethodHasher
Browse files Browse the repository at this point in the history
  • Loading branch information
tersmitten committed Nov 14, 2016
1 parent e186ffc commit 7ffb5c3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
Expand Up @@ -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
*
Expand Down

0 comments on commit 7ffb5c3

Please sign in to comment.