Created
November 25, 2011 16:10
-
-
Save mathiasverraes/1393879 to your computer and use it in GitHub Desktop.
Assert that two strings are close to each other. #phpunit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
protected function assertStringDistanceInPercent($minimumPercentage, $expected, $actual) | |
{ | |
$percentage = 0; | |
similar_text($expected, $actual, $percentage); | |
$this->assertGreaterThanOrEqual( | |
$minimumPercentage, | |
$percentage, | |
"The distance between the strings should be greater than or equal to $minimumPercentage%, got $percentage%"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment