Commit a81480d3 by Suralc

Improved ValidatorTest organization.

parent b5472c20
<?php <?php
namespace yiiunit\framework\validators; namespace yiiunit\data\validators\models;
use yii\base\Model; use yii\base\Model;
...@@ -11,6 +11,25 @@ class FakedValidationModel extends Model ...@@ -11,6 +11,25 @@ class FakedValidationModel extends Model
{ {
private $attr = array(); private $attr = array();
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;
}
public function __get($name) public function __get($name)
{ {
if (stripos($name, 'attr') === 0) { if (stripos($name, 'attr') === 0) {
......
<?php <?php
namespace yiiunit\framework\validators; namespace yiiunit\framework\validators;
use yiiunit\framework\validators\FakedValidationModel; use yiiunit\data\validators\models\FakedValidationModel;
use yii\validators\BooleanValidator; use yii\validators\BooleanValidator;
use yiiunit\TestCase; use yiiunit\TestCase;
require_once __DIR__ . '/FakedValidationModel.php';
/** /**
* BooleanValidatorTest * BooleanValidatorTest
*/ */
......
...@@ -3,9 +3,9 @@ namespace yiiunit\framework\validators; ...@@ -3,9 +3,9 @@ namespace yiiunit\framework\validators;
use yii\base\InvalidConfigException; use yii\base\InvalidConfigException;
use yii\validators\CompareValidator; use yii\validators\CompareValidator;
use yiiunit\data\validators\models\FakedValidationModel;
use yiiunit\TestCase; use yiiunit\TestCase;
require_once __DIR__ . '/FakedValidationModel.php';
class CompareValidatorTest extends TestCase class CompareValidatorTest extends TestCase
......
...@@ -4,9 +4,9 @@ namespace yiiunit\framework\validators; ...@@ -4,9 +4,9 @@ namespace yiiunit\framework\validators;
use DateTime; use DateTime;
use yii\validators\DateValidator; use yii\validators\DateValidator;
use yiiunit\data\validators\models\FakedValidationModel;
use yiiunit\TestCase; use yiiunit\TestCase;
require_once __DIR__ . '/FakedValidationModel.php';
class DateValidatorTest extends TestCase class DateValidatorTest extends TestCase
{ {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace yiiunit\framework\validators; namespace yiiunit\framework\validators;
use yii\validators\EmailValidator; use yii\validators\EmailValidator;
use yiiunit\data\validators\models\FakedValidationModel;
use yiiunit\TestCase; use yiiunit\TestCase;
/** /**
......
...@@ -4,6 +4,7 @@ namespace yiiunit\framework\validators; ...@@ -4,6 +4,7 @@ namespace yiiunit\framework\validators;
use yii\validators\NumberValidator; use yii\validators\NumberValidator;
use yiiunit\data\validators\models\FakedValidationModel;
use yiiunit\TestCase; use yiiunit\TestCase;
class NumberValidatorTest extends TestCase class NumberValidatorTest extends TestCase
......
...@@ -4,6 +4,7 @@ namespace yiiunit\framework\validators; ...@@ -4,6 +4,7 @@ namespace yiiunit\framework\validators;
use yii\validators\StringValidator; use yii\validators\StringValidator;
use yiiunit\data\validators\models\FakedValidationModel;
use yiiunit\TestCase; use yiiunit\TestCase;
class StringValidatorTest extends TestCase class StringValidatorTest extends TestCase
......
<?php <?php
namespace yiiunit\framework\validators; namespace yiiunit\framework\validators;
use yiiunit\framework\validators\FakedValidationModel; use yiiunit\data\validators\models\FakedValidationModel;
use yii\validators\UrlValidator; use yii\validators\UrlValidator;
use yiiunit\TestCase; use yiiunit\TestCase;
require_once __DIR__ . '/FakedValidationModel.php';
/** /**
* UrlValidatorTest * UrlValidatorTest
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment