示例#1
0
 /**
  * testValidateMany method
  *
  * @return void
  */
 public function testValidateMany()
 {
     $TestModel = new Boat();
     $TestModel->validate = array('title' => 'notBlank');
     $data = array(0 => array('title' => ''), 1 => array('title' => 'title 1'), 2 => array('title' => 'title 2'));
     $result = $TestModel->validateMany($data);
     $this->assertFalse($result);
     $expected = array(0 => array('title' => array('This field cannot be left blank')));
     $this->assertEquals($expected, $TestModel->validationErrors);
     $data = array(0 => array('title' => 'title 0'), 1 => array('title' => ''), 2 => array('title' => 'title 2'));
     $result = $TestModel->validateMany($data);
     $this->assertFalse($result);
     $expected = array(1 => array('title' => array('This field cannot be left blank')));
     $this->assertEquals($expected, $TestModel->validationErrors);
 }