function testMobile()
 {
     $data = array('ValidationRule' => array('emailmobile' => '*****@*****.**'));
     $this->assertTrue($this->ValidationRule->create($data));
     $this->assertTrue($this->ValidationRule->validates());
     $this->assertFalse(array_key_exists("emailmobile", $this->ValidationRule->validationErrors));
     $data = array('ValidationRule' => array('emailmobile' => '*****@*****.**'));
     $this->assertTrue($this->ValidationRule->create($data));
     $this->assertTrue($this->ValidationRule->validates());
     $this->assertFalse(array_key_exists("emailmobile", $this->ValidationRule->validationErrors));
     $data = array('ValidationRule' => array('emailmobile' => '*****@*****.**'));
     $this->assertTrue($this->ValidationRule->create($data));
     $this->assertTrue($this->ValidationRule->validates());
     $this->assertFalse(array_key_exists("emailmobile", $this->ValidationRule->validationErrors));
     $data = array('ValidationRule' => array('emailmobile' => '*****@*****.**'));
     $this->assertTrue($this->ValidationRule->create($data));
     $this->assertTrue($this->ValidationRule->validates());
     $this->assertFalse(array_key_exists("emailmobile", $this->ValidationRule->validationErrors));
     $data = array('ValidationRule' => array('emailmobile' => '*****@*****.**'));
     $this->assertTrue($this->ValidationRule->create($data));
     $this->assertTrue($this->ValidationRule->validates());
     $this->assertFalse(array_key_exists("emailmobile", $this->ValidationRule->validationErrors));
     $data = array('ValidationRule' => array('emailmobile' => '*****@*****.**'));
     $this->assertTrue($this->ValidationRule->create($data));
     $this->assertTrue($this->ValidationRule->validates());
     $this->assertFalse(array_key_exists("emailmobile", $this->ValidationRule->validationErrors));
     $data = array('ValidationRule' => array('emailmobile' => '*****@*****.**'));
     $this->assertTrue($this->ValidationRule->create($data));
     $this->assertTrue($this->ValidationRule->validates());
     $this->assertFalse(array_key_exists("emailmobile", $this->ValidationRule->validationErrors));
     $data = array('ValidationRule' => array('emailmobile' => '*****@*****.**'));
     $this->assertTrue($this->ValidationRule->create($data));
     $this->assertTrue($this->ValidationRule->validates());
     $this->assertFalse(array_key_exists("emailmobile", $this->ValidationRule->validationErrors));
 }
 function testAuthHash()
 {
     //passwordフィールドがハッシュ化されなかった場合はエラー
     $data = array('ValidationRule' => array('password' => 'abc123', 'password_conf' => 'abc123'));
     $this->assertTrue($this->ValidationRule->create($data));
     $this->assertFalse($this->ValidationRule->validates());
     $this->assertTrue(array_key_exists("password", $this->ValidationRule->validationErrors));
     //AuthComponent::passwordを使ってハッシュ化 同一値でバリデーションエラーがないことを確認
     $data = array('ValidationRule' => array('password' => AuthComponent::password('abc123cvb'), 'password_conf' => 'abc123cvb'));
     $this->assertTrue($this->ValidationRule->create($data));
     $this->assertTrue($this->ValidationRule->validates());
     $this->assertFalse(array_key_exists("password", $this->ValidationRule->validationErrors));
     //AuthComponent::passwordを使ってハッシュ化 異なる値でバリデーションエラーに引っかかるテスト
     $data = array('ValidationRule' => array('password' => AuthComponent::password('abc123cvb'), 'password_conf' => 'hoge111'));
     $this->assertTrue($this->ValidationRule->create($data));
     $this->assertFalse($this->ValidationRule->validates());
     $this->assertTrue(array_key_exists("password", $this->ValidationRule->validationErrors));
 }
 function _failSuccessTest($setFailData = array(), $setSuccessData = array(), $field)
 {
     //失敗パターン
     $data = array();
     foreach ($setFailData as $key => $value) {
         $data['ValidationRule'][$field] = $value;
         $this->assertTrue($this->ValidationRule->create($data));
         $this->assertFalse($this->ValidationRule->validates());
         $this->assertTrue(array_key_exists($field, $this->ValidationRule->validationErrors));
     }
     //成功パターン
     $data = array();
     foreach ($setSuccessData as $key => $value) {
         $data['ValidationRule'][$field] = $value;
         $this->assertTrue($this->ValidationRule->create($data));
         $this->assertTrue($this->ValidationRule->validates());
         $this->assertFalse(array_key_exists($field, $this->ValidationRule->validationErrors));
     }
 }