コード例 #1
0
ファイル: BaseModelTest.php プロジェクト: dwsla/deal
 public function testValidateByClass()
 {
     $model = new BaseModel($this->connection);
     $schema = array('birthday' => array('type' => 'date', 'required' => true));
     $model->setSchema($schema);
     // success
     $data = array('birthday' => new \MongoDate());
     $this->assertTrue($model->validate($data));
     // wrong type
     $this->setExpectedException('Exception');
     $data = array('birthday' => 123.45);
     $this->assertTrue($model->validate($data));
 }