public function testCustomMessage()
 {
     BookFormat::$validatesFormatOf[0]['message'] = 'is using a custom message.';
     BookFormat::$validatesFormatOf[0]['with'] = '/[^0-9]/';
     $book = new BookFormat();
     $book->name = null;
     $book->save();
     $this->assertEquals('is using a custom message.', $book->errors->on('name'));
 }
Ejemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBookFormats()
 {
     return $this->hasMany(BookFormat::className(), ['formatId' => 'id']);
 }