You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
897 B
55 lines
897 B
11 years ago
|
<?php
|
||
|
|
||
11 years ago
|
namespace yiiunit\data\validators\models;
|
||
11 years ago
|
|
||
11 years ago
|
use yii\base\Model;
|
||
|
|
||
11 years ago
|
/**
|
||
|
* @codeCoverageIgnore
|
||
|
*/
|
||
11 years ago
|
class FakedValidationModel extends Model
|
||
11 years ago
|
{
|
||
11 years ago
|
private $attr = array();
|
||
|
|
||
11 years ago
|
public $val_attr_a;
|
||
|
public $val_attr_b;
|
||
|
public $val_attr_c;
|
||
|
public $val_attr_d;
|
||
|
|
||
|
|
||
|
public function rules()
|
||
|
{
|
||
|
return array(
|
||
|
array('val_attr_a, val_attr_b', 'required', 'on' => 'reqTest'),
|
||
|
array('val_attr_c', 'integer'),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
public function inlineVal($attribute, $params = array())
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
|
||
11 years ago
|
public function __get($name)
|
||
11 years ago
|
{
|
||
11 years ago
|
if (stripos($name, 'attr') === 0) {
|
||
|
return isset($this->attr[$name]) ? $this->attr[$name] : null;
|
||
|
}
|
||
|
|
||
|
return parent::__get($name);
|
||
11 years ago
|
}
|
||
11 years ago
|
|
||
|
public function __set($name, $value)
|
||
11 years ago
|
{
|
||
11 years ago
|
if (stripos($name, 'attr') === 0) {
|
||
|
$this->attr[$name] = $value;
|
||
|
} else {
|
||
|
parent::__set($name, $value);
|
||
|
}
|
||
11 years ago
|
}
|
||
11 years ago
|
|
||
|
public function getAttributeLabel($attr)
|
||
|
{
|
||
|
return $attr;
|
||
|
}
|
||
11 years ago
|
}
|