Permalink
Browse files

add test for compare field validation without index of array

  • Loading branch information...
1 parent 843d8bb commit db0f5246e15dfb06012e11162f5f03997f6dc889 @ichikaway committed Dec 9, 2010
Showing with 19 additions and 0 deletions.
  1. +19 −0 tests/cases/models/behaviors/add_validation_rule.test.php
@@ -418,6 +418,25 @@ function _failSuccessTest($setFailData = array(),$setSuccessData = array(),$fiel
}
+
+ //比較対象のフィールドが存在しない場合でもエラーが出ないか確認テスト
+ function testValidataionCompare2fieldWithEmptyField(){
+
+ $data = array(
+ 'ValidationRule' => array(
+ 'valuediff' => 'あいうえお',
+ ),
+ );
+
+ $this->assertTrue( $this->ValidationRule->create( $data ) );
+ $this->assertFalse( $this->ValidationRule->validates() );
+
+ $this->assertTrue( array_key_exists("valuediff" , $this->ValidationRule->validationErrors ) );
+
+ }
+
+
+
}
?>

0 comments on commit db0f524

Please sign in to comment.