Implementing Validation::equalTo() (Ticket #3594)

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6187 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-12-21 23:39:52 +00:00
parent 5dd9847881
commit e6af521843
2 changed files with 10 additions and 1 deletions

View file

@ -471,7 +471,7 @@ class Validation extends Object {
* @todo Implement
*/
function equalTo($check, $comparedTo) {
return ($check === $comparedTo);
}
/**
* Check that value is a file.

View file

@ -1170,6 +1170,15 @@ class ValidationTestCase extends UnitTestCase {
$this->assertFalse($this->Validation->email('abc.efg@com.caphpkeinvalid', null, '/^[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i'));
}
function testEqualTo() {
$this->assertTrue($this->Validation->equalTo("1", "1"));
$this->assertFalse($this->Validation->equalTo(1, "1"));
$this->assertFalse($this->Validation->equalTo("", null));
$this->assertFalse($this->Validation->equalTo("", false));
$this->assertFalse($this->Validation->equalTo(0, false));
$this->assertFalse($this->Validation->equalTo(null, false));
}
function testIp() {
$this->assertTrue($this->Validation->ip('0.0.0.0'));
$this->assertTrue($this->Validation->ip('192.168.1.156'));