Example #1
0
 public function test_like_search()
 {
     $matches = User::find_all_by_email_like('ben%');
     FuzzyTest::assert_equal(count($matches), 3, "Should find three users here");
     $matches = User::find_all_by_email_like('%@%');
     FuzzyTest::assert_equal(count($matches), 3, "Should find three users here");
     $matches = User::find_all_by_email_like('nat%');
     FuzzyTest::assert_equal(count($matches), 0, "Should find no users here");
     $matches = User::find_all_by_email_not_like('nat%');
     FuzzyTest::assert_equal(count($matches), 3, "Should find three users here");
     $matches = User::find_all_by_email_not_like('ben%');
     FuzzyTest::assert_equal(count($matches), 0, "Should find no users here");
     $matches = User::find_all_by_email_like_and_email_not_like('ben@%', '%.net');
     FuzzyTest::assert_equal(count($matches), 2, "Should find two users here");
     $matches = User::find(array("like" => "ben%"));
     FuzzyTest::assert_equal(count($matches), 3, "Should find three users here");
     $matches = User::find(array("like" => "Cops%"));
     FuzzyTest::assert_equal(count($matches), 3, "Should find three users here");
     $matches = User::find(array("like" => "Copso%"));
     FuzzyTest::assert_equal(count($matches), 1, "Should find one user here");
 }