コード例 #1
0
ファイル: StringTest.php プロジェクト: grrr-amsterdam/garp3
 public function testFuzzyMatcher()
 {
     // test match
     $this->assertTrue(Garp_Util_String::fuzzyMatch('munchkin', 'm19302390iu23983n2893ch28302jdk2399i2903910hfwen'));
     // test non match
     $this->assertFalse(Garp_Util_String::fuzzyMatch('munchkin', 'm19302390iu23983n2893ch28302jdk2399i2903910hfwe'));
     // another non match
     $this->assertFalse(Garp_Util_String::fuzzyMatch('rugmuncher', 'm19302390iu23983n2893ch28302jdk2399i2903910hfwe'));
     // check with funky string
     $this->assertTrue(Garp_Util_String::fuzzyMatch('(╯°□°)╯︵ ┻━┻', '(╯aejfekn°□°klewmwlkfm192)╯#(#)(#︵dsjkfwjkdn ┻━┻'));
     // don't match when case-sensitive
     $this->assertFalse(Garp_Util_String::fuzzyMatch('munchkin', 'm19302390iU23983n2893ch28302jdk2399i2903910hfwen', false));
 }